diff options
author | Brian Vosburgh | 2016-07-27 20:10:37 +0000 |
---|---|---|
committer | Brian Vosburgh | 2017-05-18 22:38:27 +0000 |
commit | 9dde5df7730bbd223d8a6b257226aa6a77e7d4e7 (patch) | |
tree | 274f7f1fca470679f068ef8687c8bb3ff3d73890 | |
parent | 06c097ea624967eb2fcaeccb2bb244535669861c (diff) | |
download | webtools.dali-9dde5df7730bbd223d8a6b257226aa6a77e7d4e7.tar.gz webtools.dali-9dde5df7730bbd223d8a6b257226aa6a77e7d4e7.tar.xz webtools.dali-9dde5df7730bbd223d8a6b257226aa6a77e7d4e7.zip |
clean up some property value model adapter factories etc.
8 files changed, 85 insertions, 46 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedPropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedPropertyValueModelAdapter.java index b6eaf814c3..383c77b1b9 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedPropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedPropertyValueModelAdapter.java @@ -46,7 +46,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; * @param <V> the type of the model's value * @see PropertyAspectAdapterXXXX */ -public class BufferedPropertyValueModelAdapter<V> +public final class BufferedPropertyValueModelAdapter<V> implements PluggableModifiablePropertyValueModel.Adapter<V>, PropertyChangeListener { /** @@ -263,7 +263,7 @@ public class BufferedPropertyValueModelAdapter<V> * A trigger is used to <em>accept</em> or <em>reset</em> one or more * buffered value models. */ - public static class Trigger { + public static final class Trigger { private final ListenerList<Listener> listenerList = ModelTools.listenerList(); public Trigger() { @@ -310,7 +310,7 @@ public class BufferedPropertyValueModelAdapter<V> // ********** Factory ********** - public static class Factory<V> + public static final class Factory<V> implements PluggableModifiablePropertyValueModel.Adapter.Factory<V> { /* CU private */ final ModifiablePropertyValueModel<V> wrappedValueModel; diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionTransformationPluggablePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionTransformationPluggablePropertyValueModelAdapter.java index 8538f41413..65ce3beb17 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionTransformationPluggablePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionTransformationPluggablePropertyValueModelAdapter.java @@ -63,13 +63,20 @@ public final class CollectionTransformationPluggablePropertyValueModelAdapter<E, // ********** constructors ********** - public CollectionTransformationPluggablePropertyValueModelAdapter(Factory<E, V> factory, BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { + public CollectionTransformationPluggablePropertyValueModelAdapter( + CollectionValueModel<? extends E> collectionModel, + Transformer<? super Collection<E>, V> transformer, + BasePluggablePropertyValueModel.Adapter.Listener<V> listener + ) { super(); - if (factory == null) { + if (collectionModel == null) { throw new NullPointerException(); } - this.collectionModel = factory.collectionModel; - this.transformer = factory.transformer; + this.collectionModel = collectionModel; + if (transformer == null) { + throw new NullPointerException(); + } + this.transformer = transformer; if (listener == null) { throw new NullPointerException(); } @@ -138,11 +145,11 @@ public final class CollectionTransformationPluggablePropertyValueModelAdapter<E, // ********** PluggablePropertyValueModel.Adapter.Factory ********** - public static class Factory<E, V> + public static final class Factory<E, V> implements PluggablePropertyValueModel.Adapter.Factory<V> { - /* CU private */ final CollectionValueModel<? extends E> collectionModel; - /* CU private */ final Transformer<? super Collection<E>, V> transformer; + private final CollectionValueModel<? extends E> collectionModel; + private final Transformer<? super Collection<E>, V> transformer; public Factory(CollectionValueModel<? extends E> collectionModel, Transformer<? super Collection<E>, V> transformer) { super(); @@ -157,7 +164,7 @@ public final class CollectionTransformationPluggablePropertyValueModelAdapter<E, } public Adapter<V> buildAdapter(BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { - return new CollectionTransformationPluggablePropertyValueModelAdapter<>(this, listener); + return new CollectionTransformationPluggablePropertyValueModelAdapter<>(this.collectionModel, this.transformer, listener); } @Override diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModelAdapter.java index 80851905f6..0f1856fa4c 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModelAdapter.java @@ -89,13 +89,20 @@ public final class CompositePropertyValueModelAdapter<E, V> // ********** constructor ********** - public CompositePropertyValueModelAdapter(Factory<E, V> factory, BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { + public CompositePropertyValueModelAdapter( + CollectionValueModel<? extends PropertyValueModel<? extends E>> collectionModel, + Transformer<? super Collection<E>, V> transformer, + BasePluggablePropertyValueModel.Adapter.Listener<V> listener + ) { super(); - if (factory == null) { + if (collectionModel == null) { throw new NullPointerException(); } - this.collectionModel = factory.collectionModel; - this.transformer = factory.transformer; + this.collectionModel = collectionModel; + if (transformer == null) { + throw new NullPointerException(); + } + this.transformer = transformer; if (listener == null) { throw new NullPointerException(); } @@ -234,11 +241,11 @@ public final class CompositePropertyValueModelAdapter<E, V> // ********** PluggablePropertyValueModel.Adapter.Factory ********** - public static class Factory<E, V> + public static final class Factory<E, V> implements PluggablePropertyValueModel.Adapter.Factory<V> { - /* CU private */ final CollectionValueModel<? extends PropertyValueModel<? extends E>> collectionModel; - /* CU private */ final Transformer<? super Collection<E>, V> transformer; + private final CollectionValueModel<? extends PropertyValueModel<? extends E>> collectionModel; + private final Transformer<? super Collection<E>, V> transformer; public Factory(CollectionValueModel<? extends PropertyValueModel<? extends E>> collectionModel, Transformer<? super Collection<E>, V> transformer) { super(); @@ -253,7 +260,7 @@ public final class CompositePropertyValueModelAdapter<E, V> } public Adapter<V> buildAdapter(BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { - return new CompositePropertyValueModelAdapter<>(this, listener); + return new CompositePropertyValueModelAdapter<>(this.collectionModel, this.transformer, listener); } @Override diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCompositePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCompositePropertyValueModelAdapter.java index 7f190fd85f..dde3709204 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCompositePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCompositePropertyValueModelAdapter.java @@ -86,13 +86,20 @@ public final class ListCompositePropertyValueModelAdapter<E, V> // ********** constructor ********** - public ListCompositePropertyValueModelAdapter(Factory<E, V> factory, BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { + public ListCompositePropertyValueModelAdapter( + ListValueModel<? extends PropertyValueModel<? extends E>> listModel, + Transformer<? super List<E>, V> transformer, + BasePluggablePropertyValueModel.Adapter.Listener<V> listener + ) { super(); - if (factory == null) { + if (listModel == null) { throw new NullPointerException(); } - this.listModel = factory.listModel; - this.transformer = factory.transformer; + this.listModel = listModel; + if (transformer == null) { + throw new NullPointerException(); + } + this.transformer = transformer; if (listener == null) { throw new NullPointerException(); } @@ -252,11 +259,11 @@ public final class ListCompositePropertyValueModelAdapter<E, V> // ********** PluggablePropertyValueModel.Adapter.Factory ********** - public static class Factory<E, V> + public static final class Factory<E, V> implements PluggablePropertyValueModel.Adapter.Factory<V> { - /* CU private */ final ListValueModel<? extends PropertyValueModel<? extends E>> listModel; - /* CU private */ final Transformer<? super List<E>, V> transformer; + private final ListValueModel<? extends PropertyValueModel<? extends E>> listModel; + private final Transformer<? super List<E>, V> transformer; public Factory(ListValueModel<? extends PropertyValueModel<? extends E>> listModel, Transformer<? super List<E>, V> transformer) { super(); @@ -271,7 +278,7 @@ public final class ListCompositePropertyValueModelAdapter<E, V> } public Adapter<V> buildAdapter(BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { - return new ListCompositePropertyValueModelAdapter<>(this, listener); + return new ListCompositePropertyValueModelAdapter<>(this.listModel, this.transformer, listener); } @Override diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListTransformationPluggablePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListTransformationPluggablePropertyValueModelAdapter.java index aca8325ca8..5f0e70793b 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListTransformationPluggablePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListTransformationPluggablePropertyValueModelAdapter.java @@ -67,13 +67,20 @@ public final class ListTransformationPluggablePropertyValueModelAdapter<E, V> // ********** constructors ********** - public ListTransformationPluggablePropertyValueModelAdapter(Factory<E, V> factory, BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { + public ListTransformationPluggablePropertyValueModelAdapter( + ListValueModel<? extends E> listModel, + Transformer<? super List<E>, V> transformer, + BasePluggablePropertyValueModel.Adapter.Listener<V> listener + ) { super(); - if (factory == null) { + if (listModel == null) { throw new NullPointerException(); } - this.listModel = factory.listModel; - this.transformer = factory.transformer; + this.listModel = listModel; + if (transformer == null) { + throw new NullPointerException(); + } + this.transformer = transformer; if (listener == null) { throw new NullPointerException(); } @@ -158,11 +165,11 @@ public final class ListTransformationPluggablePropertyValueModelAdapter<E, V> // ********** PluggablePropertyValueModel.Adapter.Factory ********** - public static class Factory<E, V> + public static final class Factory<E, V> implements PluggablePropertyValueModel.Adapter.Factory<V> { - /* CU private */ final ListValueModel<? extends E> listModel; - /* CU private */ final Transformer<? super List<E>, V> transformer; + private final ListValueModel<? extends E> listModel; + private final Transformer<? super List<E>, V> transformer; public Factory(ListValueModel<? extends E> listModel, Transformer<? super List<E>, V> transformer) { super(); @@ -177,7 +184,7 @@ public final class ListTransformationPluggablePropertyValueModelAdapter<E, V> } public Adapter<V> buildAdapter(BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { - return new ListTransformationPluggablePropertyValueModelAdapter<>(this, listener); + return new ListTransformationPluggablePropertyValueModelAdapter<>(this.listModel, this.transformer, listener); } @Override diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggableModifiablePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggableModifiablePropertyValueModelAdapter.java index a7bc54f549..6d68614e8e 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggableModifiablePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggableModifiablePropertyValueModelAdapter.java @@ -22,7 +22,7 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools; * * @param <V> the type of the model's derived value */ -public class PluggableModifiablePropertyValueModelAdapter<V> +public final class PluggableModifiablePropertyValueModelAdapter<V> implements PluggableModifiablePropertyValueModel.Adapter<V> { /** Read the adapted model with this. */ @@ -64,7 +64,7 @@ public class PluggableModifiablePropertyValueModelAdapter<V> // ********** Factory ********** - public static class Factory<V> + public static final class Factory<V> implements PluggableModifiablePropertyValueModel.Adapter.Factory<V> { private final BasePluggablePropertyValueModel.Adapter.Factory<V, ? extends BasePluggablePropertyValueModel.Adapter<V>> factory; diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java index dbdc48992b..2709c039d7 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java @@ -53,7 +53,11 @@ public final class PluggablePropertyAspectAdapter<V, S, SM extends PropertyValue private final BasePluggablePropertyValueModel.Adapter.Listener<V> listener; // backpointer - public PluggablePropertyAspectAdapter(SM subjectModel, SubjectAdapter.Factory<V, S> subjectAdapterFactory, BasePluggablePropertyValueModel.Adapter.Listener<V> listener) { + public PluggablePropertyAspectAdapter( + SM subjectModel, + SubjectAdapter.Factory<V, S> subjectAdapterFactory, + BasePluggablePropertyValueModel.Adapter.Listener<V> listener + ) { super(); if (subjectModel == null) { throw new NullPointerException(); diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPluggablePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPluggablePropertyValueModelAdapter.java index dd69107a2e..07e2fd8661 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPluggablePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPluggablePropertyValueModelAdapter.java @@ -48,13 +48,20 @@ public final class TransformationPluggablePropertyValueModelAdapter<V1, V2> // ********** constructors ********** - public TransformationPluggablePropertyValueModelAdapter(Factory<V1, V2> factory, BasePluggablePropertyValueModel.Adapter.Listener<V2> listener) { + public TransformationPluggablePropertyValueModelAdapter( + PropertyValueModel<? extends V1> propertyModel, + Transformer<? super V1, ? extends V2> transformer, + BasePluggablePropertyValueModel.Adapter.Listener<V2> listener + ) { super(); - if (factory == null) { + if (propertyModel == null) { throw new NullPointerException(); } - this.propertyModel = factory.propertyModel; - this.transformer = factory.transformer; + this.propertyModel = propertyModel; + if (transformer == null) { + throw new NullPointerException(); + } + this.transformer = transformer; if (listener == null) { throw new NullPointerException(); } @@ -104,11 +111,11 @@ public final class TransformationPluggablePropertyValueModelAdapter<V1, V2> // ********** Factory ********** - public static class Factory<V1, V2> + public static final class Factory<V1, V2> implements PluggablePropertyValueModel.Adapter.Factory<V2> { - /* CU private */ final PropertyValueModel<? extends V1> propertyModel; - /* CU private */ final Transformer<? super V1, ? extends V2> transformer; + private final PropertyValueModel<? extends V1> propertyModel; + private final Transformer<? super V1, ? extends V2> transformer; public Factory(PropertyValueModel<? extends V1> propertyModel, Transformer<? super V1, ? extends V2> transformer) { super(); @@ -123,7 +130,7 @@ public final class TransformationPluggablePropertyValueModelAdapter<V1, V2> } public TransformationPluggablePropertyValueModelAdapter<V1, V2> buildAdapter(BasePluggablePropertyValueModel.Adapter.Listener<V2> listener) { - return new TransformationPluggablePropertyValueModelAdapter<>(this, listener); + return new TransformationPluggablePropertyValueModelAdapter<>(this.propertyModel, this.transformer, listener); } @Override |