Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Vosburgh2013-08-21 21:45:19 +0000
committerBrian Vosburgh2013-08-26 19:14:38 +0000
commitff7e4bbf7148817aeb728e3fbc7062891084ee61 (patch)
tree2538df6344b09ea6daccd0c3f206e32e9a5432d4
parente5cc7d1d3cc759388c6d3c6a8b082433d421dc39 (diff)
downloadwebtools.dali-ff7e4bbf7148817aeb728e3fbc7062891084ee61.tar.gz
webtools.dali-ff7e4bbf7148817aeb728e3fbc7062891084ee61.tar.xz
webtools.dali-ff7e4bbf7148817aeb728e3fbc7062891084ee61.zip
add InterruptibleFactory wrapper implementations
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/AbstractInterruptibleClosure.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ClosureAdapter.java1
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/CompositeInterruptibleClosure.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalClosure.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalInterruptibleClosure.java9
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureAdapter.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureWrapper.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleTransformerClosure.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckClosureWrapper.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckInterruptibleClosureWrapper.java9
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullClosure.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingClosure.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingInterruptibleClosure.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SafeInterruptibleClosureWrapper.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchClosure.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchInterruptibleClosure.java14
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/TransformerClosure.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilClosure.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilInterruptibleClosure.java14
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileClosure.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileInterruptibleClosure.java9
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/CastingInterruptibleFactoryWrapper.java46
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/DowncastingInterruptibleFactoryWrapper.java46
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/InterruptibleFactoryWrapper.java44
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/SafeInterruptibleFactoryWrapper.java52
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/UpcastingInterruptibleFactoryWrapper.java46
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/ClosureTransformer.java2
27 files changed, 310 insertions, 67 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/AbstractInterruptibleClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/AbstractInterruptibleClosure.java
index 8d7ee03adf..81ff0e3a45 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/AbstractInterruptibleClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/AbstractInterruptibleClosure.java
@@ -10,12 +10,7 @@
package org.eclipse.jpt.common.utility.internal.closure;
/**
- * Convenience superclass that does nothing if the argument
- * is <code>null</code>; otherwise it calls {@link #execute_(Object)},
- * which is to be implemented by subclasses.
- *
- * @param <A> the type of the object passed to the closure
- *
+ * @see AbstractClosure
* @see NullClosure
* @see InterruptibleClosureAdapter
* @see NullCheckInterruptibleClosureWrapper
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ClosureAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ClosureAdapter.java
index 25f93ec82e..ed409e1308 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ClosureAdapter.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ClosureAdapter.java
@@ -19,6 +19,7 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
*
* @see AbstractClosure
* @see NullClosure
+ * @see NullCheckClosureWrapper
*/
public class ClosureAdapter<A>
implements Closure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/CompositeInterruptibleClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/CompositeInterruptibleClosure.java
index 42113ad0d6..5564a840a2 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/CompositeInterruptibleClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/CompositeInterruptibleClosure.java
@@ -14,10 +14,7 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
/**
- * A composite of closures. Pass the chain's argument to each closure,
- * in sequence.
- *
- * @param <A> the type of the object passed to the closure
+ * @see CompositeClosure
*/
public class CompositeInterruptibleClosure<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalClosure.java
index 10c2dcba17..9e6c6d4680 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalClosure.java
@@ -18,6 +18,11 @@ import org.eclipse.jpt.common.utility.predicate.Predicate;
* which of its two closures to execute.
*
* @param <A> the type of the object passed to the closure
+ *
+ * @see RepeatingClosure
+ * @see SwitchClosure
+ * @see UntilClosure
+ * @see WhileClosure
*/
public class ConditionalClosure<A>
implements Closure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalInterruptibleClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalInterruptibleClosure.java
index 1a3d21c490..64a766ff92 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalInterruptibleClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/ConditionalInterruptibleClosure.java
@@ -14,10 +14,11 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.predicate.Predicate;
/**
- * Closure that passes its argument to a configured predicate to determine
- * which of its two closures to execute.
- *
- * @param <A> the type of the object passed to the closure
+ * @see ConditionalClosure
+ * @see RepeatingInterruptibleClosure
+ * @see SwitchInterruptibleClosure
+ * @see UntilInterruptibleClosure
+ * @see WhileInterruptibleClosure
*/
public class ConditionalInterruptibleClosure<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureAdapter.java
index 22bd024134..03f2326164 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureAdapter.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureAdapter.java
@@ -13,11 +13,10 @@ import org.eclipse.jpt.common.utility.closure.InterruptibleClosure;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
/**
- * Convenience closure that does nothing.
- *
- * @param <A> the type of the object passed to the closure
- *
+ * @see ClosureAdapter
* @see NullClosure
+ * @see AbstractInterruptibleClosure
+ * @see NullCheckInterruptibleClosureWrapper
*/
public class InterruptibleClosureAdapter<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureWrapper.java
index e3037bb653..75a420e07e 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleClosureWrapper.java
@@ -13,12 +13,7 @@ import org.eclipse.jpt.common.utility.closure.InterruptibleClosure;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
/**
- * closure wrapper that can have its wrapped closure changed,
- * allowing a client to change a previously-supplied closure's
- * behavior mid-stream.
- *
- * @param <A> the type of the object passed to the closure
- *
+ * @see ClosureWrapper
* @see #setClosure(InterruptibleClosure)
*/
public class InterruptibleClosureWrapper<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleTransformerClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleTransformerClosure.java
index 39b30f3c70..6d3f3ddae8 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleTransformerClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/InterruptibleTransformerClosure.java
@@ -14,12 +14,8 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.transformer.InterruptibleTransformer;
/**
- * Adapt an {@link InterruptibleTransformer} to the {@link InterruptibleClosure}
- * interface. The transformer's output is ignored. This really only useful for a
- * transformer that has side-effects.
- *
- * @param <A> the type of the object passed to the closure and forwarded to the
- * transformer
+ * @see TransformerClosure
+ * @see org.eclipse.jpt.common.utility.internal.transformer.InterruptibleClosureTransformer
*/
public class InterruptibleTransformerClosure<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckClosureWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckClosureWrapper.java
index cecd255b67..78c1ac3dd8 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckClosureWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckClosureWrapper.java
@@ -19,6 +19,10 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
* the closure will execute the configured command.
*
* @param <A> the type of the object passed to the closure
+ *
+ * @see AbstractClosure
+ * @see NullClosure
+ * @see ClosureAdapter
*/
public class NullCheckClosureWrapper<A>
implements Closure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckInterruptibleClosureWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckInterruptibleClosureWrapper.java
index 398fc4cbed..9033212fae 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckInterruptibleClosureWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullCheckInterruptibleClosureWrapper.java
@@ -14,11 +14,10 @@ import org.eclipse.jpt.common.utility.command.InterruptibleCommand;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
/**
- * Closure wrapper that checks for a <code>null</code> argument before forwarding
- * the argument to the wrapped closure. If the argument is <code>null</code>,
- * the closer will execute the configured command.
- *
- * @param <A> the type of the object passed to the closure
+ * @see NullCheckClosureWrapper
+ * @see AbstractInterruptibleClosure
+ * @see NullClosure
+ * @see InterruptibleClosureAdapter
*/
public class NullCheckInterruptibleClosureWrapper<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullClosure.java
index 1f147bcdb5..099596ec31 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/NullClosure.java
@@ -17,6 +17,10 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
* Closure that will do nothing when executed.
*
* @param <A> the type of the object passed to the closure
+ *
+ * @see AbstractClosure
+ * @see ClosureAdapter
+ * @see NullCheckClosureWrapper
*/
public final class NullClosure<A>
implements Closure<A>, Serializable
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingClosure.java
index a6f15da783..2eb80a1421 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingClosure.java
@@ -16,6 +16,11 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
* Closure that executes another closure a specified number of times.
*
* @param <A> the type of the object passed to the closure
+ *
+ * @see ConditionalClosure
+ * @see SwitchClosure
+ * @see UntilClosure
+ * @see WhileClosure
*/
public class RepeatingClosure<A>
implements Closure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingInterruptibleClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingInterruptibleClosure.java
index 906e7dd695..a401a79a9d 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingInterruptibleClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/RepeatingInterruptibleClosure.java
@@ -13,9 +13,11 @@ import org.eclipse.jpt.common.utility.closure.InterruptibleClosure;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
/**
- * InterruptibleClosure that executes another closure a specified number of times.
- *
- * @param <A> the type of the object passed to the closure
+ * @see RepeatingClosure
+ * @see ConditionalInterruptibleClosure
+ * @see SwitchInterruptibleClosure
+ * @see UntilInterruptibleClosure
+ * @see WhileInterruptibleClosure
*/
public class RepeatingInterruptibleClosure<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SafeInterruptibleClosureWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SafeInterruptibleClosureWrapper.java
index 21060ec37b..b106b075b8 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SafeInterruptibleClosureWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SafeInterruptibleClosureWrapper.java
@@ -14,13 +14,7 @@ import org.eclipse.jpt.common.utility.exception.ExceptionHandler;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
/**
- * Closure wrapper that will handle any exceptions (other than
- * {@link InterruptedException}) thrown by the wrapped
- * closure with an {@link ExceptionHandler exception handler}. If the
- * wrapped closure throws an exception, the safe closure will handle
- * the exception and return.
- *
- * @param <A> the type of the object passed to the closure
+ * @see SafeClosureWrapper
*/
public class SafeInterruptibleClosureWrapper<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchClosure.java
index efce303681..c4839d7af7 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchClosure.java
@@ -25,6 +25,11 @@ import org.eclipse.jpt.common.utility.predicate.Predicate;
* is executed.
*
* @param <A> the type of the object passed to the closure
+ *
+ * @see ConditionalClosure
+ * @see RepeatingClosure
+ * @see UntilClosure
+ * @see WhileClosure
*/
public class SwitchClosure<A>
implements Closure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchInterruptibleClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchInterruptibleClosure.java
index bbc5bcb167..086c518f0e 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchInterruptibleClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/SwitchInterruptibleClosure.java
@@ -16,15 +16,11 @@ import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
import org.eclipse.jpt.common.utility.predicate.Predicate;
/**
- * Interruptible closure that loops over a configured set of predicate/closure pairs,
- * passing its argument to each predicate to determine
- * which of the closures to execute. Only the first closure whose predicate
- * evaluates to <code>true</code> is executed, even if other, following,
- * predicates would evaluate to <code>true</code>.
- * If none of the predicates evaluates to <code>true</code>, the default closure
- * is executed.
- *
- * @param <A> the type of the object passed to the closure
+ * @see SwitchClosure
+ * @see ConditionalInterruptibleClosure
+ * @see RepeatingInterruptibleClosure
+ * @see UntilInterruptibleClosure
+ * @see WhileInterruptibleClosure
*/
public class SwitchInterruptibleClosure<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/TransformerClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/TransformerClosure.java
index 3846f7c6b4..c336a972d9 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/TransformerClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/TransformerClosure.java
@@ -20,6 +20,8 @@ import org.eclipse.jpt.common.utility.transformer.Transformer;
*
* @param <A> the type of the object passed to the closure and forwarded to the
* transformer
+ *
+ * @see org.eclipse.jpt.common.utility.internal.transformer.ClosureTransformer
*/
public class TransformerClosure<A>
implements Closure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilClosure.java
index 7efe5ed941..1caa60423b 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilClosure.java
@@ -24,6 +24,11 @@ import org.eclipse.jpt.common.utility.predicate.Predicate;
* <em>not</em> <code>false</code>).
*
* @param <A> the type of the object passed to the closure
+ *
+ * @see ConditionalClosure
+ * @see RepeatingClosure
+ * @see SwitchClosure
+ * @see WhileClosure
*/
public class UntilClosure<A>
implements Closure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilInterruptibleClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilInterruptibleClosure.java
index b7df93e05a..a307e8ebac 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilInterruptibleClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/UntilInterruptibleClosure.java
@@ -14,15 +14,11 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.predicate.Predicate;
/**
- * Interruptible closure that executes another closure until a predicate evaluates to
- * <code>true</code> when passed the argument. The
- * <p>
- * <strong>NB:</strong> This is the inverse of the Java <code>do-while</code>
- * statement (i.e. it executes until the predicate evaluates to
- * <strong><code>true</code></strong>,
- * <em>not</em> <code>false</code>).
- *
- * @param <A> the type of the object passed to the closure
+ * @see UntilClosure
+ * @see ConditionalInterruptibleClosure
+ * @see RepeatingInterruptibleClosure
+ * @see SwitchInterruptibleClosure
+ * @see WhileInterruptibleClosure
*/
public class UntilInterruptibleClosure<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileClosure.java
index 7c6164aeb0..dfbd8c8f2e 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileClosure.java
@@ -18,6 +18,11 @@ import org.eclipse.jpt.common.utility.predicate.Predicate;
* <code>true</code> when passed the argument.
*
* @param <A> the type of the object passed to the closure
+ *
+ * @see ConditionalClosure
+ * @see RepeatingClosure
+ * @see SwitchClosure
+ * @see UntilClosure
*/
public class WhileClosure<A>
implements Closure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileInterruptibleClosure.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileInterruptibleClosure.java
index 90b89f30b5..de0014ab88 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileInterruptibleClosure.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/closure/WhileInterruptibleClosure.java
@@ -14,10 +14,11 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.predicate.Predicate;
/**
- * InterruptibleClosure that executes another closure while a predicate evaluates to
- * <code>true</code> when passed the argument.
- *
- * @param <A> the type of the object passed to the closure
+ * @see WhileClosure
+ * @see ConditionalInterruptibleClosure
+ * @see RepeatingInterruptibleClosure
+ * @see SwitchInterruptibleClosure
+ * @see UntilInterruptibleClosure
*/
public class WhileInterruptibleClosure<A>
implements InterruptibleClosure<A>
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/CastingInterruptibleFactoryWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/CastingInterruptibleFactoryWrapper.java
new file mode 100644
index 0000000000..2fd0cac66b
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/CastingInterruptibleFactoryWrapper.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.utility.internal.factory;
+
+import org.eclipse.jpt.common.utility.factory.InterruptibleFactory;
+import org.eclipse.jpt.common.utility.internal.ObjectTools;
+
+/**
+ * @see CastingFactoryWrapper
+ * @see DowncastingInterruptibleFactoryWrapper
+ * @see UpcastingInterruptibleFactoryWrapper
+ */
+public class CastingInterruptibleFactoryWrapper<X, T>
+ implements InterruptibleFactory<T>
+{
+ private final InterruptibleFactory<X> factory;
+
+
+ public CastingInterruptibleFactoryWrapper(InterruptibleFactory<X> factory) {
+ super();
+ if (factory == null) {
+ throw new NullPointerException();
+ }
+ this.factory = factory;
+ }
+
+ /**
+ * Cast the result and hope for the best.
+ */
+ @SuppressWarnings("unchecked")
+ public T create() throws InterruptedException {
+ return (T) this.factory.create();
+ }
+
+ @Override
+ public String toString() {
+ return ObjectTools.toString(this, this.factory);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/DowncastingInterruptibleFactoryWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/DowncastingInterruptibleFactoryWrapper.java
new file mode 100644
index 0000000000..18a0f2e831
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/DowncastingInterruptibleFactoryWrapper.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.utility.internal.factory;
+
+import org.eclipse.jpt.common.utility.internal.ObjectTools;
+import org.eclipse.jpt.common.utility.factory.InterruptibleFactory;
+
+/**
+ * @see DowncastingFactoryWrapper
+ * @see CastingInterruptibleFactoryWrapper
+ * @see UpcastingInterruptibleFactoryWrapper
+ */
+public class DowncastingInterruptibleFactoryWrapper<X, T extends X>
+ implements InterruptibleFactory<T>
+{
+ private final InterruptibleFactory<X> factory;
+
+
+ public DowncastingInterruptibleFactoryWrapper(InterruptibleFactory<X> factory) {
+ super();
+ if (factory == null) {
+ throw new NullPointerException();
+ }
+ this.factory = factory;
+ }
+
+ /**
+ * Cast the output and hope for the best.
+ */
+ @SuppressWarnings("unchecked")
+ public T create() throws InterruptedException {
+ return (T) this.factory.create();
+ }
+
+ @Override
+ public String toString() {
+ return ObjectTools.toString(this, this.factory);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/InterruptibleFactoryWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/InterruptibleFactoryWrapper.java
new file mode 100644
index 0000000000..590f2cbde7
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/InterruptibleFactoryWrapper.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.utility.internal.factory;
+
+import org.eclipse.jpt.common.utility.factory.InterruptibleFactory;
+import org.eclipse.jpt.common.utility.internal.ObjectTools;
+
+/**
+ * @see FactoryWrapper
+ * @see #setFactory(InterruptibleFactory)
+ */
+public class InterruptibleFactoryWrapper<T>
+ implements InterruptibleFactory<T>
+{
+ protected volatile InterruptibleFactory<? extends T> factory;
+
+ public InterruptibleFactoryWrapper(InterruptibleFactory<? extends T> factory) {
+ super();
+ this.setFactory(factory);
+ }
+
+ public T create() throws InterruptedException {
+ return this.factory.create();
+ }
+
+ public void setFactory(InterruptibleFactory<? extends T> factory) {
+ if (factory == null) {
+ throw new NullPointerException();
+ }
+ this.factory = factory;
+ }
+
+ @Override
+ public String toString() {
+ return ObjectTools.toString(this, this.factory);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/SafeInterruptibleFactoryWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/SafeInterruptibleFactoryWrapper.java
new file mode 100644
index 0000000000..accb143d23
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/SafeInterruptibleFactoryWrapper.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.utility.internal.factory;
+
+import org.eclipse.jpt.common.utility.exception.ExceptionHandler;
+import org.eclipse.jpt.common.utility.internal.ObjectTools;
+import org.eclipse.jpt.common.utility.factory.InterruptibleFactory;
+
+/**
+ * @see SafeFactoryWrapper
+ */
+public class SafeInterruptibleFactoryWrapper<T>
+ implements InterruptibleFactory<T>
+{
+ private final InterruptibleFactory<? extends T> factory;
+ private final ExceptionHandler exceptionHandler;
+ private final T exceptionValue;
+
+
+ public SafeInterruptibleFactoryWrapper(InterruptibleFactory<? extends T> factory, ExceptionHandler exceptionHandler, T exceptionOutput) {
+ super();
+ if ((factory == null) || (exceptionHandler == null)) {
+ throw new NullPointerException();
+ }
+ this.factory = factory;
+ this.exceptionHandler = exceptionHandler;
+ this.exceptionValue = exceptionOutput;
+ }
+
+ public T create() throws InterruptedException {
+ try {
+ return this.factory.create();
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (Throwable ex) {
+ this.exceptionHandler.handleException(ex);
+ return this.exceptionValue;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return ObjectTools.toString(this, this.factory);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/UpcastingInterruptibleFactoryWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/UpcastingInterruptibleFactoryWrapper.java
new file mode 100644
index 0000000000..59ac9c0105
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/factory/UpcastingInterruptibleFactoryWrapper.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.common.utility.internal.factory;
+
+import org.eclipse.jpt.common.utility.internal.ObjectTools;
+import org.eclipse.jpt.common.utility.factory.InterruptibleFactory;
+
+/**
+ * @see UpcastingFactoryWrapper
+ * @see CastingInterruptibleFactoryWrapper
+ * @see DowncastingInterruptibleFactoryWrapper
+ */
+public class UpcastingInterruptibleFactoryWrapper<T, X extends T>
+ implements InterruptibleFactory<T>
+{
+ private final InterruptibleFactory<X> factory;
+
+
+ public UpcastingInterruptibleFactoryWrapper(InterruptibleFactory<X> factory) {
+ super();
+ if (factory == null) {
+ throw new NullPointerException();
+ }
+ this.factory = factory;
+ }
+
+ /**
+ * No need for casting as the type is guaranteed by the generic type
+ * argument.
+ */
+ public T create() throws InterruptedException {
+ return this.factory.create();
+ }
+
+ @Override
+ public String toString() {
+ return ObjectTools.toString(this, this.factory);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/ClosureTransformer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/ClosureTransformer.java
index cd5c923b46..7d0adc5107 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/ClosureTransformer.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/transformer/ClosureTransformer.java
@@ -21,6 +21,8 @@ import org.eclipse.jpt.common.utility.transformer.Transformer;
* to the closure
* @param <O> output: the type of the object returned by the transformer; always
* <code>null</code>
+ *
+ * @see org.eclipse.jpt.common.utility.internal.closure.TransformerClosure
*/
public class ClosureTransformer<I, O>
implements Transformer<I, O>

Back to the top