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 [4/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/meta...
Date Tue, 26 Apr 2011 18:24:13 GMT
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FeatureType.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FeatureType.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FeatureType.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FeatureType.java Tue Apr 26 18:24:05 2011
@@ -17,97 +17,92 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facetapi;
 
-package org.apache.isis.core.metamodel.facetapi;
-
 import java.beans.Introspector;
 import java.lang.reflect.Method;
 import java.util.List;
 
-import com.google.common.collect.ImmutableList;
-
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.core.commons.lang.NameUtils;
 import org.apache.isis.core.metamodel.facets.FacetFactory;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-
-/**
- * Enumerates the features that a particular Facet can be applied to.
- * 
- * <p>
- * TODO: should rationalize this and {@link ObjectSpecification#getResultType()}. Note though that we don't
- * distinguish value properties and reference properties (and we probably shouldn't in
- * {@link ObjectSpecification}, either).
- */
-public enum FeatureType {
-
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Enumerates the features that a particular Facet can be applied to.
+ * 
+ * <p>
+ * TODO: should rationalize this and {@link ObjectSpecification#getResultType()}. Note though that we don't distinguish
+ * value properties and reference properties (and we probably shouldn't in {@link ObjectSpecification}, either).
+ */
+public enum FeatureType {
+
     OBJECT("Object") {
         /**
          * The supplied method can be null; at any rate it will be ignored.
          */
         @Override
-        public Identifier identifierFor(Class<?> type, Method method) {
+        public Identifier identifierFor(final Class<?> type, final Method method) {
             return Identifier.classIdentifier(type);
         }
-    },
+    },
     PROPERTY("Property") {
         @Override
-        public Identifier identifierFor(Class<?> type, Method method) {
+        public Identifier identifierFor(final Class<?> type, final Method method) {
             return propertyOrCollectionIdentifierFor(type, method);
         }
-    },
+    },
     COLLECTION("Collection") {
         @Override
-        public Identifier identifierFor(Class<?> type, Method method) {
+        public Identifier identifierFor(final Class<?> type, final Method method) {
             return propertyOrCollectionIdentifierFor(type, method);
         }
-    },
+    },
     ACTION("Action") {
         @Override
-        public Identifier identifierFor(Class<?> type, Method method) {
+        public Identifier identifierFor(final Class<?> type, final Method method) {
             final String fullMethodName = method.getName();
             final Class<?>[] parameterTypes = method.getParameterTypes();
             return Identifier.actionIdentifier(type.getName(), fullMethodName, parameterTypes);
         }
-    },
+    },
     ACTION_PARAMETER("Parameter") {
         /**
          * Always returns <tt>null</tt>.
          */
         @Override
-        public Identifier identifierFor(Class<?> type, Method method) {
+        public Identifier identifierFor(final Class<?> type, final Method method) {
             return null;
         }
-    };
-
-    public final static List<FeatureType> COLLECTIONS_ONLY = ImmutableList.of( COLLECTION );
-    public final static List<FeatureType> ACTIONS_ONLY = ImmutableList.of( ACTION );
-    public final static List<FeatureType> PARAMETERS_ONLY = ImmutableList.of( ACTION_PARAMETER );
-    public final static List<FeatureType> PROPERTIES_ONLY = ImmutableList.of( PROPERTY );
-    public final static List<FeatureType> OBJECTS_ONLY = ImmutableList.of( OBJECT );
-    public final static List<FeatureType> MEMBERS = ImmutableList.of( PROPERTY,
-            COLLECTION, ACTION );
-    
+    };
+
+    public final static List<FeatureType> COLLECTIONS_ONLY = ImmutableList.of(COLLECTION);
+    public final static List<FeatureType> ACTIONS_ONLY = ImmutableList.of(ACTION);
+    public final static List<FeatureType> PARAMETERS_ONLY = ImmutableList.of(ACTION_PARAMETER);
+    public final static List<FeatureType> PROPERTIES_ONLY = ImmutableList.of(PROPERTY);
+    public final static List<FeatureType> OBJECTS_ONLY = ImmutableList.of(OBJECT);
+    public final static List<FeatureType> MEMBERS = ImmutableList.of(PROPERTY, COLLECTION, ACTION);
+
     /**
      * Use of this is discouraged; instead use multiple {@link FacetFactory}s for different features.
      */
-    public final static List<FeatureType> EVERYTHING_BUT_PARAMETERS = ImmutableList.of( OBJECT, PROPERTY,
-            COLLECTION, ACTION );
+    public final static List<FeatureType> EVERYTHING_BUT_PARAMETERS = ImmutableList.of(OBJECT, PROPERTY, COLLECTION,
+        ACTION);
     /**
      * Use of this is discouraged; instead use multiple {@link FacetFactory}s for different features.
      */
-    public final static List<FeatureType> EVERYTHING = ImmutableList.of(OBJECT, PROPERTY, COLLECTION,
-            ACTION, ACTION_PARAMETER);
-
+    public final static List<FeatureType> EVERYTHING = ImmutableList.of(OBJECT, PROPERTY, COLLECTION, ACTION,
+        ACTION_PARAMETER);
+
     private final String name;
-
-    private FeatureType(final String name) {
-        this.name = name;
-    }
 
+    private FeatureType(final String name) {
+        this.name = name;
+    }
 
-    private static Identifier propertyOrCollectionIdentifierFor(Class<?> type, Method method) {
+    private static Identifier propertyOrCollectionIdentifierFor(final Class<?> type, final Method method) {
         final String capitalizedName = NameUtils.javaBaseName(method.getName());
         final String beanName = Introspector.decapitalize(capitalizedName);
         return Identifier.propertyOrCollectionIdentifier(type.getName(), beanName);
@@ -116,12 +111,15 @@ public enum FeatureType {
     public boolean isProperty() {
         return this == PROPERTY;
     }
+
     public boolean isCollection() {
         return this == COLLECTION;
     }
+
     public boolean isAction() {
         return this == ACTION;
     }
+
     public boolean isActionParameter() {
         return this == ACTION_PARAMETER;
     }
@@ -132,12 +130,12 @@ public enum FeatureType {
     public boolean isPropertyOrCollection() {
         return isProperty() || isCollection();
     }
-    
+
     public abstract Identifier identifierFor(Class<?> type, Method method);
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-}
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/IdentifiedHolder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/IdentifiedHolder.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/IdentifiedHolder.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/IdentifiedHolder.java Tue Apr 26 18:24:05 2011
@@ -17,17 +17,15 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facetapi;
 
-package org.apache.isis.core.metamodel.facetapi;
-
 import org.apache.isis.applib.Identifier;
-
-public interface IdentifiedHolder extends FacetHolder {
-
-    /**
-     * Identifier of this feature.
-     */
-    Identifier getIdentifier();
-
-
-}
+
+public interface IdentifiedHolder extends FacetHolder {
+
+    /**
+     * Identifier of this feature.
+     */
+    Identifier getIdentifier();
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MethodRemover.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MethodRemover.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MethodRemover.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MethodRemover.java Tue Apr 26 18:24:05 2011
@@ -17,47 +17,40 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facetapi;
 
-package org.apache.isis.core.metamodel.facetapi;
-
 import java.lang.reflect.Method;
 import java.util.List;
 
 import org.apache.isis.core.metamodel.methodutils.MethodScope;
 
-
-
-/**
- * Removes the methods from further processing by subsequent {@link Facet}s.
- */
-public interface MethodRemover {
-
-    /**
-     * Locate all methods (that the implementation should somehow know about) that match the criteria and
-     * remove them from the implementation's list so that they are not considered for subsequent scans.
-     * 
-     * @param methodScope
-     *            - whether looking for <tt>static</tt> (class) or instance-level methods.
-     * @return any methods that were removed.
-     */
-    List<Method> removeMethods(
-            final MethodScope methodScope,
-            final String prefix,
-            final Class<?> returnType,
-            final boolean canBeVoid,
-            final int paramCount);
-
-    /**
-     * Locate all methods (that the implementation should somehow know about) that match the criteria and
-     * remove them from the implementation's list so that they are not considered for subsequent scans.
-     * 
-     * @param forClass
-     *            - if <tt>true</tt>, then looking for <tt>static</tt> methods (otherwise instance methods).
-     */
-    void removeMethod(MethodScope methodScope, String methodName, Class<?> returnType, Class<?>[] parameterTypes);
-
-    void removeMethod(Method method);
-
-    void removeMethods(List<Method> methods);
-
-}
+/**
+ * Removes the methods from further processing by subsequent {@link Facet}s.
+ */
+public interface MethodRemover {
+
+    /**
+     * Locate all methods (that the implementation should somehow know about) that match the criteria and remove them
+     * from the implementation's list so that they are not considered for subsequent scans.
+     * 
+     * @param methodScope
+     *            - whether looking for <tt>static</tt> (class) or instance-level methods.
+     * @return any methods that were removed.
+     */
+    List<Method> removeMethods(final MethodScope methodScope, final String prefix, final Class<?> returnType,
+        final boolean canBeVoid, final int paramCount);
+
+    /**
+     * Locate all methods (that the implementation should somehow know about) that match the criteria and remove them
+     * from the implementation's list so that they are not considered for subsequent scans.
+     * 
+     * @param forClass
+     *            - if <tt>true</tt>, then looking for <tt>static</tt> methods (otherwise instance methods).
+     */
+    void removeMethod(MethodScope methodScope, String methodName, Class<?> returnType, Class<?>[] parameterTypes);
+
+    void removeMethod(Method method);
+
+    void removeMethods(List<Method> methods);
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MultiTypedFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MultiTypedFacet.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MultiTypedFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MultiTypedFacet.java Tue Apr 26 18:24:05 2011
@@ -17,25 +17,22 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facetapi;
 
-package org.apache.isis.core.metamodel.facetapi;
+/**
+ * A Class that provides multiple facet implementations, either directly or through a delegate.
+ * 
+ * <p>
+ * The client of this interface should use {@link #getFacet(Class)} to obtain the facet implementation for each of the
+ * {@link #facetTypes() facets types}.
+ */
+public interface MultiTypedFacet extends Facet {
+
+    /**
+     * All of the facet types either implemented or available by this facet implementation.
+     * 
+     */
+    public Class<? extends Facet>[] facetTypes();
 
-
-/**
- * A Class that provides multiple facet implementations, either directly or through a delegate.
- * 
- * <p>
- * The client of this interface should use {@link #getFacet(Class)} to obtain the facet implementation for
- * each of the {@link #facetTypes() facets types}.
- */
-public interface MultiTypedFacet extends Facet {
-
-    /**
-     * All of the facet types either implemented or available by this facet implementation.
-     * 
-     */
-    public Class<? extends Facet>[] facetTypes();
-
-    public <T extends Facet> T getFacet(Class<T> facet);
-}
-
+    public <T extends Facet> T getFacet(Class<T> facet);
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecorator.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecorator.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecorator.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecorator.java Tue Apr 26 18:24:05 2011
@@ -17,28 +17,25 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.facetdecorator;
 
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 
-
 public interface FacetDecorator {
 
-	/**
-	 * If applicable, replace the provided {@link Facet} with a decorating {@link Facet} that should
-	 * be held by the provided {@link FacetHolder required holder}.
-	 * 
-	 * <p>
-	 * @return the decorating {@link Facet}, or <tt>null</tt> if this decoration does not apply to this Facet.
-	 */
+    /**
+     * If applicable, replace the provided {@link Facet} with a decorating {@link Facet} that should be held by the
+     * provided {@link FacetHolder required holder}.
+     * 
+     * <p>
+     * 
+     * @return the decorating {@link Facet}, or <tt>null</tt> if this decoration does not apply to this Facet.
+     */
     Facet decorate(Facet facet, FacetHolder requiredHolder);
 
     Class<? extends Facet>[] getFacetTypes();
-    
-	String getFacetTypeNames();
 
+    String getFacetTypeNames();
 
 }
-

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecoratorAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecoratorAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecoratorAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecoratorAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,17 +17,16 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.facetdecorator;
 
 import org.apache.isis.core.metamodel.facetapi.Facet;
 
-
 public abstract class FacetDecoratorAbstract implements FacetDecorator {
-    
-	public String getFacetTypeNames() {
-		Class<? extends Facet>[] decoratorFacetTypes = getFacetTypes();
-		StringBuilder buf = new StringBuilder();
+
+    @Override
+    public String getFacetTypeNames() {
+        final Class<? extends Facet>[] decoratorFacetTypes = getFacetTypes();
+        final StringBuilder buf = new StringBuilder();
         for (int i = 0; i < decoratorFacetTypes.length; i++) {
             if (i > 0) {
                 buf.append(", ");
@@ -35,7 +34,6 @@ public abstract class FacetDecoratorAbst
             buf.append(decoratorFacetTypes[i].getName());
         }
         return buf.toString();
-	}
+    }
 
 }
-

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecoratorSet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecoratorSet.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecoratorSet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/FacetDecoratorSet.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.facetdecorator;
 
 import java.text.MessageFormat;
@@ -41,163 +40,144 @@ import org.apache.isis.core.metamodel.sp
 
 public class FacetDecoratorSet implements ApplicationScopedComponent {
 
-	private final Map<Class<? extends Facet>, List<FacetDecorator>> facetDecoratorByFacetType = new HashMap<Class<? extends Facet>, List<FacetDecorator>>();
-	private final Set<FacetDecorator> facetDecoratorSet = new LinkedHashSet<FacetDecorator>();
-
-	// ////////////////////////////////////////////////////////////
-	// init, shutdown
-	// ////////////////////////////////////////////////////////////
+    private final Map<Class<? extends Facet>, List<FacetDecorator>> facetDecoratorByFacetType =
+        new HashMap<Class<? extends Facet>, List<FacetDecorator>>();
+    private final Set<FacetDecorator> facetDecoratorSet = new LinkedHashSet<FacetDecorator>();
+
+    // ////////////////////////////////////////////////////////////
+    // init, shutdown
+    // ////////////////////////////////////////////////////////////
 
-	@Override
+    @Override
     public void init() {
-	}
+    }
 
-	@Override
+    @Override
     public void shutdown() {
-	}
+    }
+
+    // ////////////////////////////////////////////////////////////
+    // add, get, isEmpty
+    // ////////////////////////////////////////////////////////////
+
+    public void add(final FacetDecorator decorator) {
+        final Class<? extends Facet>[] decoratedFacetTypes = decorator.getFacetTypes();
+        for (final Class<? extends Facet> decoratedFacetType : decoratedFacetTypes) {
+            getFacetDecoratorList(decoratedFacetType).add(decorator);
+            facetDecoratorSet.add(decorator);
+        }
+    }
+
+    private List<FacetDecorator> getFacetDecoratorList(final Class<? extends Facet> decoratedFacetType) {
+        List<FacetDecorator> facetDecoratorList = facetDecoratorByFacetType.get(decoratedFacetType);
+        if (facetDecoratorList == null) {
+            facetDecoratorList = new ArrayList<FacetDecorator>();
+            facetDecoratorByFacetType.put(decoratedFacetType, facetDecoratorList);
+        }
+        return facetDecoratorList;
+    }
+
+    public void add(final List<FacetDecorator> decorators) {
+        for (final FacetDecorator decorator : decorators) {
+            add(decorator);
+        }
+    }
+
+    public Set<FacetDecorator> getFacetDecorators() {
+        return Collections.unmodifiableSet(facetDecoratorSet);
+    }
+
+    public boolean isEmpty() {
+        return facetDecoratorByFacetType.isEmpty();
+    }
 
-	// ////////////////////////////////////////////////////////////
-	// add, get, isEmpty
-	// ////////////////////////////////////////////////////////////
-
-	public void add(final FacetDecorator decorator) {
-		final Class<? extends Facet>[] decoratedFacetTypes = decorator
-				.getFacetTypes();
-		for (int i = 0; i < decoratedFacetTypes.length; i++) {
-			Class<? extends Facet> decoratedFacetType = decoratedFacetTypes[i];
-			getFacetDecoratorList(decoratedFacetType).add(decorator);
-			facetDecoratorSet.add(decorator);
-		}
-	}
-
-	private List<FacetDecorator> getFacetDecoratorList(
-			Class<? extends Facet> decoratedFacetType) {
-		List<FacetDecorator> facetDecoratorList = facetDecoratorByFacetType
-				.get(decoratedFacetType);
-		if (facetDecoratorList == null) {
-			facetDecoratorList = new ArrayList<FacetDecorator>();
-			facetDecoratorByFacetType.put(decoratedFacetType,
-					facetDecoratorList);
-		}
-		return facetDecoratorList;
-	}
-
-	public void add(final List<FacetDecorator> decorators) {
-		for (FacetDecorator decorator : decorators) {
-			add(decorator);
-		}
-	}
-
-	public Set<FacetDecorator> getFacetDecorators() {
-		return Collections.unmodifiableSet(facetDecoratorSet);
-	}
-
-	public boolean isEmpty() {
-		return facetDecoratorByFacetType.isEmpty();
-	}
-
-	// ////////////////////////////////////////////////////////////
-	// decorate
-	// ////////////////////////////////////////////////////////////
+    // ////////////////////////////////////////////////////////////
+    // decorate
+    // ////////////////////////////////////////////////////////////
 
     /**
      * @param holder
      */
-    public void decorate(ObjectSpecification holder) {
+    public void decorate(final ObjectSpecification holder) {
         decorateAllFacets(holder);
-        for (ObjectAssociation objectAssociation : holder.getAssociations()) {
+        for (final ObjectAssociation objectAssociation : holder.getAssociations()) {
             this.decorateAllFacets(objectAssociation);
         }
-        for (ObjectAction objectAction : holder.getObjectActionsAll()) {
+        for (final ObjectAction objectAction : holder.getObjectActionsAll()) {
             decorateAllFacets(objectAction);
             final List<ObjectActionParameter> parameters = objectAction.getParameters();
-            for (ObjectActionParameter parameter : parameters) {
+            for (final ObjectActionParameter parameter : parameters) {
                 this.decorateAllFacets(parameter);
             }
         }
     }
 
-	private void decorateAllFacets(final FacetHolder holder) {
-		if (isEmpty()) {
-			return;
-		}
-		final Class<? extends Facet>[] facetTypes = holder.getFacetTypes();
-		for (int i = 0; i < facetTypes.length; i++) {
-			final Facet facet = holder.getFacet(facetTypes[i]);
-			decorateFacet(facet, holder);
-		}
-	}
-
-	/**
-	 * REVIEW: the design is a little clumsy here.  We want to decorate the
-	 * provided {@link Facet}, but its owning {@link FacetHolder holder} turns
-	 * out to be a runtime peer (eg <tt>JavaAction</tt>) rather than the
-	 * metamodel (eg {@link ObjectAction}). Since we want to decorate the
-	 * {@link ObjectAction}, we have to pass it through.
-	 */
-	private void decorateFacet(final Facet facet, FacetHolder requiredHolder) {
-		Class<? extends Facet> facetType = facet.facetType();
-		final Class<? extends Facet> cls = facetType;
-		final List<FacetDecorator> decoratorList = facetDecoratorByFacetType
-				.get(cls);
-		if (decoratorList == null) {
-			return;
-		}
-		for (FacetDecorator facetDecorator : decoratorList) {
-			Facet decoratingFacet = facetDecorator.decorate(facet, requiredHolder);
-			if (decoratingFacet == null) {
-				continue;
-			}
-			ensureDecoratorMetContract(facetDecorator, decoratingFacet,
-					facetType, requiredHolder);
-		}
-	}
-
-	private static void ensureDecoratorMetContract(FacetDecorator facetDecorator,
-			Facet decoratingFacet, Class<? extends Facet> facetType,
-			FacetHolder originalFacetHolder) {
-		if (decoratingFacet.facetType() != facetType) {
-			throw new MetaModelException(
-					MessageFormat
-							.format(
-									"Problem with facet decorator '{0}'; inconsistent decorating facetType() for {1}; was {2} but expectected facetType() of {3}",
-									facetDecorator.getClass().getName(),
-									decoratingFacet.getClass().getName(),
-									decoratingFacet.facetType().getName(),
-									facetType.getName()));
-		}
-		Facet facetForFacetType = originalFacetHolder.getFacet(decoratingFacet
-				.facetType());
-		if (facetForFacetType != decoratingFacet) {
-			throw new MetaModelException(
-					MessageFormat
-							.format(
-									"Problem with facet decorator '{0}'; has not replaced original facet for facetType() of {1}",
-									facetDecorator.getClass().getName(),
-									facetType.getName()));
-		}
-	}
-
-	// ////////////////////////////////////////////////////////////
-	// debugging
-	// ////////////////////////////////////////////////////////////
-
-	public void debugData(final DebugBuilder str) {
-		str.appendTitle("Facet decorators");
-		str.indent();
-		Set<Class<? extends Facet>> facetTypes = facetDecoratorByFacetType
-				.keySet();
-		if (facetTypes.size() == 0) {
-			str.append("none");
-		} else {
-			for (final Class<? extends Facet> cls : facetTypes) {
-				str.appendln(cls.getName(), facetDecoratorByFacetType.get(cls));
-			}
-		}
-		str.unindent();
-	}
+    private void decorateAllFacets(final FacetHolder holder) {
+        if (isEmpty()) {
+            return;
+        }
+        final Class<? extends Facet>[] facetTypes = holder.getFacetTypes();
+        for (final Class<? extends Facet> facetType : facetTypes) {
+            final Facet facet = holder.getFacet(facetType);
+            decorateFacet(facet, holder);
+        }
+    }
 
+    /**
+     * REVIEW: the design is a little clumsy here. We want to decorate the provided {@link Facet}, but its owning
+     * {@link FacetHolder holder} turns out to be a runtime peer (eg <tt>JavaAction</tt>) rather than the metamodel (eg
+     * {@link ObjectAction}). Since we want to decorate the {@link ObjectAction}, we have to pass it through.
+     */
+    private void decorateFacet(final Facet facet, final FacetHolder requiredHolder) {
+        final Class<? extends Facet> facetType = facet.facetType();
+        final Class<? extends Facet> cls = facetType;
+        final List<FacetDecorator> decoratorList = facetDecoratorByFacetType.get(cls);
+        if (decoratorList == null) {
+            return;
+        }
+        for (final FacetDecorator facetDecorator : decoratorList) {
+            final Facet decoratingFacet = facetDecorator.decorate(facet, requiredHolder);
+            if (decoratingFacet == null) {
+                continue;
+            }
+            ensureDecoratorMetContract(facetDecorator, decoratingFacet, facetType, requiredHolder);
+        }
+    }
 
+    private static void ensureDecoratorMetContract(final FacetDecorator facetDecorator, final Facet decoratingFacet,
+        final Class<? extends Facet> facetType, final FacetHolder originalFacetHolder) {
+        if (decoratingFacet.facetType() != facetType) {
+            throw new MetaModelException(
+                MessageFormat
+                    .format(
+                        "Problem with facet decorator '{0}'; inconsistent decorating facetType() for {1}; was {2} but expectected facetType() of {3}",
+                        facetDecorator.getClass().getName(), decoratingFacet.getClass().getName(), decoratingFacet
+                            .facetType().getName(), facetType.getName()));
+        }
+        final Facet facetForFacetType = originalFacetHolder.getFacet(decoratingFacet.facetType());
+        if (facetForFacetType != decoratingFacet) {
+            throw new MetaModelException(MessageFormat.format(
+                "Problem with facet decorator '{0}'; has not replaced original facet for facetType() of {1}",
+                facetDecorator.getClass().getName(), facetType.getName()));
+        }
+    }
 
-}
+    // ////////////////////////////////////////////////////////////
+    // debugging
+    // ////////////////////////////////////////////////////////////
+
+    public void debugData(final DebugBuilder str) {
+        str.appendTitle("Facet decorators");
+        str.indent();
+        final Set<Class<? extends Facet>> facetTypes = facetDecoratorByFacetType.keySet();
+        if (facetTypes.size() == 0) {
+            str.append("none");
+        } else {
+            for (final Class<? extends Facet> cls : facetTypes) {
+                str.appendln(cls.getName(), facetDecoratorByFacetType.get(cls));
+            }
+        }
+        str.unindent();
+    }
 
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/AnnotationBasedFacetFactoryAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/AnnotationBasedFacetFactoryAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/AnnotationBasedFacetFactoryAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/AnnotationBasedFacetFactoryAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,228 +17,221 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.util.List;
 
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
 
-
-
-public abstract class AnnotationBasedFacetFactoryAbstract extends FacetFactoryAbstract {
-
-    public AnnotationBasedFacetFactoryAbstract(final List<FeatureType> featureTypes) {
-        super(featureTypes);
-    }
-
-    /**
-     * Always returns <tt>false</tt>; {@link FacetFactory}s that look for annotations won't recognize methods
-     * with prefixes.
-     */
-    public boolean recognizes(final Method method) {
-        return false;
-    }
-
-    /**
-     * For convenience of the several annotations that apply only to {@link String}s.
-     */
-    protected boolean isString(final Class<?> cls) {
-        return cls.equals(String.class);
-    }
-
-    /**
-     * Searches for annotation on provided class, and if not found for the superclass.
-     *
-     * <p>
-     * Added to allow bytecode-mangling libraries such as CGLIB to be supported.
-     */
-	protected static <T extends Annotation> T getAnnotation(final Class<?> cls, Class<T> annotationClass) {
-		if (cls == null) {
-			return null;
-		}
-		T annotation = cls.getAnnotation(annotationClass);
-		if (annotation != null) {
-			return annotation;
-		}
-
-		// search superclasses
-		Class<?> superclass = cls.getSuperclass();
-		if (superclass != null) {
-			try {
-				T annotationFromSuperclass = getAnnotation(superclass, annotationClass);
-				if (annotationFromSuperclass != null) {
-					return annotationFromSuperclass;
-				}
-			} catch (SecurityException e) {
-				// fall through
-			}
-		}
-
-		// search implemented interfaces
-		Class<?>[] interfaces = cls.getInterfaces();
-		for(Class<?> iface: interfaces) {
-			T annotationFromInterface = getAnnotation(iface, annotationClass);
-			if (annotationFromInterface != null) {
-				return annotationFromInterface;
-			}
-		}
-		return null;
-	}
-
-
-    /**
-     * Searches for annotation on provided method, and if not found for any inherited methods up
-     * from the superclass.
-     *
-     * <p>
-     * Added to allow bytecode-mangling libraries such as CGLIB to be supported.
-     */
-	protected static <T extends Annotation> T getAnnotation(final Method method, Class<T> annotationClass) {
-		if (method == null) {
-			return null;
-		}
-		T annotation = method.getAnnotation(annotationClass);
-		if (annotation != null) {
-			return annotation;
-		}
-
-		Class<?> methodDeclaringClass = method.getDeclaringClass();
-
-		// search superclasses
-		Class<?> superclass = methodDeclaringClass.getSuperclass();
-		if (superclass != null) {
-			try {
-				Method parentClassMethod = superclass.getMethod(method.getName(), method.getParameterTypes());
-				return getAnnotation(parentClassMethod, annotationClass);
-			} catch (SecurityException e) {
-				// fall through
-			} catch (NoSuchMethodException e) {
-				// fall through
-			}
-		}
-
-		// search implemented interfaces
-		Class<?>[] interfaces = methodDeclaringClass.getInterfaces();
-		for(Class<?> iface: interfaces) {
-			try {
-				Method ifaceMethod = iface.getMethod(method.getName(), method.getParameterTypes());
-				return getAnnotation(ifaceMethod, annotationClass);
-			} catch (SecurityException e) {
-				// fall through
-			} catch (NoSuchMethodException e) {
-				// fall through
-			}
-		}
-		return null;
-	}
-
-    /**
-     * Searches for annotation on provided method, and if not found for any inherited methods up
-     * from the superclass.
-     *
-     * <p>
-     * Added to allow bytecode-mangling libraries such as CGLIB to be supported.
-     */
-	protected static boolean isAnnotationPresent(final Method method, Class<? extends Annotation> annotationClass) {
-		if (method == null) {
-			return false;
-		}
-		boolean present = method.isAnnotationPresent(annotationClass);
-		if (present) {
-			return true;
-		}
-
-		Class<?> methodDeclaringClass = method.getDeclaringClass();
-
-		// search superclasses
-		Class<?> superclass = methodDeclaringClass.getSuperclass();
-		if (superclass != null) {
-			try {
-				Method parentClassMethod = superclass.getMethod(method.getName(), method.getParameterTypes());
-				return isAnnotationPresent(parentClassMethod, annotationClass);
-			} catch (SecurityException e) {
-				// fall through
-			} catch (NoSuchMethodException e) {
-				// fall through
-			}
-		}
-
-		// search implemented interfaces
-		Class<?>[] interfaces = methodDeclaringClass.getInterfaces();
-		for(Class<?> iface: interfaces) {
-			try {
-				Method ifaceMethod = iface.getMethod(method.getName(), method.getParameterTypes());
-				return isAnnotationPresent(ifaceMethod, annotationClass);
-			} catch (SecurityException e) {
-				// fall through
-			} catch (NoSuchMethodException e) {
-				// fall through
-			}
-		}
-		return false;
-	}
-
-
-    /**
-     * Searches for parameter annotations on provided method, and if not found for any inherited methods up
-     * from the superclass.
-     *
-     * <p>
-     * Added to allow bytecode-mangling libraries such as CGLIB to be supported.
-     */
-	protected static Annotation[][] getParameterAnnotations(final Method method) {
-		if (method == null) {
-			return new Annotation[0][0];
-		}
-		Annotation[][] allParamAnnotations = method.getParameterAnnotations();
-
-		boolean foundAnnotationsForAnyParameter = false;
-		for(Annotation[] singleParamAnnotations: allParamAnnotations) {
-			if (singleParamAnnotations.length > 0) {
-				foundAnnotationsForAnyParameter = true;
-				break;
-			}
-		}
-		if (foundAnnotationsForAnyParameter) {
-			return allParamAnnotations;
-		}
-
-		Class<?> methodDeclaringClass = method.getDeclaringClass();
-
-		// search superclasses
-		Class<?> superclass = methodDeclaringClass.getSuperclass();
-		if (superclass != null) {
-			try {
-				Method parentClassMethod = superclass.getMethod(method.getName(), method.getParameterTypes());
-				return getParameterAnnotations(parentClassMethod);
-			} catch (SecurityException e) {
-				// fall through
-			} catch (NoSuchMethodException e) {
-				// fall through
-			}
-		}
-
-		// search implemented interfaces
-		Class<?>[] interfaces = methodDeclaringClass.getInterfaces();
-		for(Class<?> iface: interfaces) {
-			try {
-				Method ifaceMethod = iface.getMethod(method.getName(), method.getParameterTypes());
-				return getParameterAnnotations(ifaceMethod);
-			} catch (SecurityException e) {
-				// fall through
-			} catch (NoSuchMethodException e) {
-				// fall through
-			}
-		}
-
-		return noParamAnnotationsFor(method);
-	}
-
-	private static Annotation[][] noParamAnnotationsFor(final Method method) {
-	    return new Annotation[method.getParameterTypes().length][0];
-	}
-
-}
+public abstract class AnnotationBasedFacetFactoryAbstract extends FacetFactoryAbstract {
+
+    public AnnotationBasedFacetFactoryAbstract(final List<FeatureType> featureTypes) {
+        super(featureTypes);
+    }
+
+    /**
+     * Always returns <tt>false</tt>; {@link FacetFactory}s that look for annotations won't recognize methods with
+     * prefixes.
+     */
+    public boolean recognizes(final Method method) {
+        return false;
+    }
+
+    /**
+     * For convenience of the several annotations that apply only to {@link String}s.
+     */
+    protected boolean isString(final Class<?> cls) {
+        return cls.equals(String.class);
+    }
+
+    /**
+     * Searches for annotation on provided class, and if not found for the superclass.
+     * 
+     * <p>
+     * Added to allow bytecode-mangling libraries such as CGLIB to be supported.
+     */
+    protected static <T extends Annotation> T getAnnotation(final Class<?> cls, final Class<T> annotationClass) {
+        if (cls == null) {
+            return null;
+        }
+        final T annotation = cls.getAnnotation(annotationClass);
+        if (annotation != null) {
+            return annotation;
+        }
+
+        // search superclasses
+        final Class<?> superclass = cls.getSuperclass();
+        if (superclass != null) {
+            try {
+                final T annotationFromSuperclass = getAnnotation(superclass, annotationClass);
+                if (annotationFromSuperclass != null) {
+                    return annotationFromSuperclass;
+                }
+            } catch (final SecurityException e) {
+                // fall through
+            }
+        }
+
+        // search implemented interfaces
+        final Class<?>[] interfaces = cls.getInterfaces();
+        for (final Class<?> iface : interfaces) {
+            final T annotationFromInterface = getAnnotation(iface, annotationClass);
+            if (annotationFromInterface != null) {
+                return annotationFromInterface;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Searches for annotation on provided method, and if not found for any inherited methods up from the superclass.
+     * 
+     * <p>
+     * Added to allow bytecode-mangling libraries such as CGLIB to be supported.
+     */
+    protected static <T extends Annotation> T getAnnotation(final Method method, final Class<T> annotationClass) {
+        if (method == null) {
+            return null;
+        }
+        final T annotation = method.getAnnotation(annotationClass);
+        if (annotation != null) {
+            return annotation;
+        }
+
+        final Class<?> methodDeclaringClass = method.getDeclaringClass();
+
+        // search superclasses
+        final Class<?> superclass = methodDeclaringClass.getSuperclass();
+        if (superclass != null) {
+            try {
+                final Method parentClassMethod = superclass.getMethod(method.getName(), method.getParameterTypes());
+                return getAnnotation(parentClassMethod, annotationClass);
+            } catch (final SecurityException e) {
+                // fall through
+            } catch (final NoSuchMethodException e) {
+                // fall through
+            }
+        }
+
+        // search implemented interfaces
+        final Class<?>[] interfaces = methodDeclaringClass.getInterfaces();
+        for (final Class<?> iface : interfaces) {
+            try {
+                final Method ifaceMethod = iface.getMethod(method.getName(), method.getParameterTypes());
+                return getAnnotation(ifaceMethod, annotationClass);
+            } catch (final SecurityException e) {
+                // fall through
+            } catch (final NoSuchMethodException e) {
+                // fall through
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Searches for annotation on provided method, and if not found for any inherited methods up from the superclass.
+     * 
+     * <p>
+     * Added to allow bytecode-mangling libraries such as CGLIB to be supported.
+     */
+    protected static boolean isAnnotationPresent(final Method method, final Class<? extends Annotation> annotationClass) {
+        if (method == null) {
+            return false;
+        }
+        final boolean present = method.isAnnotationPresent(annotationClass);
+        if (present) {
+            return true;
+        }
+
+        final Class<?> methodDeclaringClass = method.getDeclaringClass();
+
+        // search superclasses
+        final Class<?> superclass = methodDeclaringClass.getSuperclass();
+        if (superclass != null) {
+            try {
+                final Method parentClassMethod = superclass.getMethod(method.getName(), method.getParameterTypes());
+                return isAnnotationPresent(parentClassMethod, annotationClass);
+            } catch (final SecurityException e) {
+                // fall through
+            } catch (final NoSuchMethodException e) {
+                // fall through
+            }
+        }
+
+        // search implemented interfaces
+        final Class<?>[] interfaces = methodDeclaringClass.getInterfaces();
+        for (final Class<?> iface : interfaces) {
+            try {
+                final Method ifaceMethod = iface.getMethod(method.getName(), method.getParameterTypes());
+                return isAnnotationPresent(ifaceMethod, annotationClass);
+            } catch (final SecurityException e) {
+                // fall through
+            } catch (final NoSuchMethodException e) {
+                // fall through
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Searches for parameter annotations on provided method, and if not found for any inherited methods up from the
+     * superclass.
+     * 
+     * <p>
+     * Added to allow bytecode-mangling libraries such as CGLIB to be supported.
+     */
+    protected static Annotation[][] getParameterAnnotations(final Method method) {
+        if (method == null) {
+            return new Annotation[0][0];
+        }
+        final Annotation[][] allParamAnnotations = method.getParameterAnnotations();
+
+        boolean foundAnnotationsForAnyParameter = false;
+        for (final Annotation[] singleParamAnnotations : allParamAnnotations) {
+            if (singleParamAnnotations.length > 0) {
+                foundAnnotationsForAnyParameter = true;
+                break;
+            }
+        }
+        if (foundAnnotationsForAnyParameter) {
+            return allParamAnnotations;
+        }
+
+        final Class<?> methodDeclaringClass = method.getDeclaringClass();
+
+        // search superclasses
+        final Class<?> superclass = methodDeclaringClass.getSuperclass();
+        if (superclass != null) {
+            try {
+                final Method parentClassMethod = superclass.getMethod(method.getName(), method.getParameterTypes());
+                return getParameterAnnotations(parentClassMethod);
+            } catch (final SecurityException e) {
+                // fall through
+            } catch (final NoSuchMethodException e) {
+                // fall through
+            }
+        }
+
+        // search implemented interfaces
+        final Class<?>[] interfaces = methodDeclaringClass.getInterfaces();
+        for (final Class<?> iface : interfaces) {
+            try {
+                final Method ifaceMethod = iface.getMethod(method.getName(), method.getParameterTypes());
+                return getParameterAnnotations(ifaceMethod);
+            } catch (final SecurityException e) {
+                // fall through
+            } catch (final NoSuchMethodException e) {
+                // fall through
+            }
+        }
+
+        return noParamAnnotationsFor(method);
+    }
+
+    private static Annotation[][] noParamAnnotationsFor(final Method method) {
+        return new Annotation[method.getParameterTypes().length][0];
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/Enumeration.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/Enumeration.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/Enumeration.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/Enumeration.java Tue Apr 26 18:24:05 2011
@@ -17,16 +17,14 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
-public interface Enumeration {
-
-    public abstract int getNum();
-
-    public abstract String getNameInCode();
-
-    public abstract String getFriendlyName();
-
-}
-
+public interface Enumeration {
+
+    public abstract int getNum();
+
+    public abstract String getNameInCode();
+
+    public abstract String getFriendlyName();
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/EnumerationAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/EnumerationAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/EnumerationAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/EnumerationAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,58 +17,64 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
-public abstract class EnumerationAbstract implements Enumeration {
-
-    private final int num;
-    private final String nameInCode;
-    private final String friendlyName;
-
-    protected EnumerationAbstract(final int num, final String nameInCode, final String friendlyName) {
-        this.num = num;
-        this.nameInCode = nameInCode;
-        this.friendlyName = friendlyName;
-    }
-
-    public int getNum() {
-        return num;
-    }
-
-    public String getNameInCode() {
-        return nameInCode;
-    }
-
-    public String getFriendlyName() {
-        return friendlyName;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + num;
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
-            return false;
-        EnumerationAbstract other = (EnumerationAbstract) obj;
-        if (num != other.num)
-            return false;
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return getNameInCode();
-    }
-
-}
+public abstract class EnumerationAbstract implements Enumeration {
+
+    private final int num;
+    private final String nameInCode;
+    private final String friendlyName;
+
+    protected EnumerationAbstract(final int num, final String nameInCode, final String friendlyName) {
+        this.num = num;
+        this.nameInCode = nameInCode;
+        this.friendlyName = friendlyName;
+    }
+
+    @Override
+    public int getNum() {
+        return num;
+    }
+
+    @Override
+    public String getNameInCode() {
+        return nameInCode;
+    }
+
+    @Override
+    public String getFriendlyName() {
+        return friendlyName;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + num;
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final EnumerationAbstract other = (EnumerationAbstract) obj;
+        if (num != other.num) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return getNameInCode();
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetFactory.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetFactory.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetFactory.java Tue Apr 26 18:24:05 2011
@@ -17,10 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
-
 import java.lang.reflect.Method;
 import java.util.List;
 
@@ -30,13 +28,12 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facetapi.MethodRemover;
 import org.apache.isis.core.metamodel.methodutils.MethodScope;
 
-
-public interface FacetFactory {
+public interface FacetFactory {
 
     static class AbstractProcessContext<T extends FacetHolder> {
         private final T facetHolder;
 
-        public AbstractProcessContext(T facetHolder) {
+        public AbstractProcessContext(final T facetHolder) {
             this.facetHolder = facetHolder;
         }
 
@@ -45,21 +42,20 @@ public interface FacetFactory {
         }
     }
 
+    /**
+     * The {@link FeatureType feature type}s that this facet factory can create {@link Facet}s for.
+     * 
+     * <p>
+     * Used by the Java5 Reflector's <tt>ProgrammingModel</tt> to reduce the number of {@link FacetFactory factory}s
+     * that are queried when building up the meta-model.
+     */
+    List<FeatureType> getFeatureTypes();
 
-    /**
-     * The {@link FeatureType feature type}s that this facet factory can create {@link Facet}s for.
-     * 
-     * <p>
-     * Used by the Java5 Reflector's <tt>ProgrammingModel</tt> to reduce the number of {@link FacetFactory factory}s that are
-     * queried when building up the meta-model.
-     */
-    List<FeatureType> getFeatureTypes();
-
     public static class ProcessClassContext extends AbstractProcessContext<FacetHolder> implements MethodRemover {
         private final Class<?> cls;
         private final MethodRemover methodRemover;
 
-        public ProcessClassContext(Class<?> cls, MethodRemover methodRemover, FacetHolder facetHolder) {
+        public ProcessClassContext(final Class<?> cls, final MethodRemover methodRemover, final FacetHolder facetHolder) {
             super(facetHolder);
             this.cls = cls;
             this.methodRemover = methodRemover;
@@ -70,39 +66,40 @@ public interface FacetFactory {
         }
 
         @Override
-        public void removeMethod(Method method) {
+        public void removeMethod(final Method method) {
             methodRemover.removeMethod(method);
         }
 
         @Override
-        public List<Method> removeMethods(MethodScope methodScope, String prefix, Class<?> returnType,
-            boolean canBeVoid, int paramCount) {
+        public List<Method> removeMethods(final MethodScope methodScope, final String prefix,
+            final Class<?> returnType, final boolean canBeVoid, final int paramCount) {
             return methodRemover.removeMethods(methodScope, prefix, returnType, canBeVoid, paramCount);
         }
 
         @Override
-        public void removeMethod(MethodScope methodScope, String methodName, Class<?> returnType,
-            Class<?>[] parameterTypes) {
+        public void removeMethod(final MethodScope methodScope, final String methodName, final Class<?> returnType,
+            final Class<?>[] parameterTypes) {
             methodRemover.removeMethod(methodScope, methodName, returnType, parameterTypes);
         }
 
         @Override
-        public void removeMethods(List<Method> methods) {
+        public void removeMethods(final List<Method> methods) {
             methodRemover.removeMethods(methods);
         }
     }
 
-    /**
+    /**
      * Process the class, and return the correctly setup annotation if present.
-     */
-    void process(ProcessClassContext processClassContaxt);
-
+     */
+    void process(ProcessClassContext processClassContaxt);
+
     public static class ProcessMethodContext extends AbstractProcessContext<FacetedMethod> implements MethodRemover {
         private final Class<?> cls;
         private final Method method;
         private final MethodRemover methodRemover;
 
-        public ProcessMethodContext(Class<?> cls, Method method, MethodRemover methodRemover, FacetedMethod facetedMethod) {
+        public ProcessMethodContext(final Class<?> cls, final Method method, final MethodRemover methodRemover,
+            final FacetedMethod facetedMethod) {
             super(facetedMethod);
             this.cls = cls;
             this.method = method;
@@ -118,38 +115,39 @@ public interface FacetFactory {
         }
 
         @Override
-        public List<Method> removeMethods(MethodScope methodScope, String prefix, Class<?> returnType,
-            boolean canBeVoid, int paramCount) {
+        public List<Method> removeMethods(final MethodScope methodScope, final String prefix,
+            final Class<?> returnType, final boolean canBeVoid, final int paramCount) {
             return methodRemover.removeMethods(methodScope, prefix, returnType, canBeVoid, paramCount);
         }
 
         @Override
-        public void removeMethod(MethodScope methodScope, String methodName, Class<?> returnType,
-            Class<?>[] parameterTypes) {
+        public void removeMethod(final MethodScope methodScope, final String methodName, final Class<?> returnType,
+            final Class<?>[] parameterTypes) {
             methodRemover.removeMethod(methodScope, methodName, returnType, parameterTypes);
         }
 
         @Override
-        public void removeMethod(Method method) {
+        public void removeMethod(final Method method) {
             methodRemover.removeMethod(method);
         }
 
         @Override
-        public void removeMethods(List<Method> methods) {
+        public void removeMethods(final List<Method> methods) {
             methodRemover.removeMethods(methods);
         }
     }
 
-    /**
+    /**
      * Process the method, and return the correctly setup annotation if present.
-     */
-    void process(ProcessMethodContext processMethodContext);
-
+     */
+    void process(ProcessMethodContext processMethodContext);
+
     public static class ProcessParameterContext extends AbstractProcessContext<FacetedMethodParameter> {
         private final Method method;
         private final int paramNum;
 
-        public ProcessParameterContext(Method method, int paramNum, FacetedMethodParameter facetedMethodParameter) {
+        public ProcessParameterContext(final Method method, final int paramNum,
+            final FacetedMethodParameter facetedMethodParameter) {
             super(facetedMethodParameter);
             this.method = method;
             this.paramNum = paramNum;
@@ -164,8 +162,8 @@ public interface FacetFactory {
         }
     }
 
-    /**
+    /**
      * Process the parameters of the method, and return the correctly setup annotation if present.
-     */
-    void processParams(ProcessParameterContext processParameterContext);
-}
+     */
+    void processParams(ProcessParameterContext processParameterContext);
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetFactoryAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetFactoryAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetFactoryAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetFactoryAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,61 +17,57 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
-
 import java.util.List;
 
-import com.google.common.collect.ImmutableList;
-
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
 import org.apache.isis.core.metamodel.spec.SpecificationLookup;
 import org.apache.isis.core.metamodel.spec.SpecificationLookupAware;
-
-
-public abstract class FacetFactoryAbstract implements FacetFactory, SpecificationLookupAware {
-
-    private final List<FeatureType> featureTypes;
-    
-    private SpecificationLookup specificationLookup;
-
-    public FacetFactoryAbstract(final List<FeatureType> featureTypes) {
-        this.featureTypes = ImmutableList.copyOf(featureTypes);
-    }
-
+
+import com.google.common.collect.ImmutableList;
+
+public abstract class FacetFactoryAbstract implements FacetFactory, SpecificationLookupAware {
+
+    private final List<FeatureType> featureTypes;
+
+    private SpecificationLookup specificationLookup;
+
+    public FacetFactoryAbstract(final List<FeatureType> featureTypes) {
+        this.featureTypes = ImmutableList.copyOf(featureTypes);
+    }
+
     @Override
-    public List<FeatureType> getFeatureTypes() {
-        return featureTypes;
-    }
-
+    public List<FeatureType> getFeatureTypes() {
+        return featureTypes;
+    }
+
     @Override
-    public void process(ProcessClassContext processClassContaxt) {
-    }
-
+    public void process(final ProcessClassContext processClassContaxt) {
+    }
+
     @Override
-    public void process(ProcessMethodContext processMethodContext) {
-    }
-
+    public void process(final ProcessMethodContext processMethodContext) {
+    }
+
     @Override
-    public void processParams(ProcessParameterContext processParameterContext) {
-    }
-
-    
-    //////////////////////////////////////////////////////////////////
-    // Dependencies (injected)
-    //////////////////////////////////////////////////////////////////
-    
-    protected SpecificationLookup getSpecificationLookup() {
-        return specificationLookup;
-    }
-
-    /**
-     * Injected
-     */
+    public void processParams(final ProcessParameterContext processParameterContext) {
+    }
+
+    // ////////////////////////////////////////////////////////////////
+    // Dependencies (injected)
+    // ////////////////////////////////////////////////////////////////
+
+    protected SpecificationLookup getSpecificationLookup() {
+        return specificationLookup;
+    }
+
+    /**
+     * Injected
+     */
     @Override
-    public void setSpecificationLookup(final SpecificationLookup specificationLookup) {
-        this.specificationLookup = specificationLookup;
-    }
-
-}
+    public void setSpecificationLookup(final SpecificationLookup specificationLookup) {
+        this.specificationLookup = specificationLookup;
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetedMethod.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetedMethod.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetedMethod.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetedMethod.java Tue Apr 26 18:24:05 2011
@@ -17,15 +17,12 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
 import java.lang.reflect.Method;
 import java.util.Collections;
 import java.util.List;
 
-import com.google.inject.internal.Lists;
-
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.debug.Debuggable;
@@ -33,54 +30,57 @@ import org.apache.isis.core.commons.lang
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
 import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
 
+import com.google.inject.internal.Lists;
 
 /**
  * non-final only so it can be mocked if need be.
  */
 public class FacetedMethod extends TypedHolderDefault implements IdentifiedHolder, Debuggable {
 
-    ////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////
     // Factory methods
-    ////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////
 
-    public static FacetedMethod createPropertyFacetedMethod(Class<?> declaringType, Method method) {
-        return new FacetedMethod(FeatureType.PROPERTY, declaringType, method, method.getReturnType(), emptyParameterList());
+    public static FacetedMethod createPropertyFacetedMethod(final Class<?> declaringType, final Method method) {
+        return new FacetedMethod(FeatureType.PROPERTY, declaringType, method, method.getReturnType(),
+            emptyParameterList());
     }
 
     /**
      * Principally for testing purposes.
      */
-    public static FacetedMethod createProperty(Class<?> owningClass, final String name) {
+    public static FacetedMethod createProperty(final Class<?> owningClass, final String name) {
         try {
             final Method method = owningClass.getMethod("get" + StringUtils.pascal(name));
             return FacetedMethod.createPropertyFacetedMethod(owningClass, method);
-        } catch (SecurityException e) {
+        } catch (final SecurityException e) {
             throw new RuntimeException(e);
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             throw new RuntimeException(e);
         }
     }
 
-    public static FacetedMethod createCollectionFacetedMethod(Class<?> declaringType, Method method) {
+    public static FacetedMethod createCollectionFacetedMethod(final Class<?> declaringType, final Method method) {
         return new FacetedMethod(FeatureType.COLLECTION, declaringType, method, null, emptyParameterList());
     }
 
-    public static FacetedMethod createActionFacetedMethod(Class<?> declaringType, Method method) {
-        return new FacetedMethod(FeatureType.ACTION, declaringType, method, method.getReturnType(), getParameters(method));
+    public static FacetedMethod createActionFacetedMethod(final Class<?> declaringType, final Method method) {
+        return new FacetedMethod(FeatureType.ACTION, declaringType, method, method.getReturnType(),
+            getParameters(method));
     }
 
     private static List<FacetedMethodParameter> getParameters(final Method actionMethod) {
         final Class<?>[] parameterTypes = actionMethod.getParameterTypes();
         final List<FacetedMethodParameter> actionParams = Lists.newArrayList();
-        for (Class<?> parameterType : parameterTypes) {
+        for (final Class<?> parameterType : parameterTypes) {
             actionParams.add(new FacetedMethodParameter(parameterType));
         }
         return Collections.unmodifiableList(actionParams);
     }
 
-    ////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////
     // Constructor
-    ////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////
 
     private final Class<?> owningType;
     private final Method method;
@@ -96,7 +96,8 @@ public class FacetedMethod extends Typed
         return Collections.unmodifiableList(emptyList);
     }
 
-    private FacetedMethod(final FeatureType featureType, final Class<?> declaringType, final Method method, Class<?> type, final List<FacetedMethodParameter> parameters) {
+    private FacetedMethod(final FeatureType featureType, final Class<?> declaringType, final Method method,
+        final Class<?> type, final List<FacetedMethodParameter> parameters) {
         super(featureType, type);
         this.owningType = declaringType;
         this.method = method;
@@ -105,21 +106,19 @@ public class FacetedMethod extends Typed
     }
 
     /**
-     * The {@link Class} that owns this {@link Method} (as per
-     * {@link Class#getMethods()}, returning the {@link Method}s both of this
-     * class and of its superclasses).
+     * The {@link Class} that owns this {@link Method} (as per {@link Class#getMethods()}, returning the {@link Method}s
+     * both of this class and of its superclasses).
      * 
      * <p>
-     * Note: we don't call this the 'declaring type' because {@link Class#getDeclaredMethods()}
-     * does not return methods from superclasses.
+     * Note: we don't call this the 'declaring type' because {@link Class#getDeclaredMethods()} does not return methods
+     * from superclasses.
      */
     public Class<?> getOwningType() {
         return owningType;
     }
 
     /**
-     * A {@link Method} obtained from the {@link #getOwningType() owning type}
-     * using {@link Class#getMethods()}.
+     * A {@link Method} obtained from the {@link #getOwningType() owning type} using {@link Class#getMethods()}.
      */
     public Method getMethod() {
         return method;
@@ -130,14 +129,14 @@ public class FacetedMethod extends Typed
         return identifier;
     }
 
-
-    //////////////////////////////////////////////////////////////////////
+    // ////////////////////////////////////////////////////////////////////
     // toString, debug
-    //////////////////////////////////////////////////////////////////////
+    // ////////////////////////////////////////////////////////////////////
 
     @Override
     public String toString() {
-        return getFeatureType().name() + " Peer [identifier=\"" + getIdentifier() + "\",type=" + getType().getName() + " ]";
+        return getFeatureType().name() + " Peer [identifier=\"" + getIdentifier() + "\",type=" + getType().getName()
+            + " ]";
     }
 
     @Override
@@ -146,5 +145,4 @@ public class FacetedMethod extends Typed
         // debug.appendln("Identifier", identifier.toString());
     }
 
-
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetedMethodParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetedMethodParameter.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetedMethodParameter.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/FacetedMethodParameter.java Tue Apr 26 18:24:05 2011
@@ -20,7 +20,7 @@ import org.apache.isis.core.metamodel.fa
 
 public class FacetedMethodParameter extends TypedHolderDefault {
 
-    public FacetedMethodParameter(Class<?> type) {
+    public FacetedMethodParameter(final Class<?> type) {
         super(FeatureType.ACTION_PARAMETER, type);
     }
 

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/ImperativeFacetMulti.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/ImperativeFacetMulti.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/ImperativeFacetMulti.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/ImperativeFacetMulti.java Tue Apr 26 18:24:05 2011
@@ -17,19 +17,16 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
 import java.lang.reflect.Method;
-
-public interface ImperativeFacetMulti extends ImperativeFacet {
-
-
-	/**
-	 * Associate an additional method,
-	 * to be returned from {@link ImperativeFacet#getMethods()}.
-	 * 
-	 * @param method
-	 */
-	public void addMethod(final Method method);
-}
+
+public interface ImperativeFacetMulti extends ImperativeFacet {
+
+    /**
+     * Associate an additional method, to be returned from {@link ImperativeFacet#getMethods()}.
+     * 
+     * @param method
+     */
+    public void addMethod(final Method method);
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtils.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtils.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtils.java Tue Apr 26 18:24:05 2011
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
 import java.lang.reflect.Method;
 import java.util.List;
 
@@ -28,79 +27,79 @@ import org.apache.isis.core.commons.lang
 import org.apache.isis.core.metamodel.facetapi.DecoratingFacet;
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-
-
-public final class ImperativeFacetUtils {
-
-    private ImperativeFacetUtils() {}
-
-    /**
-     * Returns the provided {@link Facet facet} as an {@link ImperativeFacet} if it either is one or if it is
-     * a {@link DecoratingFacet} that in turn wraps an {@link ImperativeFacet}.
-     * 
-     * <p>
-     * Otherwise, returns <tt>null</tt>.
-     */
-    public static ImperativeFacet getImperativeFacet(final Facet facet) {
-        if (facet instanceof ImperativeFacet) {
-            return (ImperativeFacet) facet;
-        }
-        if (facet instanceof DecoratingFacet) {
-            final DecoratingFacet<?> decoratingFacet = CastUtils.cast(facet);
-            return getImperativeFacet(decoratingFacet.getDecoratedFacet());
-        }
-        return null;
-    }
-
-    public static boolean isImperativeFacet(final Facet facet) {
-        return getImperativeFacet(facet) != null;
-    }
-
-    public static class ImperativeFacetFlags {
-        private boolean impliesResolve;
-        private boolean impliesObjectChanged;
-
-        public void apply(ImperativeFacet imperativeFacet) {
-            this.impliesResolve |= imperativeFacet.impliesResolve();
-            this.impliesObjectChanged |= imperativeFacet.impliesObjectChanged();
-        }
-
-        public boolean bothSet() {
-            return impliesResolve && impliesObjectChanged;
-        }
-
-        public boolean impliesResolve() {
-            return impliesResolve;
-        }
-
-        public boolean impliesObjectChanged() {
-            return impliesObjectChanged;
-        }
-    }
-
-    public static ImperativeFacetFlags getImperativeFacetFlags(final ObjectMember member, final Method method) {
-        ImperativeFacetFlags flags = new ImperativeFacetFlags();
-        if (member == null) {
-            return flags;
-        }
-        List<Facet> allFacets = member.getFacets(Filters.anyOfType(Facet.class));
-        for (Facet facet : allFacets) {
-            ImperativeFacet imperativeFacet = ImperativeFacetUtils.getImperativeFacet(facet);
-            if (imperativeFacet == null) {
-                continue;
-            }
-            List<Method> methods = imperativeFacet.getMethods();
-            if (!methods.contains(method)) {
-                continue;
-            }
-            flags.apply(imperativeFacet);
-
-            // no need to search further
-            if (flags.bothSet()) {
-                break;
-            }
-        }
-        return flags;
-    }
-
-}
+
+public final class ImperativeFacetUtils {
+
+    private ImperativeFacetUtils() {
+    }
+
+    /**
+     * Returns the provided {@link Facet facet} as an {@link ImperativeFacet} if it either is one or if it is a
+     * {@link DecoratingFacet} that in turn wraps an {@link ImperativeFacet}.
+     * 
+     * <p>
+     * Otherwise, returns <tt>null</tt>.
+     */
+    public static ImperativeFacet getImperativeFacet(final Facet facet) {
+        if (facet instanceof ImperativeFacet) {
+            return (ImperativeFacet) facet;
+        }
+        if (facet instanceof DecoratingFacet) {
+            final DecoratingFacet<?> decoratingFacet = CastUtils.cast(facet);
+            return getImperativeFacet(decoratingFacet.getDecoratedFacet());
+        }
+        return null;
+    }
+
+    public static boolean isImperativeFacet(final Facet facet) {
+        return getImperativeFacet(facet) != null;
+    }
+
+    public static class ImperativeFacetFlags {
+        private boolean impliesResolve;
+        private boolean impliesObjectChanged;
+
+        public void apply(final ImperativeFacet imperativeFacet) {
+            this.impliesResolve |= imperativeFacet.impliesResolve();
+            this.impliesObjectChanged |= imperativeFacet.impliesObjectChanged();
+        }
+
+        public boolean bothSet() {
+            return impliesResolve && impliesObjectChanged;
+        }
+
+        public boolean impliesResolve() {
+            return impliesResolve;
+        }
+
+        public boolean impliesObjectChanged() {
+            return impliesObjectChanged;
+        }
+    }
+
+    public static ImperativeFacetFlags getImperativeFacetFlags(final ObjectMember member, final Method method) {
+        final ImperativeFacetFlags flags = new ImperativeFacetFlags();
+        if (member == null) {
+            return flags;
+        }
+        final List<Facet> allFacets = member.getFacets(Filters.anyOfType(Facet.class));
+        for (final Facet facet : allFacets) {
+            final ImperativeFacet imperativeFacet = ImperativeFacetUtils.getImperativeFacet(facet);
+            if (imperativeFacet == null) {
+                continue;
+            }
+            final List<Method> methods = imperativeFacet.getMethods();
+            if (!methods.contains(method)) {
+                continue;
+            }
+            flags.apply(imperativeFacet);
+
+            // no need to search further
+            if (flags.bothSet()) {
+                break;
+            }
+        }
+        return flags;
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MarkerFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MarkerFacet.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MarkerFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MarkerFacet.java Tue Apr 26 18:24:05 2011
@@ -17,11 +17,10 @@
  *  under the License.
  */
 
-
-package org.apache.isis.core.metamodel.facets;
+package org.apache.isis.core.metamodel.facets;
 
 import org.apache.isis.core.metamodel.facetapi.Facet;
-
-public interface MarkerFacet extends Facet {
-
-}
+
+public interface MarkerFacet extends Facet {
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MarkerFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MarkerFacetAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MarkerFacetAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MarkerFacetAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,18 +17,16 @@
  *  under the License.
  */
 
-
-package org.apache.isis.core.metamodel.facets;
+package org.apache.isis.core.metamodel.facets;
 
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-
-public abstract class MarkerFacetAbstract extends FacetAbstract implements MarkerFacet {
-
-    public MarkerFacetAbstract(final Class<? extends Facet> facetType, final FacetHolder holder) {
-        super(facetType, holder, false);
-    }
-
-}
+
+public abstract class MarkerFacetAbstract extends FacetAbstract implements MarkerFacet {
+
+    public MarkerFacetAbstract(final Class<? extends Facet> facetType, final FacetHolder holder) {
+        super(facetType, holder, false);
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFilteringFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFilteringFacetFactory.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFilteringFacetFactory.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFilteringFacetFactory.java Tue Apr 26 18:24:05 2011
@@ -17,21 +17,17 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
 import java.lang.reflect.Method;
 
-
-
-/**
- * A {@link FacetFactory} which filters out arbitrary {@link Method method}s.
- * 
- * <p>
- * Used by Java5 Reflector's <tt>ProgrammingModel#recognizes(Method)</tt>.
- */
-public interface MethodFilteringFacetFactory extends FacetFactory {
-
-    public boolean recognizes(Method method);
-}
-
+/**
+ * A {@link FacetFactory} which filters out arbitrary {@link Method method}s.
+ * 
+ * <p>
+ * Used by Java5 Reflector's <tt>ProgrammingModel#recognizes(Method)</tt>.
+ */
+public interface MethodFilteringFacetFactory extends FacetFactory {
+
+    public boolean recognizes(Method method);
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactory.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactory.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactory.java Tue Apr 26 18:24:05 2011
@@ -17,25 +17,22 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
 import java.util.List;
 
 import org.apache.isis.core.metamodel.specloader.facetprocessor.FacetProcessor;
-
-
-/**
- * Indicates that the {@link FacetFactory} works by recognizing methods with a certain prefix (or prefixes).
- * 
- * <p>
- * Used by {@link FacetProcessor#recognizes(java.lang.reflect.Method)}.
- */
-public interface MethodPrefixBasedFacetFactory extends FacetFactory {
-
-    /**
-     * All prefixes recognized by this {@link FacetFactory}.
-     */
-    public List<String> getPrefixes();
-}
-
+
+/**
+ * Indicates that the {@link FacetFactory} works by recognizing methods with a certain prefix (or prefixes).
+ * 
+ * <p>
+ * Used by {@link FacetProcessor#recognizes(java.lang.reflect.Method)}.
+ */
+public interface MethodPrefixBasedFacetFactory extends FacetFactory {
+
+    /**
+     * All prefixes recognized by this {@link FacetFactory}.
+     */
+    public List<String> getPrefixes();
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodRemoverConstants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodRemoverConstants.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodRemoverConstants.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodRemoverConstants.java Tue Apr 26 18:24:05 2011
@@ -17,37 +17,35 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.facets;
 
-package org.apache.isis.core.metamodel.facets;
-
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.isis.core.metamodel.facetapi.MethodRemover;
 import org.apache.isis.core.metamodel.methodutils.MethodScope;
-
-
-public class MethodRemoverConstants {
-
-    public static MethodRemover NULL = new MethodRemover() {
-        public List<Method> removeMethods(
-                final MethodScope methodScope,
-                final String prefix,
-                final Class<?> returnType,
-                final boolean canBeVoid,
-                final int paramCount) {
-            return new ArrayList<Method>();
-        }
-
-        public void removeMethod(
-                final MethodScope methodScope,
-                final String methodName,
-                final Class<?> returnType,
-                final Class<?>[] parameterTypes) {}
-
-        public void removeMethod(final Method method) {}
-
-        public void removeMethods(final List<Method> methods) {}
-    };
-}
+
+public class MethodRemoverConstants {
+
+    public static MethodRemover NULL = new MethodRemover() {
+        @Override
+        public List<Method> removeMethods(final MethodScope methodScope, final String prefix,
+            final Class<?> returnType, final boolean canBeVoid, final int paramCount) {
+            return new ArrayList<Method>();
+        }
+
+        @Override
+        public void removeMethod(final MethodScope methodScope, final String methodName, final Class<?> returnType,
+            final Class<?>[] parameterTypes) {
+        }
+
+        @Override
+        public void removeMethod(final Method method) {
+        }
+
+        @Override
+        public void removeMethods(final List<Method> methods) {
+        }
+    };
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MultiTypedFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MultiTypedFacetAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MultiTypedFacetAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MultiTypedFacetAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,32 +17,32 @@
  *  under the License.
  */
 
-
-package org.apache.isis.core.metamodel.facets;
+package org.apache.isis.core.metamodel.facets;
 
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.MultiTypedFacet;
-
-
-/**
- * Convenience abstract implementation of {@link MultiTypedFacet}.
- */
-public abstract class MultiTypedFacetAbstract extends FacetAbstract implements MultiTypedFacet {
-
-    private final Class<? extends Facet>[] facetTypes;
-
-    public MultiTypedFacetAbstract(final Class<? extends Facet> facetType, final Class<? extends Facet>[] facetTypes, final FacetHolder holder) {
-        super(facetType, holder, false);
-        this.facetTypes = facetTypes;
-    }
-
-    public final Class<? extends Facet>[] facetTypes() {
-        return facetTypes;
-    }
-
-    public abstract <T extends Facet> T getFacet(Class<T> facetType);
-
-}
-
+
+/**
+ * Convenience abstract implementation of {@link MultiTypedFacet}.
+ */
+public abstract class MultiTypedFacetAbstract extends FacetAbstract implements MultiTypedFacet {
+
+    private final Class<? extends Facet>[] facetTypes;
+
+    public MultiTypedFacetAbstract(final Class<? extends Facet> facetType, final Class<? extends Facet>[] facetTypes,
+        final FacetHolder holder) {
+        super(facetType, holder, false);
+        this.facetTypes = facetTypes;
+    }
+
+    @Override
+    public final Class<? extends Facet>[] facetTypes() {
+        return facetTypes;
+    }
+
+    @Override
+    public abstract <T extends Facet> T getFacet(Class<T> facetType);
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MultipleValueFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MultipleValueFacet.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MultipleValueFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MultipleValueFacet.java Tue Apr 26 18:24:05 2011
@@ -17,11 +17,10 @@
  *  under the License.
  */
 
-
-package org.apache.isis.core.metamodel.facets;
+package org.apache.isis.core.metamodel.facets;
 
 import org.apache.isis.core.metamodel.facetapi.Facet;
-
-public interface MultipleValueFacet extends Facet {
-
-}
+
+public interface MultipleValueFacet extends Facet {
+
+}



Mime
View raw message