incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1096837 [13/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...
Date Tue, 26 Apr 2011 18:24:13 GMT
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java Tue Apr 26 18:24:05 2011
@@ -17,86 +17,82 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.specimpl;
 
-package org.apache.isis.core.metamodel.specloader.specimpl;
-
 import org.apache.isis.core.metamodel.adapter.MutableProposedHolder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
 import org.apache.isis.core.metamodel.facets.TypedHolder;
 import org.apache.isis.core.metamodel.spec.Instance;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneActionParameter;
-
-
-public class OneToOneActionParameterImpl extends ObjectActionParameterAbstract implements OneToOneActionParameter {
-
-    public OneToOneActionParameterImpl(final int index, final ObjectActionImpl actionImpl, final TypedHolder peer) {
-        super(index, actionImpl, peer);
-    }
+
+public class OneToOneActionParameterImpl extends ObjectActionParameterAbstract implements OneToOneActionParameter {
+
+    public OneToOneActionParameterImpl(final int index, final ObjectActionImpl actionImpl, final TypedHolder peer) {
+        super(index, actionImpl, peer);
+    }
 
     @Override
     public FeatureType getFeatureType() {
         return FeatureType.ACTION_PARAMETER;
     }
 
-
-    @Override
-    public boolean isObject() {
-        return true;
-    }
-
-    /**
-     * TODO: need to be able to validate parameters individually, eg if have <tt>RegEx</tt> annotation;
-     * should delegate to the Check framework instead.
-     */
     @Override
-    public String isValid(final ObjectAdapter adapter, final Object proposedValue) {
-        return null;
-    }
-
-    // /////////////////////////////////////////////////////////////
-    // getInstance
-    // /////////////////////////////////////////////////////////////
-    
+    public boolean isObject() {
+        return true;
+    }
+
+    /**
+     * TODO: need to be able to validate parameters individually, eg if have <tt>RegEx</tt> annotation; should delegate
+     * to the Check framework instead.
+     */
+    @Override
+    public String isValid(final ObjectAdapter adapter, final Object proposedValue) {
+        return null;
+    }
+
+    // /////////////////////////////////////////////////////////////
+    // getInstance
+    // /////////////////////////////////////////////////////////////
+
     @Override
-    public Instance getInstance(ObjectAdapter adapter) {
-        OneToOneActionParameter specification = this;
-        return adapter.getInstance(specification);
-    }
-
-
-    // //////////////////////////////////////////////////////////////////////
-    // get, set
-    // //////////////////////////////////////////////////////////////////////
-
-    /**
-     * Gets the proposed value of the {@link Instance} (downcast as a
-     * {@link MutableProposed}, wrapping the proposed value into a {@link ObjectAdapter}.
-     */
+    public Instance getInstance(final ObjectAdapter adapter) {
+        final OneToOneActionParameter specification = this;
+        return adapter.getInstance(specification);
+    }
+
+    // //////////////////////////////////////////////////////////////////////
+    // get, set
+    // //////////////////////////////////////////////////////////////////////
+
+    /**
+     * Gets the proposed value of the {@link Instance} (downcast as a {@link MutableProposed}, wrapping the proposed
+     * value into a {@link ObjectAdapter}.
+     */
     @Override
-    public ObjectAdapter get(ObjectAdapter owner) {
-        MutableProposedHolder proposedHolder = getProposedHolder(owner);
-        Object proposed = proposedHolder.getProposed();
-        return getAdapterMap().adapterFor(proposed);
-    }
-
-    /**
-     * Sets the proposed value of the {@link Instance} (downcast as a
-     * {@link MutableProposed}, unwrapped the proposed value from a {@link ObjectAdapter}.
-     */
-    public void set(ObjectAdapter owner, ObjectAdapter newValue) {
-        MutableProposedHolder proposedHolder = getProposedHolder(owner);
-        Object newValuePojo = newValue.getObject();
-        proposedHolder.setProposed(newValuePojo);
-    }
-
-    private MutableProposedHolder getProposedHolder(ObjectAdapter owner) {
-        Instance instance = getInstance(owner);
-        if(!(instance instanceof MutableProposedHolder)) {
-            throw new IllegalArgumentException("Instance should implement MutableProposedHolder");
-        }
-        MutableProposedHolder proposedHolder = (MutableProposedHolder) instance;
-        return proposedHolder;
+    public ObjectAdapter get(final ObjectAdapter owner) {
+        final MutableProposedHolder proposedHolder = getProposedHolder(owner);
+        final Object proposed = proposedHolder.getProposed();
+        return getAdapterMap().adapterFor(proposed);
+    }
+
+    /**
+     * Sets the proposed value of the {@link Instance} (downcast as a {@link MutableProposed}, unwrapped the proposed
+     * value from a {@link ObjectAdapter}.
+     */
+    public void set(final ObjectAdapter owner, final ObjectAdapter newValue) {
+        final MutableProposedHolder proposedHolder = getProposedHolder(owner);
+        final Object newValuePojo = newValue.getObject();
+        proposedHolder.setProposed(newValuePojo);
+    }
+
+    private MutableProposedHolder getProposedHolder(final ObjectAdapter owner) {
+        final Instance instance = getInstance(owner);
+        if (!(instance instanceof MutableProposedHolder)) {
+            throw new IllegalArgumentException("Instance should implement MutableProposedHolder");
+        }
+        final MutableProposedHolder proposedHolder = (MutableProposedHolder) instance;
+        return proposedHolder;
     }
 
-}
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneAssociationImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneAssociationImpl.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneAssociationImpl.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneAssociationImpl.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.specloader.specimpl;
 
 import java.util.List;
@@ -53,16 +52,11 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectMemberContext;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 
-
 public class OneToOneAssociationImpl extends ObjectAssociationAbstract implements OneToOneAssociation {
 
-    public OneToOneAssociationImpl(
-    		final FacetedMethod facetedMethod, 
-            final ObjectMemberContext objectMemberContext) {
-        super(facetedMethod, 
-            FeatureType.PROPERTY, 
-            getSpecification(objectMemberContext.getSpecificationLookup(), facetedMethod.getType()), 
-            objectMemberContext);
+    public OneToOneAssociationImpl(final FacetedMethod facetedMethod, final ObjectMemberContext objectMemberContext) {
+        super(facetedMethod, FeatureType.PROPERTY, getSpecification(objectMemberContext.getSpecificationLookup(),
+            facetedMethod.getType()), objectMemberContext);
     }
 
     // /////////////////////////////////////////////////////////////
@@ -70,10 +64,8 @@ public class OneToOneAssociationImpl ext
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public VisibilityContext<?> createVisibleInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter ownerAdapter) {
+    public VisibilityContext<?> createVisibleInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter ownerAdapter) {
         return new PropertyVisibilityContext(session, invocationMethod, ownerAdapter, getIdentifier());
     }
 
@@ -82,10 +74,8 @@ public class OneToOneAssociationImpl ext
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public UsabilityContext<?> createUsableInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter ownerAdapter) {
+    public UsabilityContext<?> createUsableInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter ownerAdapter) {
         return new PropertyUsabilityContext(session, invocationMethod, ownerAdapter, getIdentifier());
     }
 
@@ -94,12 +84,11 @@ public class OneToOneAssociationImpl ext
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public ValidityContext<?> createValidateInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod interactionMethod,
-            final ObjectAdapter ownerAdapter,
-            final ObjectAdapter proposedToReferenceAdapter) {
-        return new PropertyModifyContext(session, interactionMethod, ownerAdapter, getIdentifier(), proposedToReferenceAdapter);
+    public ValidityContext<?> createValidateInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod interactionMethod, final ObjectAdapter ownerAdapter,
+        final ObjectAdapter proposedToReferenceAdapter) {
+        return new PropertyModifyContext(session, interactionMethod, ownerAdapter, getIdentifier(),
+            proposedToReferenceAdapter);
     }
 
     /**
@@ -111,9 +100,11 @@ public class OneToOneAssociationImpl ext
         return isAssociationValidResult(ownerAdapter, proposedToReferenceAdapter).createConsent();
     }
 
-    private InteractionResult isAssociationValidResult(final ObjectAdapter ownerAdapter, final ObjectAdapter proposedToReferenceAdapter) {
-        final ValidityContext<?> validityContext = createValidateInteractionContext(getAuthenticationSession(),
-                InteractionInvocationMethod.BY_USER, ownerAdapter, proposedToReferenceAdapter);
+    private InteractionResult isAssociationValidResult(final ObjectAdapter ownerAdapter,
+        final ObjectAdapter proposedToReferenceAdapter) {
+        final ValidityContext<?> validityContext =
+            createValidateInteractionContext(getAuthenticationSession(), InteractionInvocationMethod.BY_USER,
+                ownerAdapter, proposedToReferenceAdapter);
         return InteractionUtils.isValidResult(this, validityContext);
     }
 
@@ -137,26 +128,23 @@ public class OneToOneAssociationImpl ext
     public ObjectAdapter get(final ObjectAdapter ownerAdapter) {
         final PropertyOrCollectionAccessorFacet facet = getFacet(PropertyOrCollectionAccessorFacet.class);
         final Object referencedPojo = facet.getProperty(ownerAdapter);
-        
+
         if (referencedPojo == null) {
             return null;
         }
-        
+
         return getAdapterMap().adapterFor(referencedPojo, ownerAdapter, this);
     }
 
-
     /**
      * TODO: currently this method is hard-coded to assume all interactions are initiated
      * {@link InteractionInvocationMethod#BY_USER by user}.
      */
     @Override
-    public PropertyAccessContext createAccessInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod interactionMethod,
-            final ObjectAdapter ownerAdapter) {
+    public PropertyAccessContext createAccessInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod interactionMethod, final ObjectAdapter ownerAdapter) {
         return new PropertyAccessContext(session, InteractionInvocationMethod.BY_USER, ownerAdapter, getIdentifier(),
-                get(ownerAdapter));
+            get(ownerAdapter));
     }
 
     @Override
