You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2011/04/26 20:24:13 UTC
svn commit: r1096837 [10/14] - in /incubator/isis/trunk:
core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/
core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/map/
core/metamodel/src/main/java/org/apache/isis/core/met...
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToManyAssociation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToManyAssociation.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToManyAssociation.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToManyAssociation.java Tue Apr 26 18:24:05 2011
@@ -17,9 +17,8 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.spec.feature;
-package org.apache.isis.core.metamodel.spec.feature;
-
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.consent.Consent;
@@ -27,90 +26,83 @@ import org.apache.isis.core.metamodel.co
import org.apache.isis.core.metamodel.interactions.AccessContext;
import org.apache.isis.core.metamodel.interactions.InteractionContext;
import org.apache.isis.core.metamodel.interactions.ValidityContext;
-
-
-public interface OneToManyAssociation extends ObjectAssociation, OneToManyFeature {
-
- // /////////////////////////////////////////////////////////////
- // add
- // /////////////////////////////////////////////////////////////
-
- /**
- * Creates an {@link InteractionContext} that represents validation of a candidate object to be added to
- * the collection.
- *
- * <p>
- * Typically it is easier to just call {@link #isValidToAdd(ObjectAdapter, ObjectAdapter)} or
- * {@link #isValidToAddResult(ObjectAdapter, ObjectAdapter)}; this is provided as API for symmetry with
- * interactions (such as {@link AccessContext} accesses) have no corresponding vetoing methods.
- */
- public ValidityContext<?> createValidateAddInteractionContext(
- AuthenticationSession session,
- InteractionInvocationMethod invocationMethod,
- ObjectAdapter owningObjectAdapter,
- ObjectAdapter proposedObjectToAdd);
-
- /**
- * Determines if the specified element can be added to the collection field, represented as a
- * {@link Consent}.
- *
- * <p>
- * If allowed the {@link #addElement(ObjectAdapter, ObjectAdapter) add} method can be called with the same
- * parameters, .
- *
- * @see #isValidToAddResult(ObjectAdapter, ObjectAdapter)
- */
- Consent isValidToAdd(ObjectAdapter owningObjectAdapter, ObjectAdapter proposedObjectToAdd);
-
- /**
- * Add the specified element to this collection field in the specified object.
- */
- void addElement(ObjectAdapter owningObjectAdapter, ObjectAdapter objectToAdd);
-
- // /////////////////////////////////////////////////////////////
- // remove
- // /////////////////////////////////////////////////////////////
-
- /**
- * Creates an {@link InteractionContext} that represents validation of a candidate object to be removed
- * from the collection.
- *
- * <p>
- * Typically it is easier to just call {@link #isValidToAdd(ObjectAdapter, ObjectAdapter)} or
- * {@link #isValidToAddResult(ObjectAdapter, ObjectAdapter)}; this is provided as API for symmetry with
- * interactions (such as {@link AccessContext} accesses) have no corresponding vetoing methods.
- */
- ValidityContext<?> createValidateRemoveInteractionContext(
- AuthenticationSession session,
- InteractionInvocationMethod invocationMethod,
- ObjectAdapter owningObjectAdapter,
- ObjectAdapter proposedObjectToRemove);
-
- /**
- * Determines if the specified element can be removed from the collection field, represented as a
- * {@link Consent}.
- *
- * <p>
- * If allowed the {@link #removeElement(ObjectAdapter, ObjectAdapter) remove} method can be called with the
- * same parameters, .
- *
- * @see #removeElement(ObjectAdapter, ObjectAdapter)
- * @see #isValidToAddResult(ObjectAdapter, ObjectAdapter)
- */
- Consent isValidToRemove(ObjectAdapter owningObjectAdapter, ObjectAdapter proposedObjectToRemove);
-
- /**
- * Remove the specified element from this collection field in the specified object.
- */
- void removeElement(ObjectAdapter owningObjectAdapter, ObjectAdapter oObjectToRemove);
-
- // /////////////////////////////////////////////////////////////
- // clear
- // /////////////////////////////////////////////////////////////
-
- /**
- * Remove all elements from this collection field in the specified object.
- */
- void clearCollection(ObjectAdapter inObject);
-
-}
+
+public interface OneToManyAssociation extends ObjectAssociation, OneToManyFeature {
+
+ // /////////////////////////////////////////////////////////////
+ // add
+ // /////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an {@link InteractionContext} that represents validation of a candidate object to be added to the
+ * collection.
+ *
+ * <p>
+ * Typically it is easier to just call {@link #isValidToAdd(ObjectAdapter, ObjectAdapter)} or
+ * {@link #isValidToAddResult(ObjectAdapter, ObjectAdapter)}; this is provided as API for symmetry with interactions
+ * (such as {@link AccessContext} accesses) have no corresponding vetoing methods.
+ */
+ public ValidityContext<?> createValidateAddInteractionContext(AuthenticationSession session,
+ InteractionInvocationMethod invocationMethod, ObjectAdapter owningObjectAdapter,
+ ObjectAdapter proposedObjectToAdd);
+
+ /**
+ * Determines if the specified element can be added to the collection field, represented as a {@link Consent}.
+ *
+ * <p>
+ * If allowed the {@link #addElement(ObjectAdapter, ObjectAdapter) add} method can be called with the same
+ * parameters, .
+ *
+ * @see #isValidToAddResult(ObjectAdapter, ObjectAdapter)
+ */
+ Consent isValidToAdd(ObjectAdapter owningObjectAdapter, ObjectAdapter proposedObjectToAdd);
+
+ /**
+ * Add the specified element to this collection field in the specified object.
+ */
+ void addElement(ObjectAdapter owningObjectAdapter, ObjectAdapter objectToAdd);
+
+ // /////////////////////////////////////////////////////////////
+ // remove
+ // /////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an {@link InteractionContext} that represents validation of a candidate object to be removed from the
+ * collection.
+ *
+ * <p>
+ * Typically it is easier to just call {@link #isValidToAdd(ObjectAdapter, ObjectAdapter)} or
+ * {@link #isValidToAddResult(ObjectAdapter, ObjectAdapter)}; this is provided as API for symmetry with interactions
+ * (such as {@link AccessContext} accesses) have no corresponding vetoing methods.
+ */
+ ValidityContext<?> createValidateRemoveInteractionContext(AuthenticationSession session,
+ InteractionInvocationMethod invocationMethod, ObjectAdapter owningObjectAdapter,
+ ObjectAdapter proposedObjectToRemove);
+
+ /**
+ * Determines if the specified element can be removed from the collection field, represented as a {@link Consent}.
+ *
+ * <p>
+ * If allowed the {@link #removeElement(ObjectAdapter, ObjectAdapter) remove} method can be called with the same
+ * parameters, .
+ *
+ * @see #removeElement(ObjectAdapter, ObjectAdapter)
+ * @see #isValidToAddResult(ObjectAdapter, ObjectAdapter)
+ */
+ Consent isValidToRemove(ObjectAdapter owningObjectAdapter, ObjectAdapter proposedObjectToRemove);
+
+ /**
+ * Remove the specified element from this collection field in the specified object.
+ */
+ void removeElement(ObjectAdapter owningObjectAdapter, ObjectAdapter oObjectToRemove);
+
+ // /////////////////////////////////////////////////////////////
+ // clear
+ // /////////////////////////////////////////////////////////////
+
+ /**
+ * Remove all elements from this collection field in the specified object.
+ */
+ void clearCollection(ObjectAdapter inObject);
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToManyFeature.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToManyFeature.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToManyFeature.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToManyFeature.java Tue Apr 26 18:24:05 2011
@@ -17,21 +17,19 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.spec.feature;
-package org.apache.isis.core.metamodel.spec.feature;
-
-
-/**
- * Base interface for {@link OneToManyAssociation} only.
- *
- * <p>
- * Introduced for symmetry with {@link OneToOneFeature}; if we ever support collections as parameters then
- * would also be the base interface for a <tt>OneToManyActionParameter</tt>.
- *
- * <p>
- * Is also the route upto the {@link ObjectFeature} superinterface.
- *
- */
-public interface OneToManyFeature extends ObjectFeature {
-
-}
+/**
+ * Base interface for {@link OneToManyAssociation} only.
+ *
+ * <p>
+ * Introduced for symmetry with {@link OneToOneFeature}; if we ever support collections as parameters then would also be
+ * the base interface for a <tt>OneToManyActionParameter</tt>.
+ *
+ * <p>
+ * Is also the route upto the {@link ObjectFeature} superinterface.
+ *
+ */
+public interface OneToManyFeature extends ObjectFeature {
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneActionParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneActionParameter.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneActionParameter.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneActionParameter.java Tue Apr 26 18:24:05 2011
@@ -17,12 +17,11 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.spec.feature;
-package org.apache.isis.core.metamodel.spec.feature;
-
-/**
- * Modelled after {@link OneToOneAssociation} as a subinterface of {@link ObjectAssociation}.
- */
-public interface OneToOneActionParameter extends ObjectActionParameter, OneToOneFeature {
-
-}
+/**
+ * Modelled after {@link OneToOneAssociation} as a subinterface of {@link ObjectAssociation}.
+ */
+public interface OneToOneActionParameter extends ObjectActionParameter, OneToOneFeature {
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneAssociation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneAssociation.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneAssociation.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneAssociation.java Tue Apr 26 18:24:05 2011
@@ -17,9 +17,8 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.spec.feature;
-package org.apache.isis.core.metamodel.spec.feature;
-
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.consent.Consent;
@@ -28,65 +27,58 @@ import org.apache.isis.core.metamodel.in
import org.apache.isis.core.metamodel.interactions.InteractionContext;
import org.apache.isis.core.metamodel.interactions.PropertyAccessContext;
import org.apache.isis.core.metamodel.interactions.ValidityContext;
-
-
-/**
- * Provides reflective access to a field on a domain object that is used to reference another domain object.
- */
-public interface OneToOneAssociation extends ObjectAssociation, OneToOneFeature, MutableCurrentHolder {
-
- /**
- * Initialise this field in the specified object with the specified reference - this call should only
- * affect the specified object, and not any related objects. It should also not be distributed. This is
- * strictly for re-initialising the object and not specifying an association, which is only done once.
- */
- void initAssociation(ObjectAdapter inObject, ObjectAdapter associate);
-
- /**
- * Creates an {@link InteractionContext} that represents access to this property.
- */
- public PropertyAccessContext createAccessInteractionContext(
- AuthenticationSession session,
- InteractionInvocationMethod interactionMethod,
- ObjectAdapter targetObjectAdapter);
-
- /**
- * Creates an {@link InteractionContext} that represents validation of a proposed new value for the
- * property.
- *
- * <p>
- * Typically it is easier to just call {@link #isAssociationValid(ObjectAdapter, ObjectAdapter)} or
- * {@link #isAssociationValidResult(ObjectAdapter, ObjectAdapter)}; this is provided as API for symmetry with
- * interactions (such as {@link AccessContext} accesses) have no corresponding vetoing methods.
- */
- public ValidityContext<?> createValidateInteractionContext(
- AuthenticationSession session,
- InteractionInvocationMethod interactionMethod,
- ObjectAdapter targetObjectAdapter,
- ObjectAdapter proposedValue);
-
- /**
- * Determines if the specified reference is valid for setting this field in the specified object,
- * represented as a {@link Consent}.
- */
- Consent isAssociationValid(ObjectAdapter inObject, ObjectAdapter associate);
-
- /**
- * Set up the association represented by this field in the specified object with the specified reference -
- * this call sets up the logical state of the object and might affect other objects that share this
- * association (such as back-links or bidirectional association). To initialise a recreated object to this
- * logical state the <code>initAssociation</code> method should be used on each of the objects.
- *
- * @see #initAssociation(ObjectAdapter, ObjectAdapter)
- */
- void setAssociation(ObjectAdapter inObject, ObjectAdapter associate);
-
- /**
- * Clear this reference field (make it <code>null</code>) in the specified object, and remove any
- * association back-link.
- *
- * @see #setAssociation(ObjectAdapter, ObjectAdapter)
- */
- void clearAssociation(ObjectAdapter inObject);
-
-}
+
+/**
+ * Provides reflective access to a field on a domain object that is used to reference another domain object.
+ */
+public interface OneToOneAssociation extends ObjectAssociation, OneToOneFeature, MutableCurrentHolder {
+
+ /**
+ * Initialise this field in the specified object with the specified reference - this call should only affect the
+ * specified object, and not any related objects. It should also not be distributed. This is strictly for
+ * re-initialising the object and not specifying an association, which is only done once.
+ */
+ void initAssociation(ObjectAdapter inObject, ObjectAdapter associate);
+
+ /**
+ * Creates an {@link InteractionContext} that represents access to this property.
+ */
+ public PropertyAccessContext createAccessInteractionContext(AuthenticationSession session,
+ InteractionInvocationMethod interactionMethod, ObjectAdapter targetObjectAdapter);
+
+ /**
+ * Creates an {@link InteractionContext} that represents validation of a proposed new value for the property.
+ *
+ * <p>
+ * Typically it is easier to just call {@link #isAssociationValid(ObjectAdapter, ObjectAdapter)} or
+ * {@link #isAssociationValidResult(ObjectAdapter, ObjectAdapter)}; this is provided as API for symmetry with
+ * interactions (such as {@link AccessContext} accesses) have no corresponding vetoing methods.
+ */
+ public ValidityContext<?> createValidateInteractionContext(AuthenticationSession session,
+ InteractionInvocationMethod interactionMethod, ObjectAdapter targetObjectAdapter, ObjectAdapter proposedValue);
+
+ /**
+ * Determines if the specified reference is valid for setting this field in the specified object, represented as a
+ * {@link Consent}.
+ */
+ Consent isAssociationValid(ObjectAdapter inObject, ObjectAdapter associate);
+
+ /**
+ * Set up the association represented by this field in the specified object with the specified reference - this call
+ * sets up the logical state of the object and might affect other objects that share this association (such as
+ * back-links or bidirectional association). To initialise a recreated object to this logical state the
+ * <code>initAssociation</code> method should be used on each of the objects.
+ *
+ * @see #initAssociation(ObjectAdapter, ObjectAdapter)
+ */
+ void setAssociation(ObjectAdapter inObject, ObjectAdapter associate);
+
+ /**
+ * Clear this reference field (make it <code>null</code>) in the specified object, and remove any association
+ * back-link.
+ *
+ * @see #setAssociation(ObjectAdapter, ObjectAdapter)
+ */
+ void clearAssociation(ObjectAdapter inObject);
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneFeature.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneFeature.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneFeature.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/OneToOneFeature.java Tue Apr 26 18:24:05 2011
@@ -17,14 +17,12 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.spec.feature;
-package org.apache.isis.core.metamodel.spec.feature;
-
-
-/**
- * Common to {@link OneToOneAssociation} and {@link OneToOneActionParameter}.
- *
- */
-public interface OneToOneFeature extends ObjectFeature {
-
-}
+/**
+ * Common to {@link OneToOneAssociation} and {@link OneToOneActionParameter}.
+ *
+ */
+public interface OneToOneFeature extends ObjectFeature {
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ParseableEntryActionParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ParseableEntryActionParameter.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ParseableEntryActionParameter.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ParseableEntryActionParameter.java Tue Apr 26 18:24:05 2011
@@ -17,12 +17,11 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.spec.feature;
-package org.apache.isis.core.metamodel.spec.feature;
-
-/**
- * Equivalent to {@link ObjectAssociation}, but for parameter rather than properties.
- */
-public interface ParseableEntryActionParameter extends OneToOneActionParameter, ParseableEntryFeature {
-
-}
+/**
+ * Equivalent to {@link ObjectAssociation}, but for parameter rather than properties.
+ */
+public interface ParseableEntryActionParameter extends OneToOneActionParameter, ParseableEntryFeature {
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ParseableEntryFeature.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ParseableEntryFeature.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ParseableEntryFeature.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ParseableEntryFeature.java Tue Apr 26 18:24:05 2011
@@ -17,30 +17,28 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.spec.feature;
-package org.apache.isis.core.metamodel.spec.feature;
-
-
-public interface ParseableEntryFeature extends OneToOneFeature {
-
- /**
- * The typical length of each line for this value, as a number of characters.
- */
- int getTypicalLineLength();
-
- /**
- * Returns the maximum number of characters for a value of this type.
- */
- int getMaximumLength();
-
- /**
- * Returns the number of lines for a multi-line value.
- */
- int getNoLines();
-
- /**
- * Determines if a multi-line value can be wrapped when displayed.
- */
- boolean canWrap();
-
-}
+public interface ParseableEntryFeature extends OneToOneFeature {
+
+ /**
+ * The typical length of each line for this value, as a number of characters.
+ */
+ int getTypicalLineLength();
+
+ /**
+ * Returns the maximum number of characters for a value of this type.
+ */
+ int getMaximumLength();
+
+ /**
+ * Returns the number of lines for a multi-line value.
+ */
+ int getNoLines();
+
+ /**
+ * Determines if a multi-line value can be wrapped when displayed.
+ */
+ boolean canWrap();
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/FacetDecoratorInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/FacetDecoratorInstaller.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/FacetDecoratorInstaller.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/FacetDecoratorInstaller.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.core.metamodel.specloader;
import java.util.List;
@@ -25,12 +24,9 @@ import java.util.List;
import org.apache.isis.core.commons.components.Installer;
import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
-
-
public interface FacetDecoratorInstaller extends Installer {
- static String TYPE = "facet-decorator";
+ static String TYPE = "facet-decorator";
List<FacetDecorator> createDecorators();
}
-
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflector.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflector.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflector.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflector.java Tue Apr 26 18:24:05 2011
@@ -17,14 +17,12 @@
* under the License.
*/
-
package org.apache.isis.core.metamodel.specloader;
import org.apache.isis.core.commons.components.ApplicationScopedComponent;
import org.apache.isis.core.metamodel.runtimecontext.RuntimeContextAware;
import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-public interface ObjectReflector extends SpecificationLoader,
- ApplicationScopedComponent, RuntimeContextAware {
+public interface ObjectReflector extends SpecificationLoader, ApplicationScopedComponent, RuntimeContextAware {
}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorDefault.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorDefault.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorDefault.java Tue Apr 26 18:24:05 2011
@@ -17,9 +17,8 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.specloader;
-package org.apache.isis.core.metamodel.specloader;
-
import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
@@ -30,10 +29,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
-import org.apache.log4j.Logger;
-
-import com.google.common.collect.Lists;
-
import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.commons.debug.DebugBuilder;
@@ -72,53 +67,47 @@ import org.apache.isis.core.metamodel.sp
import org.apache.isis.core.metamodel.specloader.specimpl.CreateObjectContext;
import org.apache.isis.core.metamodel.specloader.specimpl.FacetedMethodsBuilderContext;
import org.apache.isis.core.metamodel.specloader.specimpl.IntrospectionContext;
-import org.apache.isis.core.metamodel.specloader.specimpl.ObjectSpecificationAbstract;
import org.apache.isis.core.metamodel.specloader.specimpl.dflt.ObjectSpecificationDefault;
import org.apache.isis.core.metamodel.specloader.specimpl.objectlist.ObjectSpecificationForObjectList;
import org.apache.isis.core.metamodel.specloader.traverser.SpecificationTraverser;
import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
-
+import org.apache.log4j.Logger;
+
+import com.google.common.collect.Lists;
+
/**
* Builds the meta-model.
*
* <p>
* The implementation provides for a degree of pluggability:
* <ul>
- * <li>The most important plug-in point is {@link ProgrammingModel} that
- * specifies the set of {@link Facet} that make up programming model. If not
- * specified then defaults to {@link ProgrammingModelFacetsJava5} (which should
- * be used as a starting point for your own customizations).
- * <li>The only mandatory plug-in point is {@link ClassSubstitutor}, which
- * allows the class to be loaded to be substituted if required. This is used in
- * conjunction with some <tt>PersistenceMechanism</tt>s that do class
+ * <li>The most important plug-in point is {@link ProgrammingModel} that specifies the set of {@link Facet} that make up
+ * programming model. If not specified then defaults to {@link ProgrammingModelFacetsJava5} (which should be used as a
+ * starting point for your own customizations).
+ * <li>The only mandatory plug-in point is {@link ClassSubstitutor}, which allows the class to be loaded to be
+ * substituted if required. This is used in conjunction with some <tt>PersistenceMechanism</tt>s that do class
* enhancement.
- * <li>The {@link CollectionTypeRegistry} specifies the types that should be
- * considered as collections. If not specified then will
- * {@link CollectionTypeRegistryDefault default}. (Note: this extension point
- * has not been tested, so should be considered more of a "statement of
- * intent" than actual API. Also, we may use annotations (similar to the
+ * <li>The {@link CollectionTypeRegistry} specifies the types that should be considered as collections. If not specified
+ * then will {@link CollectionTypeRegistryDefault default}. (Note: this extension point has not been tested, so should
+ * be considered more of a "statement of intent" than actual API. Also, we may use annotations (similar to the
* way in which Values are specified) as an alternative mechanism).
* </ul>
*
* <p>
- * In addition, the {@link RuntimeContext} can optionally be injected, but will
- * default to {@link RuntimeContextNoRuntime} if not provided prior to
- * {@link #init() initialization}. The purpose of {@link RuntimeContext} is to
- * allow the metamodel to be used standalone, for example in a Maven plugin. The
- * {@link RuntimeContextNoRuntime} implementation will through an exception for
- * any methods (such as finding an {@link ObjectAdapter adapter}) because there is
- * no runtime session. In the case of the metamodel being used by the framework
- * (that is, when there <i>is</i> a runtime), then the framework injects an
- * implementation of {@link RuntimeContext} that acts like a bridge to its
- * <tt>IsisContext</tt>.
+ * In addition, the {@link RuntimeContext} can optionally be injected, but will default to
+ * {@link RuntimeContextNoRuntime} if not provided prior to {@link #init() initialization}. The purpose of
+ * {@link RuntimeContext} is to allow the metamodel to be used standalone, for example in a Maven plugin. The
+ * {@link RuntimeContextNoRuntime} implementation will through an exception for any methods (such as finding an
+ * {@link ObjectAdapter adapter}) because there is no runtime session. In the case of the metamodel being used by the
+ * framework (that is, when there <i>is</i> a runtime), then the framework injects an implementation of
+ * {@link RuntimeContext} that acts like a bridge to its <tt>IsisContext</tt>.
*/
-
-public class ObjectReflectorDefault implements ObjectReflector, DebuggableWithTitle {
- private final static Logger LOG = Logger.getLogger(ObjectReflectorDefault.class);
-
+public class ObjectReflectorDefault implements ObjectReflector, DebuggableWithTitle {
- /**
+ private final static Logger LOG = Logger.getLogger(ObjectReflectorDefault.class);
+
+ /**
* Injected in the constructor.
*/
private final IsisConfiguration configuration;
@@ -141,24 +130,20 @@ public class ObjectReflectorDefault impl
private final FacetProcessor facetProcessor;
/**
- * Defaulted in the constructor, so can be added to via
- * {@link #setFacetDecorators(FacetDecoratorSet)} or
+ * Defaulted in the constructor, so can be added to via {@link #setFacetDecorators(FacetDecoratorSet)} or
* {@link #addFacetDecorator(FacetDecorator)}.
*
* <p>
- * {@link FacetDecorator}s must be added prior to {@link #init()
- * initialization.}
+ * {@link FacetDecorator}s must be added prior to {@link #init() initialization.}
*/
private final FacetDecoratorSet facetDecoratorSet;
/**
- * Can optionally be injected, but will default (to
- * {@link RuntimeContextNoRuntime}) otherwise.
+ * Can optionally be injected, but will default (to {@link RuntimeContextNoRuntime}) otherwise.
*
* <p>
- * Should be injected when used by framework, but will default to a no-op
- * implementation if the metamodel is being used standalone (eg for a
- * code-generator).
+ * Should be injected when used by framework, but will default to a no-op implementation if the metamodel is being
+ * used standalone (eg for a code-generator).
*/
private RuntimeContext runtimeContext;
@@ -170,28 +155,22 @@ public class ObjectReflectorDefault impl
*/
private List<Class<?>> serviceClasses = Lists.newArrayList();
- private MetaModelValidator metaModelValidator;
+ private final MetaModelValidator metaModelValidator;
/**
* Defaulted in the constructor.
*/
private final SpecificationCache cache;
-
// /////////////////////////////////////////////////////////////
// Constructor
// /////////////////////////////////////////////////////////////
- public ObjectReflectorDefault(
- final IsisConfiguration configuration,
- final ClassSubstitutor classSubstitutor,
- final CollectionTypeRegistry collectionTypeRegistry,
- final SpecificationTraverser specificationTraverser,
- final MemberLayoutArranger memberLayoutArranger,
- final ProgrammingModel programmingModel,
- final Set<FacetDecorator> facetDecorators,
- final MetaModelValidator metaModelValidator) {
-
+ public ObjectReflectorDefault(final IsisConfiguration configuration, final ClassSubstitutor classSubstitutor,
+ final CollectionTypeRegistry collectionTypeRegistry, final SpecificationTraverser specificationTraverser,
+ final MemberLayoutArranger memberLayoutArranger, final ProgrammingModel programmingModel,
+ final Set<FacetDecorator> facetDecorators, final MetaModelValidator metaModelValidator) {
+
ensureThatArg(configuration, is(notNullValue()));
ensureThatArg(classSubstitutor, is(notNullValue()));
ensureThatArg(collectionTypeRegistry, is(notNullValue()));
@@ -207,17 +186,16 @@ public class ObjectReflectorDefault impl
this.programmingModel = programmingModel;
this.specificationTraverser = specificationTraverser;
this.memberLayoutArranger = memberLayoutArranger;
-
+
this.facetDecoratorSet = new FacetDecoratorSet();
for (final FacetDecorator facetDecorator : facetDecorators) {
this.facetDecoratorSet.add(facetDecorator);
}
this.metaModelValidator = metaModelValidator;
-
- this.facetProcessor = new FacetProcessor(configuration, collectionTypeRegistry,
- programmingModel);
-
+
+ this.facetProcessor = new FacetProcessor(configuration, collectionTypeRegistry, programmingModel);
+
this.cache = new SpecificationCacheDefault();
}
@@ -232,8 +210,8 @@ public class ObjectReflectorDefault impl
// /////////////////////////////////////////////////////////////
/**
- * Initializes and wires up, and primes the cache based on
- * any service classes that may have been {@link #setServiceClasses(List) injected}.
+ * Initializes and wires up, and primes the cache based on any service classes that may have been
+ * {@link #setServiceClasses(List) injected}.
*/
@Override
public void init() {
@@ -261,18 +239,18 @@ public class ObjectReflectorDefault impl
facetProcessor.init();
programmingModel.init();
metaModelValidator.init();
-
+
// prime cache and validate
primeCache();
metaModelValidator.validate();
}
/**
- * load the service specifications and then, using the {@link #getSpecificationTraverser() traverser},
- * keep loading all referenced specifications until we can find no more.
+ * load the service specifications and then, using the {@link #getSpecificationTraverser() traverser}, keep loading
+ * all referenced specifications until we can find no more.
*/
private void primeCache() {
- for (Class<?> serviceClass : serviceClasses) {
+ for (final Class<?> serviceClass : serviceClasses) {
internalLoadSpecification(serviceClass);
}
loadAllSpecifications();
@@ -280,9 +258,9 @@ public class ObjectReflectorDefault impl
private void loadAllSpecifications() {
List<Class<?>> newlyDiscoveredClasses = newlyDiscoveredClasses();
-
- while(newlyDiscoveredClasses.size() > 0) {
- for(Class<?> newClass: newlyDiscoveredClasses) {
+
+ while (newlyDiscoveredClasses.size() > 0) {
+ for (final Class<?> newClass : newlyDiscoveredClasses) {
internalLoadSpecification(newClass);
}
newlyDiscoveredClasses = newlyDiscoveredClasses();
@@ -290,21 +268,19 @@ public class ObjectReflectorDefault impl
}
private List<Class<?>> newlyDiscoveredClasses() {
- List<Class<?>> newlyDiscoveredClasses = new ArrayList<Class<?>>();
-
- Collection<ObjectSpecification> noSpecs = allSpecifications();
+ final List<Class<?>> newlyDiscoveredClasses = new ArrayList<Class<?>>();
+
+ final Collection<ObjectSpecification> noSpecs = allSpecifications();
try {
- for(ObjectSpecification noSpec: noSpecs) {
+ for (final ObjectSpecification noSpec : noSpecs) {
getSpecificationTraverser().traverseReferencedClasses(noSpec, newlyDiscoveredClasses);
}
- } catch (ClassNotFoundException ex) {
+ } catch (final ClassNotFoundException ex) {
throw new IsisException(ex);
}
return newlyDiscoveredClasses;
}
-
-
@Override
public void shutdown() {
LOG.info("shutting down " + this);
@@ -320,10 +296,8 @@ public class ObjectReflectorDefault impl
* API: Return the specification for the specified class of object.
*/
@Override
- public final ObjectSpecification loadSpecification(
- final String className) {
- ensureThatArg(className, is(notNullValue()),
- "specification class name must be specified");
+ public final ObjectSpecification loadSpecification(final String className) {
+ ensureThatArg(className, is(notNullValue()), "specification class name must be specified");
try {
final Class<?> cls = loadBuiltIn(className);
@@ -331,8 +305,7 @@ public class ObjectReflectorDefault impl
} catch (final ClassNotFoundException e) {
final ObjectSpecification spec = getCache().get(className);
if (spec == null) {
- throw new IsisException(
- "No such class available: " + className);
+ throw new IsisException("No such class available: " + className);
}
return spec;
}
@@ -347,105 +320,96 @@ public class ObjectReflectorDefault impl
}
private ObjectSpecification internalLoadSpecification(final Class<?> type) {
- Class<?> substitutedType = getClassSubstitutor().getClass(type);
- return substitutedType != null ? loadSpecificationForSubstitutedClass(substitutedType)
- : null;
+ final Class<?> substitutedType = getClassSubstitutor().getClass(type);
+ return substitutedType != null ? loadSpecificationForSubstitutedClass(substitutedType) : null;
}
- private ObjectSpecification loadSpecificationForSubstitutedClass(
- final Class<?> type) {
+ private ObjectSpecification loadSpecificationForSubstitutedClass(final Class<?> type) {
Assert.assertNotNull(type);
- String typeName = type.getName();
-
- SpecificationCache specificationCache = getCache();
+ final String typeName = type.getName();
+
+ final SpecificationCache specificationCache = getCache();
synchronized (specificationCache) {
final ObjectSpecification spec = specificationCache.get(typeName);
if (spec != null) {
return spec;
}
- ObjectSpecification specification = createSpecification(type);
+ final ObjectSpecification specification = createSpecification(type);
if (specification == null) {
- throw new IsisException(
- "Failed to create specification for class "
- + typeName);
+ throw new IsisException("Failed to create specification for class " + typeName);
}
// put into the cache prior to introspecting, to prevent
// infinite loops
specificationCache.cache(typeName, specification);
-
+
introspectSpecificationIfRequired(specification);
return specification;
}
}
-
/**
- * Loads the specifications of the specified types except the one specified
- * (to prevent an infinite loop).
+ * Loads the specifications of the specified types except the one specified (to prevent an infinite loop).
*/
@Override
- public boolean loadSpecifications(List<Class<?>> typesToLoad,
- final Class<?> typeToIgnore) {
+ public boolean loadSpecifications(final List<Class<?>> typesToLoad, final Class<?> typeToIgnore) {
boolean anyLoadedAsNull = false;
- for (Class<?> typeToLoad: typesToLoad) {
+ for (final Class<?> typeToLoad : typesToLoad) {
if (typeToLoad != typeToIgnore) {
- ObjectSpecification noSpec = internalLoadSpecification(typeToLoad);
- boolean loadedAsNull = (noSpec == null);
+ final ObjectSpecification noSpec = internalLoadSpecification(typeToLoad);
+ final boolean loadedAsNull = (noSpec == null);
anyLoadedAsNull = loadedAsNull || anyLoadedAsNull;
}
}
return anyLoadedAsNull;
}
-
+
/**
* Loads the specifications of the specified types.
*/
@Override
- public boolean loadSpecifications(List<Class<?>> typesToLoad) {
+ public boolean loadSpecifications(final List<Class<?>> typesToLoad) {
return loadSpecifications(typesToLoad, null);
}
-
/**
* Creates the appropriate type of {@link ObjectSpecification}.
*/
private ObjectSpecification createSpecification(final Class<?> cls) {
- final AuthenticationSessionProvider authenticationSessionProvider = getRuntimeContext().getAuthenticationSessionProvider();
+ final AuthenticationSessionProvider authenticationSessionProvider =
+ getRuntimeContext().getAuthenticationSessionProvider();
final SpecificationLookup specificationLookup = getRuntimeContext().getSpecificationLookup();
final ServicesProvider servicesProvider = getRuntimeContext().getServicesProvider();
final ObjectInstantiator objectInstantiator = getRuntimeContext().getObjectInstantiator();
-
- final SpecificationContext specContext = new SpecificationContext(authenticationSessionProvider, servicesProvider, objectInstantiator, specificationLookup);
-
+
+ final SpecificationContext specContext =
+ new SpecificationContext(authenticationSessionProvider, servicesProvider, objectInstantiator,
+ specificationLookup);
+
if (ObjectList.class.isAssignableFrom(cls)) {
return new ObjectSpecificationForObjectList(specContext);
} else {
- SpecificationLoader specificationLoader = this;
+ final SpecificationLoader specificationLoader = this;
final AdapterMap adapterMap = getRuntimeContext().getAdapterMap();
- final ObjectMemberContext objectMemberContext = new ObjectMemberContext(authenticationSessionProvider, specificationLookup, adapterMap, getRuntimeContext().getQuerySubmitter());
- final IntrospectionContext introspectionContext = new IntrospectionContext(getClassSubstitutor(), getMemberLayoutArranger());
+ final ObjectMemberContext objectMemberContext =
+ new ObjectMemberContext(authenticationSessionProvider, specificationLookup, adapterMap,
+ getRuntimeContext().getQuerySubmitter());
+ final IntrospectionContext introspectionContext =
+ new IntrospectionContext(getClassSubstitutor(), getMemberLayoutArranger());
final DependencyInjector dependencyInjector = getRuntimeContext().getDependencyInjector();
final CreateObjectContext createObjectContext = new CreateObjectContext(adapterMap, dependencyInjector);
- final FacetedMethodsBuilderContext facetedMethodsBuilderContext =
- new FacetedMethodsBuilderContext(specificationLoader , classSubstitutor, specificationTraverser, facetProcessor);
- return new ObjectSpecificationDefault(cls,
- facetedMethodsBuilderContext,
- introspectionContext,
- specContext,
- objectMemberContext,
- createObjectContext);
+ final FacetedMethodsBuilderContext facetedMethodsBuilderContext =
+ new FacetedMethodsBuilderContext(specificationLoader, classSubstitutor, specificationTraverser,
+ facetProcessor);
+ return new ObjectSpecificationDefault(cls, facetedMethodsBuilderContext, introspectionContext, specContext,
+ objectMemberContext, createObjectContext);
}
}
-
-
-
- private Class<?> loadBuiltIn(final String className)
- throws ClassNotFoundException {
- Class<?> builtIn = JavaClassUtils.getBuiltIn(className);
+ private Class<?> loadBuiltIn(final String className) throws ClassNotFoundException {
+ final Class<?> builtIn = JavaClassUtils.getBuiltIn(className);
if (builtIn != null) {
return builtIn;
}
@@ -461,51 +425,46 @@ public class ObjectReflectorDefault impl
}
@Override
- public boolean loaded(Class<?> cls) {
+ public boolean loaded(final Class<?> cls) {
return loaded(cls.getName());
}
@Override
- public boolean loaded(String fullyQualifiedClassName) {
+ public boolean loaded(final String fullyQualifiedClassName) {
return getCache().get(fullyQualifiedClassName) != null;
}
-
- private ObjectSpecification introspectSpecificationIfRequired(ObjectSpecification spec) {
- if(!spec.isIntrospected()) {
+ private ObjectSpecification introspectSpecificationIfRequired(final ObjectSpecification spec) {
+ if (!spec.isIntrospected()) {
spec.introspectTypeHierarchyAndMembers();
facetDecoratorSet.decorate(spec);
spec.updateFromFacetValues();
}
- return spec;
+ return spec;
}
-
// ////////////////////////////////////////////////////////////////////
// injectInto
// ////////////////////////////////////////////////////////////////////
/**
- * Injects self into candidate if required, and instructs its subcomponents
- * to do so also.
+ * Injects self into candidate if required, and instructs its subcomponents to do so also.
*/
@Override
- public void injectInto(Object candidate) {
- Class<?> candidateClass = candidate.getClass();
+ public void injectInto(final Object candidate) {
+ final Class<?> candidateClass = candidate.getClass();
if (SpecificationLoaderAware.class.isAssignableFrom(candidateClass)) {
- SpecificationLoaderAware cast = SpecificationLoaderAware.class
- .cast(candidate);
+ final SpecificationLoaderAware cast = SpecificationLoaderAware.class.cast(candidate);
cast.setSpecificationLoader(this);
}
if (SpecificationLookupAware.class.isAssignableFrom(candidateClass)) {
- SpecificationLookupAware cast = SpecificationLookupAware.class
- .cast(candidate);
+ final SpecificationLookupAware cast = SpecificationLookupAware.class.cast(candidate);
cast.setSpecificationLookup(this);
}
getClassSubstitutor().injectInto(candidate);
getCollectionTypeRegistry().injectInto(candidate);
-
+
}
// /////////////////////////////////////////////////////////////
@@ -520,11 +479,10 @@ public class ObjectReflectorDefault impl
str.appendTitle("Specifications");
final List<ObjectSpecification> specs = Lists.newArrayList(allSpecifications());
Collections.sort(specs, ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE);
- for (ObjectSpecification spec : specs) {
+ for (final ObjectSpecification spec : specs) {
str.append(spec.isAbstract() ? "A" : ".");
str.append(spec.isService() ? "S" : ".");
- str.append(BoundedFacetUtils.isBoundedSet(spec) ? "B"
- : ".");
+ str.append(BoundedFacetUtils.isBoundedSet(spec) ? "B" : ".");
str.append(spec.isCollection() ? "C" : ".");
str.append(spec.isNotCollection() ? "O" : ".");
str.append("."); // placeholder for future support of maps
@@ -562,7 +520,6 @@ public class ObjectReflectorDefault impl
return cache;
}
-
// ////////////////////////////////////////////////////////////////////
// Dependencies (injected by setter due to *Aware)
// ////////////////////////////////////////////////////////////////////
@@ -578,7 +535,7 @@ public class ObjectReflectorDefault impl
* Due to {@link RuntimeContextAware}.
*/
@Override
- public void setRuntimeContext(RuntimeContext runtimeContext) {
+ public void setRuntimeContext(final RuntimeContext runtimeContext) {
this.runtimeContext = runtimeContext;
}
@@ -589,14 +546,12 @@ public class ObjectReflectorDefault impl
public List<Class<?>> getServiceClasses() {
return Collections.unmodifiableList(serviceClasses);
}
-
+
@Override
- public void setServiceClasses(List<Class<?>> serviceClasses) {
+ public void setServiceClasses(final List<Class<?>> serviceClasses) {
this.serviceClasses = serviceClasses;
}
-
-
// ////////////////////////////////////////////////////////////////////
// Dependencies (injected from constructor)
// ////////////////////////////////////////////////////////////////////
@@ -608,7 +563,7 @@ public class ObjectReflectorDefault impl
protected CollectionTypeRegistry getCollectionTypeRegistry() {
return collectionTypeRegistry;
}
-
+
protected ClassSubstitutor getClassSubstitutor() {
return classSubstitutor;
}
@@ -616,11 +571,11 @@ public class ObjectReflectorDefault impl
protected SpecificationTraverser getSpecificationTraverser() {
return specificationTraverser;
}
-
+
protected ProgrammingModel getProgrammingModelFacets() {
return programmingModel;
}
-
+
protected MemberLayoutArranger getMemberLayoutArranger() {
return memberLayoutArranger;
}
@@ -632,5 +587,5 @@ public class ObjectReflectorDefault impl
protected Set<FacetDecorator> getFacetDecoratorSet() {
return facetDecoratorSet.getFacetDecorators();
}
-
-}
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java Tue Apr 26 18:24:05 2011
@@ -17,22 +17,19 @@
* under the License.
*/
-
package org.apache.isis.core.metamodel.specloader;
import org.apache.isis.core.commons.components.Installer;
-
/**
* Installs a {@link ObjectReflector}during system start up.
*/
public interface ObjectReflectorInstaller extends Installer {
- static String TYPE = "reflector";
+ static String TYPE = "reflector";
ObjectReflector createReflector();
-
- void addFacetDecoratorInstaller(final FacetDecoratorInstaller decoratorInstaller);
+ void addFacetDecoratorInstaller(final FacetDecoratorInstaller decoratorInstaller);
}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectiveActionException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectiveActionException.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectiveActionException.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectiveActionException.java Tue Apr 26 18:24:05 2011
@@ -17,12 +17,10 @@
* under the License.
*/
-
package org.apache.isis.core.metamodel.specloader;
import org.apache.isis.core.commons.exceptions.IsisException;
-
public class ReflectiveActionException extends IsisException {
private static final long serialVersionUID = 1L;
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java Tue Apr 26 18:24:05 2011
@@ -45,15 +45,16 @@ public final class ReflectorConstants {
* Key used to lookup implementation of {@link MetaModelValidator} in {@link IsisConfiguration}.
*/
public static final String META_MODEL_VALIDATOR_CLASS_NAME = ConfigurationConstants.ROOT + "reflector.validator";
- public static final String META_MODEL_VALIDATOR_CLASS_NAME_DEFAULT = "org.apache.isis.core.progmodel.metamodelvalidator.dflt.MetaModelValidatorDefault";
-
+ public static final String META_MODEL_VALIDATOR_CLASS_NAME_DEFAULT =
+ "org.apache.isis.core.progmodel.metamodelvalidator.dflt.MetaModelValidatorDefault";
/**
* Key used to lookup implementation of {@link MemberLayoutArrangerDefault} in {@link IsisConfiguration}.
*/
- public static final String MEMBER_LAYOUT_ARRANGER_CLASS_NAME = ConfigurationConstants.ROOT + "reflector.memberlayoutarranger";
- public static final String MEMBER_LAYOUT_ARRANGER_CLASS_NAME_DEFAULT = "org.apache.isis.core.progmodel.layout.dflt.MemberLayoutArrangerDefault";
-
+ public static final String MEMBER_LAYOUT_ARRANGER_CLASS_NAME = ConfigurationConstants.ROOT
+ + "reflector.memberlayoutarranger";
+ public static final String MEMBER_LAYOUT_ARRANGER_CLASS_NAME_DEFAULT =
+ "org.apache.isis.core.progmodel.layout.dflt.MemberLayoutArrangerDefault";
/**
* Key used to lookup implementation of {@link ClassSubstitutor} in {@link IsisConfiguration}.
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutor.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutor.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutor.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutor.java Tue Apr 26 18:24:05 2011
@@ -17,24 +17,20 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.specloader.classsubstitutor;
-package org.apache.isis.core.metamodel.specloader.classsubstitutor;
-
import org.apache.isis.core.commons.components.ApplicationScopedComponent;
import org.apache.isis.core.commons.components.Injectable;
-
-/**
- * Provides capability to translate or ignore classes.
- *
- * <p>
- * The class strategy is typically required when either an underlying object store
- * (such as Hibernate); it then allows the enhancement artifacts can be ignored or
- * interpreted correctly.
- */
-public interface ClassSubstitutor extends Injectable, ApplicationScopedComponent {
-
- Class<?> getClass(Class<?> cls);
-
-}
-
-
+
+/**
+ * Provides capability to translate or ignore classes.
+ *
+ * <p>
+ * The class strategy is typically required when either an underlying object store (such as Hibernate); it then allows
+ * the enhancement artifacts can be ignored or interpreted correctly.
+ */
+public interface ClassSubstitutor extends Injectable, ApplicationScopedComponent {
+
+ Class<?> getClass(Class<?> cls);
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,99 +17,94 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.specloader.classsubstitutor;
-package org.apache.isis.core.metamodel.specloader.classsubstitutor;
-
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.apache.isis.applib.DomainObjectContainer;
-
-
-
-public abstract class ClassSubstitutorAbstract implements ClassSubstitutor {
-
- private final Set<Class<?>> classesToIgnore = new HashSet<Class<?>>();
-
-
- /**
- * Will implicitly ignore the {@link DomainObjectContainer}.
- */
- public ClassSubstitutorAbstract() {
- ignore(DomainObjectContainer.class);
- }
-
-
- ///////////////////////////////////////////////////////////////////
- // init, shutdown
- ///////////////////////////////////////////////////////////////////
-
- /**
- * Default implementation does nothing.
- */
- public void init() {}
-
- /**
- * Default implementation does nothing.
- */
- public void shutdown() {}
-
-
- ///////////////////////////////////////////////////////////////////
- // ClassSubstitutor impl.
- ///////////////////////////////////////////////////////////////////
-
-
- /**
- * Hook method for subclasses to override if required.
- *
- * <p>
- * Default implementation will either return the class, unless
- * has been registered as to be {@link #ignore(Class) ignore}d, in
- * which case returns <tt>null</tt>.
- */
- public Class<?> getClass(final Class<?> cls) {
- if (shouldIgnore(cls)) {
- return null;
- }
- return cls;
- }
-
-
- private boolean shouldIgnore(Class<?> cls) {
- if (cls.isArray()) {
- return shouldIgnore(cls.getComponentType());
- }
- return classesToIgnore.contains(cls);
- }
-
- // ////////////////////////////////////////////////////////////////////
- // ignoring
- // ////////////////////////////////////////////////////////////////////
-
- /**
- * For any classes registered as ignored, {@link #getClass(Class)}
- * will return <tt>null</tt>.
- */
- protected boolean ignore(Class<?> q) {
- return classesToIgnore.add(q);
- }
-
- public Set<Class<?>> getIgnoredClasses() {
- return Collections.unmodifiableSet(classesToIgnore);
- }
-
- // ////////////////////////////////////////////////////////////////////
- // injectInto
- // ////////////////////////////////////////////////////////////////////
-
- public void injectInto(Object candidate) {
- if (ClassSubstitutorAware.class.isAssignableFrom(candidate.getClass())) {
- ClassSubstitutorAware cast = ClassSubstitutorAware.class.cast(candidate);
- cast.setClassInstrumentor(this);
- }
- }
-
-
-}
+
+public abstract class ClassSubstitutorAbstract implements ClassSubstitutor {
+
+ private final Set<Class<?>> classesToIgnore = new HashSet<Class<?>>();
+
+ /**
+ * Will implicitly ignore the {@link DomainObjectContainer}.
+ */
+ public ClassSubstitutorAbstract() {
+ ignore(DomainObjectContainer.class);
+ }
+
+ // /////////////////////////////////////////////////////////////////
+ // init, shutdown
+ // /////////////////////////////////////////////////////////////////
+
+ /**
+ * Default implementation does nothing.
+ */
+ @Override
+ public void init() {
+ }
+
+ /**
+ * Default implementation does nothing.
+ */
+ @Override
+ public void shutdown() {
+ }
+
+ // /////////////////////////////////////////////////////////////////
+ // ClassSubstitutor impl.
+ // /////////////////////////////////////////////////////////////////
+
+ /**
+ * Hook method for subclasses to override if required.
+ *
+ * <p>
+ * Default implementation will either return the class, unless has been registered as to be {@link #ignore(Class)
+ * ignore}d, in which case returns <tt>null</tt>.
+ */
+ @Override
+ public Class<?> getClass(final Class<?> cls) {
+ if (shouldIgnore(cls)) {
+ return null;
+ }
+ return cls;
+ }
+
+ private boolean shouldIgnore(final Class<?> cls) {
+ if (cls.isArray()) {
+ return shouldIgnore(cls.getComponentType());
+ }
+ return classesToIgnore.contains(cls);
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ // ignoring
+ // ////////////////////////////////////////////////////////////////////
+
+ /**
+ * For any classes registered as ignored, {@link #getClass(Class)} will return <tt>null</tt>.
+ */
+ protected boolean ignore(final Class<?> q) {
+ return classesToIgnore.add(q);
+ }
+
+ public Set<Class<?>> getIgnoredClasses() {
+ return Collections.unmodifiableSet(classesToIgnore);
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ // injectInto
+ // ////////////////////////////////////////////////////////////////////
+
+ @Override
+ public void injectInto(final Object candidate) {
+ if (ClassSubstitutorAware.class.isAssignableFrom(candidate.getClass())) {
+ final ClassSubstitutorAware cast = ClassSubstitutorAware.class.cast(candidate);
+ cast.setClassInstrumentor(this);
+ }
+ }
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAware.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAware.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAware.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAware.java Tue Apr 26 18:24:05 2011
@@ -17,12 +17,9 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.specloader.classsubstitutor;
-package org.apache.isis.core.metamodel.specloader.classsubstitutor;
-
-public interface ClassSubstitutorAware {
-
- public void setClassInstrumentor(ClassSubstitutor classStrategy);
-}
-
-
+public interface ClassSubstitutorAware {
+
+ public void setClassInstrumentor(ClassSubstitutor classStrategy);
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorComposite.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorComposite.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorComposite.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorComposite.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.core.metamodel.specloader.classsubstitutor;
import java.util.Arrays;
@@ -27,49 +26,49 @@ import com.google.common.collect.Lists;
public class ClassSubstitutorComposite implements ClassSubstitutor {
- private List<ClassSubstitutor> substitutors = Lists.newArrayList();
+ private final List<ClassSubstitutor> substitutors = Lists.newArrayList();
+
+ public ClassSubstitutorComposite(final List<ClassSubstitutor> substitutors) {
+ this.substitutors.addAll(substitutors);
+ }
+
+ public ClassSubstitutorComposite(final ClassSubstitutor... substitutors) {
+ this(Arrays.asList(substitutors));
+ }
+
+ @Override
+ public void init() {
+ for (final ClassSubstitutor classSubstitutor : substitutors) {
+ classSubstitutor.init();
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ for (final ClassSubstitutor classSubstitutor : substitutors) {
+ classSubstitutor.shutdown();
+ }
+ }
- public ClassSubstitutorComposite(List<ClassSubstitutor> substitutors) {
- this.substitutors.addAll(substitutors);
- }
-
- public ClassSubstitutorComposite(ClassSubstitutor... substitutors) {
- this(Arrays.asList(substitutors));
- }
-
- @Override
- public void init() {
- for (ClassSubstitutor classSubstitutor : substitutors) {
- classSubstitutor.init();
- }
- }
-
- @Override
- public void shutdown() {
- for (ClassSubstitutor classSubstitutor : substitutors) {
- classSubstitutor.shutdown();
- }
- }
-
- @Override
- public Class<?> getClass(Class<?> cls) {
- Class<?> clsBefore;
- do {
- clsBefore = cls;
- for (ClassSubstitutor substitutor : substitutors) {
- cls = substitutor.getClass(cls);
- if (cls == null) {
- return null;
- }
- }
- } while (clsBefore != cls);
- return cls;
- }
+ @Override
+ public Class<?> getClass(Class<?> cls) {
+ Class<?> clsBefore;
+ do {
+ clsBefore = cls;
+ for (final ClassSubstitutor substitutor : substitutors) {
+ cls = substitutor.getClass(cls);
+ if (cls == null) {
+ return null;
+ }
+ }
+ } while (clsBefore != cls);
+ return cls;
+ }
- @Override
- public void injectInto(Object candidate) {
+ @Override
+ public void injectInto(final Object candidate) {
if (ClassSubstitutorAware.class.isAssignableFrom(candidate.getClass())) {
- ClassSubstitutorAware cast = ClassSubstitutorAware.class.cast(candidate);
+ final ClassSubstitutorAware cast = ClassSubstitutorAware.class.cast(candidate);
cast.setClassInstrumentor(this);
}
}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistry.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistry.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistry.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistry.java Tue Apr 26 18:24:05 2011
@@ -17,28 +17,26 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.specloader.collectiontyperegistry;
-package org.apache.isis.core.metamodel.specloader.collectiontyperegistry;
-
import org.apache.isis.core.commons.components.ApplicationScopedComponent;
import org.apache.isis.core.commons.components.Injectable;
-
-/**
- * TODO: plan is to allow new collection types to be installed dynamically, allowing the domain programmer to
- * declare custom classes to have collection semantics.
- *
- * <p>
- * In this way there are similarities with the way in which value types are specified using <tt>@Value</tt>.
- * However, we need to maintain a repository of these collection types once nominated so that when we
- * introspect classes we look for collections first, and then properties second.
- */
-public interface CollectionTypeRegistry extends Injectable, ApplicationScopedComponent {
-
- public boolean isCollectionType(Class<?> cls);
-
- public boolean isArrayType(Class<?> cls);
-
- public Class<?>[] getCollectionType();
-
-}
-
+
+/**
+ * TODO: plan is to allow new collection types to be installed dynamically, allowing the domain programmer to declare
+ * custom classes to have collection semantics.
+ *
+ * <p>
+ * In this way there are similarities with the way in which value types are specified using <tt>@Value</tt>. However, we
+ * need to maintain a repository of these collection types once nominated so that when we introspect classes we look for
+ * collections first, and then properties second.
+ */
+public interface CollectionTypeRegistry extends Injectable, ApplicationScopedComponent {
+
+ public boolean isCollectionType(Class<?> cls);
+
+ public boolean isArrayType(Class<?> cls);
+
+ public Class<?>[] getCollectionType();
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,36 +17,30 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.specloader.collectiontyperegistry;
-package org.apache.isis.core.metamodel.specloader.collectiontyperegistry;
-
-
-
-
-public abstract class CollectionTypeRegistryAbstract implements CollectionTypeRegistry {
-
-
-
- /**
- * Default implementation does nothing.
- */
- public void init() {
- }
-
- /**
- * Default implementation does nothing.
- */
- public void shutdown() {
- }
-
-
-
- public void injectInto(Object candidate) {
- if (CollectionTypeRegistryAware.class.isAssignableFrom(candidate.getClass())) {
- CollectionTypeRegistryAware cast = CollectionTypeRegistryAware.class.cast(candidate);
- cast.setCollectionTypeRegistry(this);
- }
- }
-
-}
-
+public abstract class CollectionTypeRegistryAbstract implements CollectionTypeRegistry {
+
+ /**
+ * Default implementation does nothing.
+ */
+ @Override
+ public void init() {
+ }
+
+ /**
+ * Default implementation does nothing.
+ */
+ @Override
+ public void shutdown() {
+ }
+
+ @Override
+ public void injectInto(final Object candidate) {
+ if (CollectionTypeRegistryAware.class.isAssignableFrom(candidate.getClass())) {
+ final CollectionTypeRegistryAware cast = CollectionTypeRegistryAware.class.cast(candidate);
+ cast.setCollectionTypeRegistry(this);
+ }
+ }
+
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryAware.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryAware.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryAware.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryAware.java Tue Apr 26 18:24:05 2011
@@ -17,11 +17,9 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.specloader.collectiontyperegistry;
-package org.apache.isis.core.metamodel.specloader.collectiontyperegistry;
-
-public interface CollectionTypeRegistryAware {
-
- void setCollectionTypeRegistry(CollectionTypeRegistry collectionTypeRegistry);
-}
-
+public interface CollectionTypeRegistryAware {
+
+ void setCollectionTypeRegistry(CollectionTypeRegistry collectionTypeRegistry);
+}
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryDefault.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryDefault.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/collectiontyperegistry/CollectionTypeRegistryDefault.java Tue Apr 26 18:24:05 2011
@@ -17,52 +17,48 @@
* under the License.
*/
+package org.apache.isis.core.metamodel.specloader.collectiontyperegistry;
-package org.apache.isis.core.metamodel.specloader.collectiontyperegistry;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-
-
-
-
-public class CollectionTypeRegistryDefault extends CollectionTypeRegistryAbstract {
-
- private final List<Class<?>> collectionTypes = new ArrayList<Class<?>>();
- private Class<?>[] collectionTypesAsArray = new Class[0];
-
- /**
- * Inbuilt support for {@link Collection} as a collection type.
- *
- * <p>
- * Note that this includes any subclasses.
- */
- public CollectionTypeRegistryDefault() {
- addCollectionType(Collection.class);
- }
-
- /**
- * Plan is for this to be promoted to API at some stage.
- */
- private void addCollectionType(final Class<?> collectionType) {
- collectionTypes.add(collectionType);
- collectionTypesAsArray = collectionTypes.toArray(new Class[0]);
- }
-
- public boolean isCollectionType(final Class<?> cls) {
- return java.util.Collection.class.isAssignableFrom(cls);
- }
-
- public boolean isArrayType(final Class<?> cls) {
- return cls.isArray();
- }
-
- public Class<?>[] getCollectionType() {
- return collectionTypesAsArray;
- }
-
-
-
-}
-
+
+public class CollectionTypeRegistryDefault extends CollectionTypeRegistryAbstract {
+
+ private final List<Class<?>> collectionTypes = new ArrayList<Class<?>>();
+ private Class<?>[] collectionTypesAsArray = new Class[0];
+
+ /**
+ * Inbuilt support for {@link Collection} as a collection type.
+ *
+ * <p>
+ * Note that this includes any subclasses.
+ */
+ public CollectionTypeRegistryDefault() {
+ addCollectionType(Collection.class);
+ }
+
+ /**
+ * Plan is for this to be promoted to API at some stage.
+ */
+ private void addCollectionType(final Class<?> collectionType) {
+ collectionTypes.add(collectionType);
+ collectionTypesAsArray = collectionTypes.toArray(new Class[0]);
+ }
+
+ @Override
+ public boolean isCollectionType(final Class<?> cls) {
+ return java.util.Collection.class.isAssignableFrom(cls);
+ }
+
+ @Override
+ public boolean isArrayType(final Class<?> cls) {
+ return cls.isArray();
+ }
+
+ @Override
+ public Class<?>[] getCollectionType() {
+ return collectionTypesAsArray;
+ }
+
+}