@@ -169,12 +157,12 @@ public class OneToOneAssociationImpl ext
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public void set(ObjectAdapter ownerAdapter, ObjectAdapter newReferencedAdapter) {
-    	if (newReferencedAdapter != null) {
-    		setAssociation(ownerAdapter, newReferencedAdapter);
-    	} else {
-    		clearAssociation(ownerAdapter);
-    	}
+    public void set(final ObjectAdapter ownerAdapter, final ObjectAdapter newReferencedAdapter) {
+        if (newReferencedAdapter != null) {
+            setAssociation(ownerAdapter, newReferencedAdapter);
+        } else {
+            clearAssociation(ownerAdapter);
+        }
     }
 
     @Override
@@ -182,11 +170,11 @@ public class OneToOneAssociationImpl ext
         final PropertySetterFacet setterFacet = getFacet(PropertySetterFacet.class);
         if (setterFacet != null) {
             if (ownerAdapter.isPersistent() && newReferencedAdapter != null && newReferencedAdapter.isTransient()
-                    && !newReferencedAdapter.getSpecification().isAggregated()) {
+                && !newReferencedAdapter.getSpecification().isAggregated()) {
                 // TODO: move to facet ?
-			    throw new IsisException("can't set a reference to a transient object from a persistent one: "
-			            + newReferencedAdapter.titleString() + " (transient)");
-			}
+                throw new IsisException("can't set a reference to a transient object from a persistent one: "
+                    + newReferencedAdapter.titleString() + " (transient)");
+            }
             setterFacet.setProperty(ownerAdapter, newReferencedAdapter);
         }
     }
@@ -217,13 +205,13 @@ public class OneToOneAssociationImpl ext
 
     @Override
     public void toDefault(final ObjectAdapter ownerAdapter) {
-    	// don't default optional fields
-    	MandatoryFacet mandatoryFacet = getFacet(MandatoryFacet.class);
-    	if (mandatoryFacet != null && mandatoryFacet.isInvertedSemantics()) {
-    		return;
-    	}
-    	
-    	final ObjectAdapter defaultValue = getDefault(ownerAdapter);
+        // don't default optional fields
+        final MandatoryFacet mandatoryFacet = getFacet(MandatoryFacet.class);
+        if (mandatoryFacet != null && mandatoryFacet.isInvertedSemantics()) {
+            return;
+        }
+
+        final ObjectAdapter defaultValue = getDefault(ownerAdapter);
         if (defaultValue != null) {
             initAssociation(ownerAdapter, defaultValue);
         }
@@ -243,7 +231,9 @@ public class OneToOneAssociationImpl ext
     @Override
     public ObjectAdapter[] getChoices(final ObjectAdapter ownerAdapter) {
         final PropertyChoicesFacet propertyChoicesFacet = getFacet(PropertyChoicesFacet.class);
-        final Object[] pojoOptions = propertyChoicesFacet == null ? null : propertyChoicesFacet.getChoices(ownerAdapter, getSpecificationLookup());
+        final Object[] pojoOptions =
+            propertyChoicesFacet == null ? null : propertyChoicesFacet.getChoices(ownerAdapter,
+                getSpecificationLookup());
         if (pojoOptions != null) {
             final ObjectAdapter[] options = new ObjectAdapter[pojoOptions.length];
             for (int i = 0; i < options.length; i++) {
@@ -251,34 +241,29 @@ public class OneToOneAssociationImpl ext
             }
             return options;
         } else if (BoundedFacetUtils.isBoundedSet(getSpecification())) {
-        	
-            QueryFindAllInstances query = new QueryFindAllInstances(getSpecification().getFullIdentifier());
-			final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
-        	final ObjectAdapter[] options = new ObjectAdapter[allInstancesAdapter.size()];
-        	int j = 0;
-            for (ObjectAdapter adapter: allInstancesAdapter) {
-            	options[j++] = adapter;
+
+            final QueryFindAllInstances query = new QueryFindAllInstances(getSpecification().getFullIdentifier());
+            final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
+            final ObjectAdapter[] options = new ObjectAdapter[allInstancesAdapter.size()];
+            int j = 0;
+            for (final ObjectAdapter adapter : allInstancesAdapter) {
+                options[j++] = adapter;
             }
             return options;
         }
         return null;
     }
 
-
-
     // /////////////////////////////////////////////////////////////
     // getInstance
     // /////////////////////////////////////////////////////////////
-    
 
     @Override
-    public Instance getInstance(ObjectAdapter ownerAdapter) {
-        OneToOneAssociation specification = this;
+    public Instance getInstance(final ObjectAdapter ownerAdapter) {
+        final OneToOneAssociation specification = this;
         return ownerAdapter.getInstance(specification);
     }
 
-    
-    
     // /////////////////////////////////////////////////////////////
     // debug, toString
     // /////////////////////////////////////////////////////////////

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java Tue Apr 26 18:24:05 2011
@@ -25,11 +25,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.log4j.Logger;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
 import org.apache.isis.applib.filter.Filter;
 import org.apache.isis.applib.filter.Filters;
 import org.apache.isis.applib.profiles.Perspective;
@@ -79,13 +74,17 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.specloader.specimpl.ObjectSpecificationAbstract;
 import org.apache.isis.core.metamodel.specloader.specimpl.OneToManyAssociationImpl;
 import org.apache.isis.core.metamodel.specloader.specimpl.OneToOneAssociationImpl;
+import org.apache.log4j.Logger;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 
 public class ObjectSpecificationDefault extends ObjectSpecificationAbstract implements DebuggableWithTitle, FacetHolder {
 
     private final static Logger LOG = Logger.getLogger(ObjectSpecificationDefault.class);
 
     private static String determineShortName(final Class<?> introspectedClass) {
-        String name = introspectedClass.getName();
+        final String name = introspectedClass.getName();
         return name.substring(name.lastIndexOf('.') + 1);
     }
 
@@ -93,10 +92,8 @@ public class ObjectSpecificationDefault 
     // fields
     // //////////////////////////////////////////////////////////////
 
-
     private boolean isService;
 
-    
     /**
      * Lazily built by {@link #getMember(Method)}.
      */
@@ -108,30 +105,23 @@ public class ObjectSpecificationDefault 
 
     private FacetedMethodsBuilder facetedMethodsBuilder;
 
-    
     // //////////////////////////////////////////////////////////////////////
     // Constructor
     // //////////////////////////////////////////////////////////////////////
 
-
-    public ObjectSpecificationDefault(
-        final Class<?> correspondingClass, 
+    public ObjectSpecificationDefault(final Class<?> correspondingClass,
         final FacetedMethodsBuilderContext facetedMethodsBuilderContext,
-        final IntrospectionContext introspectionContext,
-        final SpecificationContext specContext, 
-        final ObjectMemberContext objectMemberContext,
-        final CreateObjectContext createObjectContext 
-        ) {
+        final IntrospectionContext introspectionContext, final SpecificationContext specContext,
+        final ObjectMemberContext objectMemberContext, final CreateObjectContext createObjectContext) {
         super(correspondingClass, determineShortName(correspondingClass), specContext);
-        
+
         this.facetedMethodsBuilder = new FacetedMethodsBuilder(this, facetedMethodsBuilderContext);
-        
+
         this.introspectionContext = introspectionContext;
         this.createObjectContext = createObjectContext;
         this.objectMemberContext = objectMemberContext;
     }
 
-    
     @Override
     public void introspectTypeHierarchyAndMembers() {
         if (facetedMethodsBuilder == null) {
@@ -168,11 +158,11 @@ public class ObjectSpecificationDefault 
         // the interface type... needs some tests around it, though, before
         // making that refactoring.
         final Class<?>[] interfaceTypes = getCorrespondingClass().getInterfaces();
-        List<ObjectSpecification> interfaceSpecList = Lists.newArrayList();
-        for (Class<?> interfaceType : interfaceTypes) {
-            Class<?> substitutedInterfaceType = getClassSubstitutor().getClass(interfaceType);
+        final List<ObjectSpecification> interfaceSpecList = Lists.newArrayList();
+        for (final Class<?> interfaceType : interfaceTypes) {
+            final Class<?> substitutedInterfaceType = getClassSubstitutor().getClass(interfaceType);
             if (substitutedInterfaceType != null) {
-                ObjectSpecification interfaceSpec =
+                final ObjectSpecification interfaceSpec =
                     getSpecificationLookup().loadSpecification(substitutedInterfaceType);
                 interfaceSpecList.add(interfaceSpec);
             }
@@ -186,20 +176,19 @@ public class ObjectSpecificationDefault 
         final List<FacetedMethod> actionFacetedMethods = facetedMethodsBuilder.getActionFacetedMethods();
 
         // ordering
-        final OrderSet associationOrderSet = getMemberLayoutArranger().createAssociationOrderSetFor(this, associationFacetedMethods);
+        final OrderSet associationOrderSet =
+            getMemberLayoutArranger().createAssociationOrderSetFor(this, associationFacetedMethods);
         addAssociations(asAssociations(associationOrderSet));
 
-        OrderSet actionOrderSet = getMemberLayoutArranger().createActionOrderSetFor(this, actionFacetedMethods);
+        final OrderSet actionOrderSet = getMemberLayoutArranger().createActionOrderSetFor(this, actionFacetedMethods);
         addObjectActions(asObjectActions(actionOrderSet));
 
         updateFromFacetValues();
-        
+
         facetedMethodsBuilder = null;
         setIntrospected(true);
     }
 
-
-
     private void addNamedFacetAndPluralFacetIfRequired() {
         NamedFacet namedFacet = getFacet(NamedFacet.class);
         if (namedFacet == null) {
@@ -217,18 +206,18 @@ public class ObjectSpecificationDefault 
     /**
      * TODO: review this, should be more general and check for value facet, surely?
      */
-    private boolean isAppLibValue(Class<?> type) {
+    private boolean isAppLibValue(final Class<?> type) {
         return type.getName().startsWith("org.apache.isis.applib.value.");
     }
 
     private List<ObjectAssociation> asAssociations(final OrderSet orderSet) {
-        if(orderSet == null) {
+        if (orderSet == null) {
             return null;
         }
         final List<ObjectAssociation> associations = Lists.newArrayList();
-        for (Object element : orderSet) {
+        for (final Object element : orderSet) {
             if (element instanceof FacetedMethod) {
-                FacetedMethod facetMethod = (FacetedMethod) element;
+                final FacetedMethod facetMethod = (FacetedMethod) element;
                 if (facetMethod.getFeatureType().isCollection()) {
                     associations.add(createCollection(facetMethod));
                 } else if (facetMethod.getFeatureType().isProperty()) {
@@ -245,11 +234,11 @@ public class ObjectSpecificationDefault 
     }
 
     private List<ObjectAction> asObjectActions(final OrderSet orderSet) {
-        if(orderSet == null) {
+        if (orderSet == null) {
             return null;
         }
         final List<ObjectAction> actions = Lists.newArrayList();
-        for (Object element : orderSet) {
+        for (final Object element : orderSet) {
             if (element instanceof FacetedMethod) {
                 final FacetedMethod facetedMethod = (FacetedMethod) element;
                 if (facetedMethod.getFeatureType().isAction()) {
@@ -281,7 +270,6 @@ public class ObjectSpecificationDefault 
         return new ObjectActionSet("", set.getGroupFullName(), asObjectActions(set));
     }
 
-
     /**
      * Added to try to track down a race condition.
      */
@@ -317,8 +305,8 @@ public class ObjectSpecificationDefault 
 
     private void ensureServiceHasNoAssociations() {
         final List<ObjectAssociation> associations = getAssociations();
-        StringBuilder buf = new StringBuilder();
-        for (ObjectAssociation association : associations) {
+        final StringBuilder buf = new StringBuilder();
+        for (final ObjectAssociation association : associations) {
             final String name = association.getId();
             // services are allowed to have one association, called 'id'
             if (!isValidAssociationForService(name)) {
@@ -341,7 +329,7 @@ public class ObjectSpecificationDefault 
         return "id".indexOf(associationId) != -1;
     }
 
-    private void appendAssociationName(StringBuilder fieldNames, final String name) {
+    private void appendAssociationName(final StringBuilder fieldNames, final String name) {
         fieldNames.append(fieldNames.length() > 0 ? ", " : "");
         fieldNames.append(name);
     }
@@ -434,22 +422,22 @@ public class ObjectSpecificationDefault 
     // //////////////////////////////////////////////////////////////////////
 
     @Override
-    public Object createObject(CreationMode creationMode) {
+    public Object createObject(final CreationMode creationMode) {
         return createObject(null, creationMode);
     }
-      
+
     @Override
-    public Object createAggregatedObject(ObjectAdapter parent, CreationMode creationMode) {
+    public Object createAggregatedObject(final ObjectAdapter parent, final CreationMode creationMode) {
         return createObject(parent, creationMode);
     }
 
-    private Object createObject(ObjectAdapter parent, CreationMode creationMode) {
+    private Object createObject(final ObjectAdapter parent, final CreationMode creationMode) {
         if (getCorrespondingClass().isArray()) {
             return Array.newInstance(getCorrespondingClass().getComponentType(), 0);
         }
 
         try {
-            Object object = getObjectInstantiator().instantiate(getCorrespondingClass());
+            final Object object = getObjectInstantiator().instantiate(getCorrespondingClass());
 
             if (creationMode == CreationMode.INITIALIZE) {
                 final ObjectAdapter adapter;
@@ -489,14 +477,14 @@ public class ObjectSpecificationDefault 
     }
 
     private void cataloguePropertiesAndCollections(final Map<Method, ObjectMember> membersByMethod) {
-        Filter<ObjectAssociation> noop = Filters.anyOfType(ObjectAssociation.class);
+        final Filter<ObjectAssociation> noop = Filters.anyOfType(ObjectAssociation.class);
         final List<ObjectAssociation> fields = getAssociations(noop);
         for (int i = 0; i < fields.size(); i++) {
             final ObjectAssociation field = fields.get(i);
             final List<Facet> facets = field.getFacets(ImperativeFacet.FILTER);
-            for (final Facet facet: facets) {
+            for (final Facet facet : facets) {
                 final ImperativeFacet imperativeFacet = ImperativeFacetUtils.getImperativeFacet(facet);
-                for (Method imperativeFacetMethod : imperativeFacet.getMethods()) {
+                for (final Method imperativeFacetMethod : imperativeFacet.getMethods()) {
                     membersByMethod.put(imperativeFacetMethod, field);
                 }
             }
@@ -508,9 +496,9 @@ public class ObjectSpecificationDefault 
         for (int i = 0; i < userActions.size(); i++) {
             final ObjectAction userAction = userActions.get(i);
             final List<Facet> facets = userAction.getFacets(ImperativeFacet.FILTER);
-            for (final Facet facet: facets) {
+            for (final Facet facet : facets) {
                 final ImperativeFacet imperativeFacet = ImperativeFacetUtils.getImperativeFacet(facet);
-                for (Method imperativeFacetMethod : imperativeFacet.getMethods()) {
+                for (final Method imperativeFacetMethod : imperativeFacet.getMethods()) {
                     membersByMethod.put(imperativeFacetMethod, userAction);
                 }
             }
@@ -525,7 +513,7 @@ public class ObjectSpecificationDefault 
     public void debugData(final DebugBuilder debug) {
         debug.blankLine();
         debug.appendln("Title", getFacet(TitleFacet.class));
-        IconFacet iconFacet = getFacet(IconFacet.class);
+        final IconFacet iconFacet = getFacet(IconFacet.class);
         if (iconFacet != null) {
             debug.appendln("Icon", iconFacet);
         }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/CollectionFacetForObjectList.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/CollectionFacetForObjectList.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/CollectionFacetForObjectList.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/CollectionFacetForObjectList.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.specloader.specimpl.objectlist;
 
 import java.util.List;
@@ -27,7 +26,6 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.collections.CollectionFacetAbstract;
 import org.apache.isis.core.metamodel.spec.ObjectList;
 
-
 public class CollectionFacetForObjectList extends CollectionFacetAbstract {
 
     public CollectionFacetForObjectList(final FacetHolder holder) {
@@ -42,14 +40,13 @@ public class CollectionFacetForObjectLis
         return (ObjectList) wrappedObjectList.getObject();
     }
 
-    
     /**
      * Expected to be called with a {@link ObjectAdapter} wrapping a {@link ObjectList}.
      */
     @Override
     public ObjectAdapter firstElement(final ObjectAdapter wrappedInstanceCollectionVector) {
-        List<ObjectAdapter> icv = collection(wrappedInstanceCollectionVector);
-        return icv.size() > 0? icv.get(0): null;
+        final List<ObjectAdapter> icv = collection(wrappedInstanceCollectionVector);
+        return icv.size() > 0 ? icv.get(0) : null;
     }
 
     /**
@@ -64,8 +61,7 @@ public class CollectionFacetForObjectLis
      * Does nothing.
      */
     @Override
-    public void init(final ObjectAdapter collection, final ObjectAdapter[] initData) {}
-
+    public void init(final ObjectAdapter collection, final ObjectAdapter[] initData) {
+    }
 
 }
-

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/DescribedAsFacetForObjectList.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/DescribedAsFacetForObjectList.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/DescribedAsFacetForObjectList.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/DescribedAsFacetForObjectList.java Tue Apr 26 18:24:05 2011
@@ -17,18 +17,15 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.specimpl.objectlist;
 
-package org.apache.isis.core.metamodel.specloader.specimpl.objectlist;
-
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
-
-
-public class DescribedAsFacetForObjectList extends DescribedAsFacetAbstract {
-
-    public DescribedAsFacetForObjectList(final String value, final FacetHolder holder) {
-        super(value, holder);
-    }
-
-}
-
+
+public class DescribedAsFacetForObjectList extends DescribedAsFacetAbstract {
+
+    public DescribedAsFacetForObjectList(final String value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/NamedFacetForObjectList.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/NamedFacetForObjectList.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/NamedFacetForObjectList.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/NamedFacetForObjectList.java Tue Apr 26 18:24:05 2011
@@ -17,18 +17,15 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.specimpl.objectlist;
 
-package org.apache.isis.core.metamodel.specloader.specimpl.objectlist;
-
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.named.NamedFacetAbstract;
-
-
-public class NamedFacetForObjectList extends NamedFacetAbstract {
-
-    public NamedFacetForObjectList(final String value, final FacetHolder holder) {
-        super(value, holder);
-    }
-
-}
-
+
+public class NamedFacetForObjectList extends NamedFacetAbstract {
+
+    public NamedFacetForObjectList(final String value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/ObjectSpecificationForObjectList.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/ObjectSpecificationForObjectList.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/ObjectSpecificationForObjectList.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/ObjectSpecificationForObjectList.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.specloader.specimpl.objectlist;
 
 import java.util.Collections;
@@ -36,51 +35,48 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.specloader.specimpl.ObjectSpecificationAbstract;
 
-
 /**
- * A custom {@link ObjectSpecification} that is designed to treat the
- * {@link ObjectList} class as a "standalone" collection.
+ * A custom {@link ObjectSpecification} that is designed to treat the {@link ObjectList} class as a "standalone"
+ * collection.
  */
 public class ObjectSpecificationForObjectList extends ObjectSpecificationAbstract {
 
     /**
      * Used as {@link #getShortIdentifier()}, {@link #getName()} and {@link #getPluralName()}.
      */
-	private static final String NAME = "Instances";
-	private static final String DESCRIBED_AS = "Typed instances";
-	private static final String ICON_NAME = "instances";
-
-    public ObjectSpecificationForObjectList(
-    		final SpecificationContext specificationContext) {
-		super(ObjectList.class, NAME, specificationContext);
-	}
+    private static final String NAME = "Instances";
+    private static final String DESCRIBED_AS = "Typed instances";
+    private static final String ICON_NAME = "instances";
+
+    public ObjectSpecificationForObjectList(final SpecificationContext specificationContext) {
+        super(ObjectList.class, NAME, specificationContext);
+    }
 
-    
-    ///////////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////////
     // Intrinsic to class
-    ///////////////////////////////////////////////////////////
-    
+    // /////////////////////////////////////////////////////////
+
     /**
-     * Review: wouldn't it be better to have a FacetFactory that specifically
-     * recognized {@link ObjectList} as a type and installed a {@link CollectionFacet}
-     * for it.
+     * Review: wouldn't it be better to have a FacetFactory that specifically recognized {@link ObjectList} as a type
+     * and installed a {@link CollectionFacet} for it.
      */
     @Override
     public boolean isCollectionOrIsAggregated() {
         return true;
     }
 
-    ///////////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////////
     // Introspection
-    ///////////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////////
 
     @Override
     public void introspectTypeHierarchyAndMembers() {
         setSuperclass(Object.class);
 
         addFacet(new CollectionFacetForObjectList(this));
-        addFacet(new TypeOfFacetDefaultToObject(this, getSpecificationLookup()) {});
-        
+        addFacet(new TypeOfFacetDefaultToObject(this, getSpecificationLookup()) {
+        });
+
         // ObjectList specific
         FacetUtil.addFacet(new NamedFacetForObjectList(NAME, this));
         FacetUtil.addFacet(new PluralFacetForObjectList(NAME, this));
@@ -88,52 +84,47 @@ public class ObjectSpecificationForObjec
         // don't install anything for NotPersistableFacet
     }
 
-
-    ///////////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////////
     // Override facets
-    ///////////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////////
 
-
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // Service
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
 
     /**
      * No-op.
-     *
+     * 
      * <p>
-     * Review: is this ever called for an instance of this class?  If not, then
-     * no need to override.
+     * Review: is this ever called for an instance of this class? If not, then no need to override.
      */
     @Override
-    public void markAsService() {}
+    public void markAsService() {
+    }
 
     @Override
     public boolean isService() {
         return false;
     }
 
-
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // Associations
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
 
     /**
-     * Review: is this ever called for an instance of this class?  If not, then
-     * no need to override.
+     * Review: is this ever called for an instance of this class? If not, then no need to override.
      */
     @Override
     public ObjectAssociation getAssociation(final String id) {
         return null;
     }
 
-
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // Title and Icon
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
 
     @Override
-    public String getTitle(final ObjectAdapter object, Localization localization) {
+    public String getTitle(final ObjectAdapter object, final Localization localization) {
         return ((ObjectList) object.getObject()).titleString();
     }
 
@@ -142,20 +133,16 @@ public class ObjectSpecificationForObjec
         return ICON_NAME;
     }
 
-
-    
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // Object Actions
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
 
     /**
      * Review: is it necessary to override for this subclass?
      */
     @Override
-    public ObjectAction getObjectAction(
-            final ActionType type,
-            final String id,
-            final List<ObjectSpecification> parameters) {
+    public ObjectAction getObjectAction(final ActionType type, final String id,
+        final List<ObjectSpecification> parameters) {
         return null;
     }
 
@@ -167,9 +154,9 @@ public class ObjectSpecificationForObjec
         return null;
     }
 
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // Service Actions
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
 
     /**
      * Review: is it necessary to override for this subclass?
@@ -179,6 +166,4 @@ public class ObjectSpecificationForObjec
         return Collections.emptyList();
     }
 
-
 }
-

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/PluralFacetForObjectList.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/PluralFacetForObjectList.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/PluralFacetForObjectList.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/objectlist/PluralFacetForObjectList.java Tue Apr 26 18:24:05 2011
@@ -17,18 +17,15 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.specimpl.objectlist;
 
-package org.apache.isis.core.metamodel.specloader.specimpl.objectlist;
-
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.object.plural.PluralFacetAbstract;
-
-
-public class PluralFacetForObjectList extends PluralFacetAbstract {
-
-    public PluralFacetForObjectList(final String value, final FacetHolder holder) {
-        super(value, holder);
-    }
-
-}
-
+
+public class PluralFacetForObjectList extends PluralFacetAbstract {
+
+    public PluralFacetForObjectList(final String value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/SpecificationTraverser.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/SpecificationTraverser.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/SpecificationTraverser.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/SpecificationTraverser.java Tue Apr 26 18:24:05 2011
@@ -17,21 +17,19 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.traverser;
 
-package org.apache.isis.core.metamodel.specloader.traverser;
-
 import java.lang.reflect.Method;
 import java.util.List;
 
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public interface SpecificationTraverser extends ApplicationScopedComponent {
-
-	void traverseTypes(Method method, List<Class<?>> discoveredTypes);
-
-	void traverseReferencedClasses(
-			ObjectSpecification noSpec,
-			List<Class<?>> discoveredTypes) throws ClassNotFoundException;
-
-}
+
+public interface SpecificationTraverser extends ApplicationScopedComponent {
+
+    void traverseTypes(Method method, List<Class<?>> discoveredTypes);
+
+    void traverseReferencedClasses(ObjectSpecification noSpec, List<Class<?>> discoveredTypes)
+        throws ClassNotFoundException;
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/SpecificationTraverserDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/SpecificationTraverserDefault.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/SpecificationTraverserDefault.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/SpecificationTraverserDefault.java Tue Apr 26 18:24:05 2011
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.traverser;
 
-package org.apache.isis.core.metamodel.specloader.traverser;
-
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
@@ -30,64 +29,61 @@ import java.util.List;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
-
-public class SpecificationTraverserDefault implements SpecificationTraverser, SpecificationLoaderAware {
-
-	private SpecificationLoader specificationLoader;
-	
-
-	//////////////////////////////////////////////////////////////////////
-	// init, shutdown
-	//////////////////////////////////////////////////////////////////////
-
-	public void init() {
-		ensureThatState(specificationLoader, is(notNullValue()));
-	}
-
-	public void shutdown() {
-	}
-
-	
-	//////////////////////////////////////////////////////////////////////
-	// Traverse API
-	//////////////////////////////////////////////////////////////////////
-
-	/**
-	 * Traverses the return types of each method.
-	 * 
-	 * <p>
-	 * It's possible for there to be multiple return types: the generic type, and the parameterized type.
-	 */
-	public void traverseTypes(Method method, List<Class<?>> discoveredTypes) {
-		TypeExtractorMethodReturn returnTypes = new TypeExtractorMethodReturn(method);
-		for (Class<?> returnType : returnTypes) {
-			discoveredTypes.add(returnType);
-		}
-	}
-
-
-	/**
-	 * Does nothing.
-	 */
-	public void traverseReferencedClasses(ObjectSpecification noSpec,
-			List<Class<?>> discoveredTypes)
-			throws ClassNotFoundException {
-	}
-
-
-	
-	//////////////////////////////////////////////////////////////////////
-	// Dependencies (due to *Aware)
-	//////////////////////////////////////////////////////////////////////
-	
-	public SpecificationLoader getSpecificationLoader() {
-		return specificationLoader;
-	}
-
-	public void setSpecificationLoader(SpecificationLoader specificationLoader) {
-		this.specificationLoader = specificationLoader;
-	}
-	
-
-
-}
+
+public class SpecificationTraverserDefault implements SpecificationTraverser, SpecificationLoaderAware {
+
+    private SpecificationLoader specificationLoader;
+
+    // ////////////////////////////////////////////////////////////////////
+    // init, shutdown
+    // ////////////////////////////////////////////////////////////////////
+
+    @Override
+    public void init() {
+        ensureThatState(specificationLoader, is(notNullValue()));
+    }
+
+    @Override
+    public void shutdown() {
+    }
+
+    // ////////////////////////////////////////////////////////////////////
+    // Traverse API
+    // ////////////////////////////////////////////////////////////////////
+
+    /**
+     * Traverses the return types of each method.
+     * 
+     * <p>
+     * It's possible for there to be multiple return types: the generic type, and the parameterized type.
+     */
+    @Override
+    public void traverseTypes(final Method method, final List<Class<?>> discoveredTypes) {
+        final TypeExtractorMethodReturn returnTypes = new TypeExtractorMethodReturn(method);
+        for (final Class<?> returnType : returnTypes) {
+            discoveredTypes.add(returnType);
+        }
+    }
+
+    /**
+     * Does nothing.
+     */
+    @Override
+    public void traverseReferencedClasses(final ObjectSpecification noSpec, final List<Class<?>> discoveredTypes)
+        throws ClassNotFoundException {
+    }
+
+    // ////////////////////////////////////////////////////////////////////
+    // Dependencies (due to *Aware)
+    // ////////////////////////////////////////////////////////////////////
+
+    public SpecificationLoader getSpecificationLoader() {
+        return specificationLoader;
+    }
+
+    @Override
+    public void setSpecificationLoader(final SpecificationLoader specificationLoader) {
+        this.specificationLoader = specificationLoader;
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.traverser;
 
-package org.apache.isis.core.metamodel.specloader.traverser;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -27,59 +26,57 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-
-/**
- * Abstract base class factoring out common functionality for
- * helper methods that extract parameterized types.
- * 
- */
-abstract class TypeExtractorAbstract implements Iterable<Class<?>>{
-    private final Method method;
-    private final List<Class<?>> classes = new ArrayList<Class<?>>();
-    
-    public TypeExtractorAbstract(final Method method) {
-        this.method = method;
-    }
-
-    protected void addParameterizedTypes(Type... genericTypes) {
-        for(Type genericType: genericTypes) {
-            if (genericType instanceof ParameterizedType) {
-                ParameterizedType parameterizedType = (ParameterizedType) genericType;
-                Type[] typeArguments = parameterizedType.getActualTypeArguments();
-                for(Type type: typeArguments) {
-                    if (type instanceof Class) {
-                        Class<?> cls = (Class<?>) type;
-                        add(cls);
-                    }
-                }
-            }
-        }
-    }
-    
-    /**
-     * Adds to {@link #getClasses() list of classes}, provided not
-     * {@link Void}.
-     */
-    protected void add(Class<?> cls) {
-        if (cls == void.class) {
-            return;
-        }
-        classes.add(cls);
-    }
-
-    /**
-     * The {@link Method} provided in the {@link #TypeExtractorAbstract(Method) constructor.}
-     */
-    protected Method getMethod() {
-        return method;
-    }
-
-    public List<Class<?>> getClasses() {
-        return Collections.unmodifiableList(classes);
-    }
-
-    public Iterator<Class<?>> iterator() {
-        return getClasses().iterator();
-    }
-}
-
+
+/**
+ * Abstract base class factoring out common functionality for helper methods that extract parameterized types.
+ * 
+ */
+abstract class TypeExtractorAbstract implements Iterable<Class<?>> {
+    private final Method method;
+    private final List<Class<?>> classes = new ArrayList<Class<?>>();
+
+    public TypeExtractorAbstract(final Method method) {
+        this.method = method;
+    }
+
+    protected void addParameterizedTypes(final Type... genericTypes) {
+        for (final Type genericType : genericTypes) {
+            if (genericType instanceof ParameterizedType) {
+                final ParameterizedType parameterizedType = (ParameterizedType) genericType;
+                final Type[] typeArguments = parameterizedType.getActualTypeArguments();
+                for (final Type type : typeArguments) {
+                    if (type instanceof Class) {
+                        final Class<?> cls = (Class<?>) type;
+                        add(cls);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Adds to {@link #getClasses() list of classes}, provided not {@link Void}.
+     */
+    protected void add(final Class<?> cls) {
+        if (cls == void.class) {
+            return;
+        }
+        classes.add(cls);
+    }
+
+    /**
+     * The {@link Method} provided in the {@link #TypeExtractorAbstract(Method) constructor.}
+     */
+    protected Method getMethod() {
+        return method;
+    }
+
+    public List<Class<?>> getClasses() {
+        return Collections.unmodifiableList(classes);
+    }
+
+    @Override
+    public Iterator<Class<?>> iterator() {
+        return getClasses().iterator();
+    }
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorMethodParameters.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorMethodParameters.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorMethodParameters.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorMethodParameters.java Tue Apr 26 18:24:05 2011
@@ -17,47 +17,45 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.traverser;
 
-package org.apache.isis.core.metamodel.specloader.traverser;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
-
-/**
- * Helper that finds all parameter types (including generic types) for the
- * provided {@link Method}.
- * 
- * <p>
- * For example,
- * <pre>
- * public class CustomerRepository {
- *     public void filterCustomers(List<Customer> customerList) { ... }
- * }
- * </pre>
- * <p>
- * will find both <tt>List</tt> and <tt>Customer</tt>. 
- */
-public class TypeExtractorMethodParameters extends TypeExtractorAbstract {
-    
-    private Class<?>[] parameterTypes;
-
-    public TypeExtractorMethodParameters(final Method method) {
-        super(method);
-        
-        parameterTypes = getMethod().getParameterTypes();
-        for(Class<?> parameterType: parameterTypes) {
-            add(parameterType);
-        }
-        
-        Type[] genericTypes = getMethod().getGenericParameterTypes();
-        for(Type genericType: genericTypes) {
-            addParameterizedTypes(genericTypes);
-        }
-    }
-
-    public Class<?>[] getParameterTypes() {
-        return parameterTypes;
-    }
-    
-}
-
+
+/**
+ * Helper that finds all parameter types (including generic types) for the provided {@link Method}.
+ * 
+ * <p>
+ * For example,
+ * 
+ * <pre>
+ * public class CustomerRepository {
+ *     public void filterCustomers(List&lt;Customer&gt; customerList) { ... }
+ * }
+ * </pre>
+ * <p>
+ * will find both <tt>List</tt> and <tt>Customer</tt>.
+ */
+public class TypeExtractorMethodParameters extends TypeExtractorAbstract {
+
+    private final Class<?>[] parameterTypes;
+
+    public TypeExtractorMethodParameters(final Method method) {
+        super(method);
+
+        parameterTypes = getMethod().getParameterTypes();
+        for (final Class<?> parameterType : parameterTypes) {
+            add(parameterType);
+        }
+
+        final Type[] genericTypes = getMethod().getGenericParameterTypes();
+        for (final Type genericType : genericTypes) {
+            addParameterizedTypes(genericTypes);
+        }
+    }
+
+    public Class<?>[] getParameterTypes() {
+        return parameterTypes;
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorMethodReturn.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorMethodReturn.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorMethodReturn.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/traverser/TypeExtractorMethodReturn.java Tue Apr 26 18:24:05 2011
@@ -17,32 +17,30 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.traverser;
 
-package org.apache.isis.core.metamodel.specloader.traverser;
-
 import java.lang.reflect.Method;
-
-/**
- * Helper that finds all return types (including generic types) for the
- * provided {@link Method}.
- * 
- * <p>
- * For example,
- * <pre>
+
+/**
+ * Helper that finds all return types (including generic types) for the provided {@link Method}.
+ * 
+ * <p>
+ * For example,
+ * 
+ * <pre>
  * public class CustomerRepository {
  *     public List&lt;Customer&gt; findCustomers( ... ) { ... }
- * }
- * </pre>
- * <p>
- * will find both <tt>List</tt> and <tt>Customer</tt>. 
- */
-public class TypeExtractorMethodReturn extends TypeExtractorAbstract implements Iterable<Class<?>>{
-    
-    public TypeExtractorMethodReturn(final Method method) {
-        super(method);
-        
-        add(method.getReturnType());
-        addParameterizedTypes(method.getGenericReturnType());
-    }
-}
-
+ * }
+ * </pre>
+ * <p>
+ * will find both <tt>List</tt> and <tt>Customer</tt>.
+ */
+public class TypeExtractorMethodReturn extends TypeExtractorAbstract implements Iterable<Class<?>> {
+
+    public TypeExtractorMethodReturn(final Method method) {
+        super(method);
+
+        add(method.getReturnType());
+        addParameterizedTypes(method.getGenericReturnType());
+    }
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelInvalidException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelInvalidException.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelInvalidException.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelInvalidException.java Tue Apr 26 18:24:05 2011
@@ -17,26 +17,25 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.validator;
 
-package org.apache.isis.core.metamodel.specloader.validator;
-
-public class MetaModelInvalidException extends IllegalStateException {
-
-	private static final long serialVersionUID = 1L;
-
-	public MetaModelInvalidException() {
-	}
-
-	public MetaModelInvalidException(String s) {
-		super(s);
-	}
-
-	public MetaModelInvalidException(Throwable cause) {
-		super(cause);
-	}
-
-	public MetaModelInvalidException(String message, Throwable cause) {
-		super(message, cause);
-	}
-
-}
+public class MetaModelInvalidException extends IllegalStateException {
+
+    private static final long serialVersionUID = 1L;
+
+    public MetaModelInvalidException() {
+    }
+
+    public MetaModelInvalidException(final String s) {
+        super(s);
+    }
+
+    public MetaModelInvalidException(final Throwable cause) {
+        super(cause);
+    }
+
+    public MetaModelInvalidException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidator.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidator.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidator.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidator.java Tue Apr 26 18:24:05 2011
@@ -17,15 +17,13 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.validator;
 
-package org.apache.isis.core.metamodel.specloader.validator;
-
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
-
-public interface MetaModelValidator extends SpecificationLoaderAware, ApplicationScopedComponent {
-	
-	public void validate() throws MetaModelInvalidException;
-	
-
-}
+
+public interface MetaModelValidator extends SpecificationLoaderAware, ApplicationScopedComponent {
+
+    public void validate() throws MetaModelInvalidException;
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,41 +17,42 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.validator;
 
-package org.apache.isis.core.metamodel.specloader.validator;
-
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
 
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-
-
-public abstract class MetaModelValidatorAbstract implements MetaModelValidator {
-
-	private SpecificationLoader specificationLoader;
-
-	//////////////////////////////////////////////////////////////////////
-	// init, shutdown
-	//////////////////////////////////////////////////////////////////////
-
-	public void init() {
-		ensureThatState(specificationLoader, is(notNullValue()));
-	}
-
-	public void shutdown() {
-	}
-
-	
-	//////////////////////////////////////////////////////////////////////
-	// Dependencies (due to *Aware)
-	//////////////////////////////////////////////////////////////////////
-
-	public SpecificationLoader getSpecificationLoader() {
-		return specificationLoader;
-	}
-	public void setSpecificationLoader(SpecificationLoader specificationLoader) {
-		this.specificationLoader = specificationLoader;
-	}
-
-}
+
+public abstract class MetaModelValidatorAbstract implements MetaModelValidator {
+
+    private SpecificationLoader specificationLoader;
+
+    // ////////////////////////////////////////////////////////////////////
+    // init, shutdown
+    // ////////////////////////////////////////////////////////////////////
+
+    @Override
+    public void init() {
+        ensureThatState(specificationLoader, is(notNullValue()));
+    }
+
+    @Override
+    public void shutdown() {
+    }
+
+    // ////////////////////////////////////////////////////////////////////
+    // Dependencies (due to *Aware)
+    // ////////////////////////////////////////////////////////////////////
+
+    public SpecificationLoader getSpecificationLoader() {
+        return specificationLoader;
+    }
+
+    @Override
+    public void setSpecificationLoader(final SpecificationLoader specificationLoader) {
+        this.specificationLoader = specificationLoader;
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java Tue Apr 26 18:24:05 2011
@@ -17,32 +17,29 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.validator;
 
-package org.apache.isis.core.metamodel.specloader.validator;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-
-
-public class MetaModelValidatorComposite extends MetaModelValidatorAbstract {
-
-	private List<MetaModelValidator> validators = new ArrayList<MetaModelValidator>();
-	
-	public void validate() throws MetaModelInvalidException {
-		for (MetaModelValidator validator : validators) {
-			validator.validate();
-		}
-	}
-	
-	
-	public void addValidator(MetaModelValidator validator) {
-		validators.add(validator);
-	}
-	
-	public List<MetaModelValidator> getValidators() {
-		return Collections.unmodifiableList(validators);
-	}
-
-
-}
+
+public class MetaModelValidatorComposite extends MetaModelValidatorAbstract {
+
+    private final List<MetaModelValidator> validators = new ArrayList<MetaModelValidator>();
+
+    @Override
+    public void validate() throws MetaModelInvalidException {
+        for (final MetaModelValidator validator : validators) {
+            validator.validate();
+        }
+    }
+
+    public void addValidator(final MetaModelValidator validator) {
+        validators.add(validator);
+    }
+
+    public List<MetaModelValidator> getValidators() {
+        return Collections.unmodifiableList(validators);
+    }
+
+}



Mime
View raw message