incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1059813 [3/10] - in /incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets: ./ actcoll/typeof/ actions/ actions/choices/ actions/debug/ actions/debug/annotation/ actions/defaults/ actions/describedas/ acti...
Date Mon, 17 Jan 2011 08:48:56 GMT
Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetFactory.java?rev=1059813&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetFactory.java Mon Jan 17 08:48:40 2011
@@ -0,0 +1,106 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.collections.clear;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.core.commons.lang.NameUtils;
+import org.apache.isis.core.metamodel.adapter.ObjectDirtier;
+import org.apache.isis.core.metamodel.adapter.ObjectDirtierAware;
+import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
+import org.apache.isis.core.metamodel.adapter.map.AdapterMapAware;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionClearFacet;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+
+
+public class CollectionClearFacetFactory extends MethodPrefixBasedFacetFactoryAbstract implements
+        AdapterMapAware, ObjectDirtierAware {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.CLEAR_PREFIX };
+
+    private AdapterMap adapterMap;
+    private ObjectDirtier objectDirtier;
+
+    public CollectionClearFacetFactory() {
+        super(FeatureType.COLLECTIONS_ONLY, PREFIXES);
+    }
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+        attachCollectionClearFacets(processMethodContext);
+
+    }
+
+    private void attachCollectionClearFacets(final ProcessMethodContext processMethodContext) {
+
+        final Method getMethod = processMethodContext.getMethod();
+        final String capitalizedName = NameUtils.javaBaseName(getMethod.getName());
+
+        Class<?> cls = processMethodContext.getCls();
+        final Method method =
+            MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.CLEAR_PREFIX + capitalizedName,
+                void.class, null);
+        processMethodContext.removeMethod(method);
+
+        final FacetHolder collection = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(createCollectionClearFacet(method, getMethod, collection));
+    }
+
+    private CollectionClearFacet createCollectionClearFacet(final Method clearMethodIfAny, final Method accessorMethod,
+        final FacetHolder collection) {
+        if (clearMethodIfAny != null) {
+            return new CollectionClearFacetViaMethod(clearMethodIfAny, collection);
+        } else {
+            return new CollectionClearFacetViaAccessor(accessorMethod, collection, getAdapterMap(), getObjectDirtier());
+        }
+    }
+
+
+
+    // ///////////////////////////////////////////////////////
+    // Dependencies (injected)
+    // ///////////////////////////////////////////////////////
+
+    protected AdapterMap getAdapterMap() {
+        return adapterMap;
+    }
+
+    @Override
+    public void setAdapterMap(AdapterMap adapterMap) {
+        this.adapterMap = adapterMap;
+    }
+
+    protected ObjectDirtier getObjectDirtier() {
+        return objectDirtier;
+    }
+    
+    @Override
+    public void setObjectDirtier(ObjectDirtier objectDirtier) {
+        this.objectDirtier = objectDirtier;
+    }
+    
+}

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetViaAccessor.java (from r1059587, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionClearFacetViaAccessor.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetViaAccessor.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetViaAccessor.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionClearFacetViaAccessor.java&r1=1059587&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionClearFacetViaAccessor.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetViaAccessor.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.collections.modify;
+package org.apache.isis.core.progmodel.facets.collections.clear;
 
 import java.lang.reflect.Method;
 import java.util.Collection;
@@ -32,6 +32,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionClearFacetAbstract;
 
 
 public class CollectionClearFacetViaAccessor extends CollectionClearFacetAbstract implements ImperativeFacet {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetViaMethod.java (from r1059587, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionClearFacetViaMethod.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetViaMethod.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetViaMethod.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionClearFacetViaMethod.java&r1=1059587&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionClearFacetViaMethod.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/clear/CollectionClearFacetViaMethod.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.collections.modify;
+package org.apache.isis.core.progmodel.facets.collections.clear;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -28,6 +28,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionClearFacetAbstract;
 
 
 public class CollectionClearFacetViaMethod extends CollectionClearFacetAbstract implements ImperativeFacet {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/CollectionFacetFactory.java (from r1059587, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/CollectionFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/CollectionFacetFactory.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/CollectionFacetFactory.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/CollectionFacetFactory.java&r1=1059587&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/CollectionFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/CollectionFacetFactory.java Mon Jan 17 08:48:40 2011
@@ -18,16 +18,15 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.collections;
+package org.apache.isis.core.progmodel.facets.collections.collection;
 
 import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
 import org.apache.isis.core.metamodel.adapter.map.AdapterMapAware;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facetapi.MethodRemover;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
 import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
 import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacetDefaultToObject;
-import org.apache.isis.core.metamodel.spec.FacetFactoryAbstract;
 import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistry;
 import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistryAware;
 import org.apache.isis.core.progmodel.facets.actcoll.typeof.TypeOfFacetInferredFromArray;
@@ -45,27 +44,38 @@ public class CollectionFacetFactory exte
 
 
     @Override
-    public boolean process(final Class<?> cls, final MethodRemover methodRemover, final FacetHolder holder) {
-        if (collectionTypeRegistry.isCollectionType(cls)) {
-            final TypeOfFacet typeOfFacet = holder.getFacet(TypeOfFacet.class);
-            if (typeOfFacet == null) {
-                Class<?> collectionElementType = collectionElementType(cls);
-                holder.addFacet(collectionElementType != Object.class ? new TypeOfFacetInferredFromGenerics(
-                        collectionElementType, holder, getSpecificationLookup()) : new TypeOfFacetDefaultToObject(holder, getSpecificationLookup()));
-            } else {
-                // nothing
-            }
-            holder.addFacet(new JavaCollectionFacet(holder, getAdapterMap()));
-            return true;
-        }
-        if (collectionTypeRegistry.isArrayType(cls)) {
-            holder.addFacet(new JavaArrayFacet(holder, getAdapterMap()));
-            holder.addFacet(new TypeOfFacetInferredFromArray(cls.getComponentType(), holder, getSpecificationLookup()));
-            return true;
+    public void process(ProcessClassContext processClassContaxt) {
+        
+        if (collectionTypeRegistry.isCollectionType(processClassContaxt.getCls())) {
+            processCollectionType(processClassContaxt);
+        } else if (collectionTypeRegistry.isArrayType(processClassContaxt.getCls())) {
+            processAsArrayType(processClassContaxt);
         }
 
-        return false;
+    }
+
+
+
+    private void processCollectionType(ProcessClassContext processClassContaxt) {
+        final FacetHolder facetHolder = processClassContaxt.getFacetHolder();
+        final TypeOfFacet typeOfFacet = facetHolder.getFacet(TypeOfFacet.class);
+        if (typeOfFacet == null) {
+            Class<?> collectionElementType = collectionElementType(processClassContaxt.getCls());
+            facetHolder.addFacet(collectionElementType != Object.class ? new TypeOfFacetInferredFromGenerics(
+                    collectionElementType, facetHolder, getSpecificationLookup()) : new TypeOfFacetDefaultToObject(facetHolder, getSpecificationLookup()));
+        } else {
+            // nothing
+        }
+        facetHolder.addFacet(new JavaCollectionFacet(facetHolder, getAdapterMap()));
+        return;
     }
+
+    private void processAsArrayType(ProcessClassContext processClassContaxt) {
+        final FacetHolder facetHolder = processClassContaxt.getFacetHolder();
+        facetHolder.addFacet(new JavaArrayFacet(facetHolder, getAdapterMap()));
+        facetHolder.addFacet(new TypeOfFacetInferredFromArray(processClassContaxt.getCls().getComponentType(), facetHolder, getSpecificationLookup()));
+    }
+
 
     private Class<?> collectionElementType(final Class<?> cls) {
         return Object.class;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/JavaArrayFacet.java (from r1059587, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/JavaArrayFacet.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/JavaArrayFacet.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/JavaArrayFacet.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/JavaArrayFacet.java&r1=1059587&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/JavaArrayFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/JavaArrayFacet.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.collections;
+package org.apache.isis.core.progmodel.facets.collections.collection;
 
 import java.util.ArrayList;
 import java.util.Collection;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/JavaCollectionFacet.java (from r1059587, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/JavaCollectionFacet.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/JavaCollectionFacet.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/JavaCollectionFacet.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/JavaCollectionFacet.java&r1=1059587&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/JavaCollectionFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/JavaCollectionFacet.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.collections;
+package org.apache.isis.core.progmodel.facets.collections.collection;
 
 import java.util.Collection;
 import java.util.Iterator;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/ObjectToAdapterTransformer.java (from r1059587, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/ObjectToAdapterTransformer.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/ObjectToAdapterTransformer.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/ObjectToAdapterTransformer.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/ObjectToAdapterTransformer.java&r1=1059587&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/ObjectToAdapterTransformer.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/collection/ObjectToAdapterTransformer.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.collections;
+package org.apache.isis.core.progmodel.facets.collections.collection;
 
 import org.apache.commons.collections.Transformer;
 

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddRemoveAndValidateFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddRemoveAndValidateFacetFactory.java?rev=1059813&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddRemoveAndValidateFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddRemoveAndValidateFacetFactory.java Mon Jan 17 08:48:40 2011
@@ -0,0 +1,213 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.collections.modify;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.core.commons.lang.NameUtils;
+import org.apache.isis.core.metamodel.adapter.ObjectDirtier;
+import org.apache.isis.core.metamodel.adapter.ObjectDirtierAware;
+import org.apache.isis.core.metamodel.exceptions.MetaModelException;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionAddToFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionRemoveFromFacet;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+import org.apache.isis.core.progmodel.facets.actcoll.typeof.TypeOfFacetInferredFromSupportingMethods;
+import org.apache.isis.core.progmodel.facets.collections.validate.CollectionValidateAddToFacetViaMethod;
+import org.apache.isis.core.progmodel.facets.collections.validate.CollectionValidateRemoveFromFacetViaMethod;
+
+
+/**
+ * TODO: should probably split out into two {@link FacetFactory}s, one for
+ * <tt>addTo()</tt>/<tt>removeFrom()</tt> and one for <tt>validateAddTo()</tt>/<tt>validateRemoveFrom()</tt>.
+ */
+public class CollectionAddRemoveAndValidateFacetFactory extends MethodPrefixBasedFacetFactoryAbstract implements
+        ObjectDirtierAware {
+
+    private static final String[] PREFIXES = {  };
+
+    private ObjectDirtier objectDirtier;
+
+    public CollectionAddRemoveAndValidateFacetFactory() {
+        super(FeatureType.COLLECTIONS_ONLY, PREFIXES);
+    }
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+
+        final Class<?> collectionType = attachAddToFacetAndRemoveFromFacet(processMethodContext);
+        attachValidateAddToAndRemoveFromFacetIfMethodsFound(processMethodContext, collectionType);
+    }
+
+    private Class<?> attachAddToFacetAndRemoveFromFacet(ProcessMethodContext processMethodContext) {
+
+        final Method accessorMethod = processMethodContext.getMethod();
+        final String capitalizedName = NameUtils.javaBaseName(accessorMethod.getName());
+
+        Class<?> cls = processMethodContext.getCls();
+        
+        // add
+        final Method addToMethod =
+            MethodFinderUtils.findMethod(cls, MethodScope.OBJECT,
+                MethodPrefixConstants.ADD_TO_PREFIX + capitalizedName, void.class);
+        processMethodContext.removeMethod(addToMethod);
+
+        // remove
+        final Method removeFromMethod =
+            MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.REMOVE_FROM_PREFIX
+                + capitalizedName, void.class);
+        processMethodContext.removeMethod(removeFromMethod);
+
+        // add facets
+        final FacetHolder collection = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(createAddToFacet(addToMethod, accessorMethod, collection));
+        FacetUtil.addFacet(createRemoveFromFacet(removeFromMethod, accessorMethod, collection));
+
+        // infer typ
+        final Class<?> addToType =
+            ((addToMethod == null || addToMethod.getParameterTypes().length != 1) ? null : addToMethod
+                .getParameterTypes()[0]);
+        final Class<?> removeFromType =
+            ((removeFromMethod == null || removeFromMethod.getParameterTypes().length != 1) ? null : removeFromMethod
+                .getParameterTypes()[0]);
+
+        return inferTypeOfIfPossible(accessorMethod, addToType, removeFromType, collection);
+    }
+
+    /**
+     * TODO need to distinguish between Java collections, arrays and other collections!
+     */
+    private CollectionAddToFacet createAddToFacet(final Method addToMethodIfAny, final Method accessorMethod,
+        final FacetHolder holder) {
+        if (addToMethodIfAny != null) {
+            return new CollectionAddToFacetViaMethod(addToMethodIfAny, holder);
+        } else {
+            return new CollectionAddToFacetViaAccessor(accessorMethod, holder, getObjectDirtier());
+        }
+    }
+
+    /**
+     * TODO need to distinguish between Java collections, arrays and other collections!
+     */
+    private CollectionRemoveFromFacet createRemoveFromFacet(final Method removeFromMethodIfAny,
+        final Method accessorMethod, final FacetHolder holder) {
+        if (removeFromMethodIfAny != null) {
+            return new CollectionRemoveFromFacetViaMethod(removeFromMethodIfAny, holder);
+        } else {
+            return new CollectionRemoveFromFacetViaAccessor(accessorMethod, holder, getObjectDirtier());
+        }
+    }
+
+    private Class<?> inferTypeOfIfPossible(final Method getMethod, final Class<?> addType, final Class<?> removeType,
+        final FacetHolder collection) {
+
+        if (addType != null && removeType != null && addType != removeType) {
+            throw new MetaModelException("The addTo/removeFrom methods for " + getMethod.getDeclaringClass() + " must "
+                + "both deal with same type of object: " + addType + "; " + removeType);
+        }
+
+        Class<?> type = addType != null ? addType : removeType;
+        if (type != null) {
+            FacetUtil
+                .addFacet(new TypeOfFacetInferredFromSupportingMethods(type, collection, getSpecificationLookup()));
+        }
+        return type;
+    }
+
+    private void attachValidateAddToAndRemoveFromFacetIfMethodsFound(ProcessMethodContext processMethodContext,
+        final Class<?> collectionType) {
+        attachValidateAddToFacetIfValidateAddToMethodIsFound(processMethodContext, collectionType);
+        attachValidateRemoveFacetIfValidateRemoveFromMethodIsFound(processMethodContext, collectionType);
+    }
+
+    private void attachValidateAddToFacetIfValidateAddToMethodIsFound(final ProcessMethodContext processMethodContext,
+        final Class<?> collectionType) {
+
+        final Method getMethod = processMethodContext.getMethod();
+        final String capitalizedName = NameUtils.javaBaseName(getMethod.getName());
+
+        Class<?> cls = processMethodContext.getCls();
+        final Class<?>[] paramTypes = MethodFinderUtils.paramTypesOrNull(collectionType);
+        Method validateAddToMethod =
+            MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.VALIDATE_ADD_TO_PREFIX
+                + capitalizedName, String.class, paramTypes);
+        if (validateAddToMethod == null) {
+            validateAddToMethod =
+                MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.VALIDATE_ADD_TO_PREFIX_2
+                    + capitalizedName, String.class, MethodFinderUtils.paramTypesOrNull(collectionType));
+        }
+        if (validateAddToMethod == null) {
+            return;
+        }
+        processMethodContext.removeMethod(validateAddToMethod);
+
+        final FacetHolder collection = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new CollectionValidateAddToFacetViaMethod(validateAddToMethod, collection));
+    }
+
+    private void attachValidateRemoveFacetIfValidateRemoveFromMethodIsFound(
+        final ProcessMethodContext processMethodContext, final Class<?> collectionType) {
+
+        final Method getMethod = processMethodContext.getMethod();
+        final String capitalizedName = NameUtils.javaBaseName(getMethod.getName());
+
+        Class<?> cls = processMethodContext.getCls();
+        final Class<?>[] paramTypes = MethodFinderUtils.paramTypesOrNull(collectionType);
+        Method validateRemoveFromMethod =
+            MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.VALIDATE_REMOVE_FROM_PREFIX
+                + capitalizedName, String.class, paramTypes);
+        if (validateRemoveFromMethod == null) {
+            validateRemoveFromMethod =
+                MethodFinderUtils.findMethod(cls, MethodScope.OBJECT,
+                    MethodPrefixConstants.VALIDATE_REMOVE_FROM_PREFIX_2 + capitalizedName, String.class,
+                    MethodFinderUtils.paramTypesOrNull(collectionType));
+        }
+        if (validateRemoveFromMethod == null) {
+            return;
+        }
+        processMethodContext.removeMethod(validateRemoveFromMethod);
+
+        final FacetHolder collection = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new CollectionValidateRemoveFromFacetViaMethod(validateRemoveFromMethod, collection));
+    }
+
+    
+    // ///////////////////////////////////////////////////////
+    // Dependencies (injected)
+    // ///////////////////////////////////////////////////////
+
+
+    protected ObjectDirtier getObjectDirtier() {
+        return objectDirtier;
+    }
+    
+    @Override
+    public void setObjectDirtier(ObjectDirtier objectDirtier) {
+        this.objectDirtier = objectDirtier;
+    }
+    
+}

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddToFacetViaAccessor.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddToFacetViaAccessor.java?rev=1059813&r1=1059812&r2=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddToFacetViaAccessor.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddToFacetViaAccessor.java Mon Jan 17 08:48:40 2011
@@ -32,6 +32,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.util.AdapterUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionAddToFacetAbstract;
 
 
 public class CollectionAddToFacetViaAccessor extends CollectionAddToFacetAbstract implements ImperativeFacet {

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddToFacetViaMethod.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddToFacetViaMethod.java?rev=1059813&r1=1059812&r2=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddToFacetViaMethod.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionAddToFacetViaMethod.java Mon Jan 17 08:48:40 2011
@@ -28,6 +28,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionAddToFacetAbstract;
 
 
 public class CollectionAddToFacetViaMethod extends CollectionAddToFacetAbstract implements ImperativeFacet {

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionRemoveFromFacetViaAccessor.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionRemoveFromFacetViaAccessor.java?rev=1059813&r1=1059812&r2=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionRemoveFromFacetViaAccessor.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionRemoveFromFacetViaAccessor.java Mon Jan 17 08:48:40 2011
@@ -32,6 +32,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.util.AdapterUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionRemoveFromFacetAbstract;
 
 
 public class CollectionRemoveFromFacetViaAccessor extends CollectionRemoveFromFacetAbstract implements ImperativeFacet {

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionRemoveFromFacetViaMethod.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionRemoveFromFacetViaMethod.java?rev=1059813&r1=1059812&r2=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionRemoveFromFacetViaMethod.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/modify/CollectionRemoveFromFacetViaMethod.java Mon Jan 17 08:48:40 2011
@@ -28,6 +28,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionRemoveFromFacetAbstract;
 
 
 public class CollectionRemoveFromFacetViaMethod extends CollectionRemoveFromFacetAbstract implements ImperativeFacet {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java Mon Jan 17 08:48:40 2011
@@ -18,11 +18,11 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.progmodel.facets.actions.defaults.ActionDefaultsFacetAbstract;
+import org.apache.isis.core.progmodel.facets.param.defaults.ActionDefaultsFacetAbstract;
 
 
 public class ActionDefaultsFacetDerivedFromDefaultedFacets extends ActionDefaultsFacetAbstract {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedAnnotationFacetFactory.java (from r1056832, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedAnnotationFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedAnnotationFacetFactory.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedAnnotationFacetFactory.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedAnnotationFacetFactory.java&r1=1056832&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedAnnotationFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedAnnotationFacetFactory.java Mon Jan 17 08:48:40 2011
@@ -18,9 +18,8 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
-import java.lang.reflect.Method;
 
 import org.apache.isis.applib.annotation.Defaulted;
 import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -31,7 +30,6 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.FacetUtil;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facetapi.MethodRemover;
 import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
 import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet;
 import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
@@ -51,8 +49,8 @@ public class DefaultedAnnotationFacetFac
     }
 
     @Override
-    public boolean process(final Class<?> cls, final MethodRemover methodRemover, final FacetHolder holder) {
-        return FacetUtil.addFacet(create(cls, holder));
+    public void process(ProcessClassContext processClassContaxt) {
+        FacetUtil.addFacet(create(processClassContaxt.getCls(), processClassContaxt.getFacetHolder()));
     }
 
     private DefaultedFacetAbstract create(final Class<?> cls, final FacetHolder holder) {
@@ -84,22 +82,21 @@ public class DefaultedAnnotationFacetFac
      * {@link PropertyDefaultFacet} for the property with the same default.
      */
     @Override
-    public boolean process(Class<?> cls, final Method method, final MethodRemover methodRemover, final FacetHolder holder) {
+    public void process(ProcessMethodContext processMethodContext) {
         // don't overwrite any defaults that might already picked up
-        final PropertyDefaultFacet existingDefaultFacet = holder.getFacet(PropertyDefaultFacet.class);
+        final PropertyDefaultFacet existingDefaultFacet = processMethodContext.getFacetHolder().getFacet(PropertyDefaultFacet.class);
 		if (existingDefaultFacet != null && !existingDefaultFacet.isNoop()) {
-            return false;
+            return;
         }
 
         // try to infer defaults from the underlying return type
-        final Class<?> returnType = method.getReturnType();
+        final Class<?> returnType = processMethodContext.getMethod().getReturnType();
         final DefaultedFacet returnTypeDefaultedFacet = getDefaultedFacet(returnType);
         if (returnTypeDefaultedFacet != null) {
             final PropertyDefaultFacetDerivedFromDefaultedFacet propertyFacet = new PropertyDefaultFacetDerivedFromDefaultedFacet(
-                    returnTypeDefaultedFacet, holder, getAdapterMap());
-            return FacetUtil.addFacet(propertyFacet);
+                    returnTypeDefaultedFacet, processMethodContext.getFacetHolder(), getAdapterMap());
+            FacetUtil.addFacet(propertyFacet);
         }
-        return false;
     }
 
 	/**
@@ -107,14 +104,14 @@ public class DefaultedAnnotationFacetFac
      * {@link ActionDefaultsFacet} for the action.
      */
     @Override
-    public boolean processParams(final Method method, final int paramNum, final FacetHolder holder) {
+    public void processParams(ProcessParameterContext processParameterContext) {
         // don't overwrite any defaults already picked up
-        if (holder.getFacet(ActionDefaultsFacet.class) != null) {
-            return false;
+        if (processParameterContext.getFacetHolder().getFacet(ActionDefaultsFacet.class) != null) {
+            return;
         }
 
         // try to infer defaults from any of the parameter's underlying types
-        final Class<?>[] parameterTypes = method.getParameterTypes();
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
         final DefaultedFacet[] parameterTypeDefaultedFacets = new DefaultedFacet[parameterTypes.length];
         boolean hasAtLeastOneDefault = false;
         for (int i = 0; i < parameterTypes.length; i++) {
@@ -123,9 +120,8 @@ public class DefaultedAnnotationFacetFac
             hasAtLeastOneDefault = hasAtLeastOneDefault | (parameterTypeDefaultedFacets[i] != null);
         }
         if (hasAtLeastOneDefault) {
-            return FacetUtil.addFacet(new ActionDefaultsFacetDerivedFromDefaultedFacets(parameterTypeDefaultedFacets, holder));
+            FacetUtil.addFacet(new ActionDefaultsFacetDerivedFromDefaultedFacets(parameterTypeDefaultedFacets, processParameterContext.getFacetHolder()));
         }
-        return false;
     }
 
     private DefaultedFacet getDefaultedFacet(final Class<?> paramType) {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacet.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacet.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacet.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacet.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacet.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacet.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facets.SingleValueFacet;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetAbstract.java (from r1056832, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAbstract.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetAbstract.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetAbstract.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAbstract.java&r1=1056832&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetAbstract.java Mon Jan 17 08:48:40 2011
@@ -18,14 +18,14 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
 import org.apache.isis.applib.adapters.DefaultsProvider;
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.runtimecontext.DependencyInjector;
-import org.apache.isis.core.progmodel.facets.ClassUtil;
+import org.apache.isis.core.progmodel.util.ClassUtil;
 
 
 public abstract class DefaultedFacetAbstract extends FacetAbstract implements DefaultedFacet {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetAnnotation.java (from r1056832, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAnnotation.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetAnnotation.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetAnnotation.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAnnotation.java&r1=1056832&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAnnotation.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetAnnotation.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
 import org.apache.isis.applib.annotation.Defaulted;
 import org.apache.isis.core.commons.config.IsisConfiguration;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetFromConfiguration.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetFromConfiguration.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetFromConfiguration.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetFromConfiguration.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetFromConfiguration.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetFromConfiguration.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetFromConfiguration.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.runtimecontext.DependencyInjector;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetUsingDefaultsProvider.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetUsingDefaultsProvider.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetUsingDefaultsProvider.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetUsingDefaultsProvider.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetUsingDefaultsProvider.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetUsingDefaultsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultedFacetUsingDefaultsProvider.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
 import org.apache.isis.applib.adapters.DefaultsProvider;
 import org.apache.isis.core.metamodel.facetapi.FacetAbstract;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultsProviderUtil.java (from r1056832, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultsProviderUtil.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultsProviderUtil.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultsProviderUtil.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultsProviderUtil.java&r1=1056832&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultsProviderUtil.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/DefaultsProviderUtil.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
 import org.apache.isis.applib.adapters.DefaultsProvider;
 import org.apache.isis.core.commons.config.IsisConfiguration;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/PropertyDefaultFacetDerivedFromDefaultedFacet.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/PropertyDefaultFacetDerivedFromDefaultedFacet.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/PropertyDefaultFacetDerivedFromDefaultedFacet.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/PropertyDefaultFacetDerivedFromDefaultedFacet.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/PropertyDefaultFacetDerivedFromDefaultedFacet.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/PropertyDefaultFacetDerivedFromDefaultedFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/PropertyDefaultFacetDerivedFromDefaultedFacet.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.defaults;
+package org.apache.isis.core.progmodel.facets.defaults;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.map.AdapterMap;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/DescribedAsFacetImpl.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetImpl.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/DescribedAsFacetImpl.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/DescribedAsFacetImpl.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetImpl.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetImpl.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/DescribedAsFacetImpl.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.naming.describedas;
+package org.apache.isis.core.progmodel.facets.describedas;
 
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.naming.describedas.DescribedAsFacetAbstract;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/DescribedAsFacetNone.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetNone.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/DescribedAsFacetNone.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/DescribedAsFacetNone.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetNone.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetNone.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/DescribedAsFacetNone.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.naming.describedas;
+package org.apache.isis.core.progmodel.facets.describedas;
 
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.naming.describedas.DescribedAsFacetAbstract;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsAnnotationFacetFactory.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsAnnotationFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsAnnotationFacetFactory.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsAnnotationFacetFactory.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsAnnotationFacetFactory.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsAnnotationFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsAnnotationFacetFactory.java Mon Jan 17 08:48:40 2011
@@ -18,16 +18,14 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.naming.describedas;
+package org.apache.isis.core.progmodel.facets.describedas.annotation;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
 
 import org.apache.isis.applib.annotation.DescribedAs;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.FacetUtil;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facetapi.MethodRemover;
 import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
 import org.apache.isis.core.metamodel.facets.naming.describedas.DescribedAsFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -40,49 +38,51 @@ public class DescribedAsAnnotationFacetF
     }
 
     @Override
-    public boolean process(final Class<?> cls, final MethodRemover methodRemover, final FacetHolder holder) {
-        final DescribedAs annotation = (DescribedAs) getAnnotation(cls, DescribedAs.class);
-        return FacetUtil.addFacet(create(annotation, holder));
+    public void process(ProcessClassContext processClassContaxt) {
+        final DescribedAs annotation = getAnnotation(processClassContaxt.getCls(), DescribedAs.class);
+        FacetUtil.addFacet(create(annotation, processClassContaxt.getFacetHolder()));
     }
 
     @Override
-    public boolean process(Class<?> cls, final Method method, final MethodRemover methodRemover, final FacetHolder holder) {
+    public void process(ProcessMethodContext processMethodContext) {
 
         // look for annotation on the property
-        final DescribedAs annotation = getAnnotation(method, DescribedAs.class);
-        DescribedAsFacet facet = create(annotation, holder);
+        final DescribedAs annotation = getAnnotation(processMethodContext.getMethod(), DescribedAs.class);
+        DescribedAsFacet facet = create(annotation, processMethodContext.getFacetHolder());
         if (facet != null) {
-            return FacetUtil.addFacet(facet);
+            FacetUtil.addFacet(facet);
+            return;
         }
 
         // otherwise, look for annotation on the type
-        final Class<?> returnType = method.getReturnType();
+        final Class<?> returnType = processMethodContext.getMethod().getReturnType();
         final DescribedAsFacet returnTypeDescribedAsFacet = getDescribedAsFacet(returnType);
         if (returnTypeDescribedAsFacet != null) {
-            facet = new DescribedAsFacetDerivedFromType(returnTypeDescribedAsFacet, holder);
-            return FacetUtil.addFacet(facet);
+            facet = new DescribedAsFacetDerivedFromType(returnTypeDescribedAsFacet, processMethodContext.getFacetHolder());
+            FacetUtil.addFacet(facet);
         }
-        return false;
     }
 
     @Override
-    public boolean processParams(final Method method, final int paramNum, final FacetHolder holder) {
+    public void processParams(ProcessParameterContext processParameterContext) {
 
-        final Class<?> parameterType = method.getParameterTypes()[paramNum];
-        final Annotation[] parameterAnnotations = getParameterAnnotations(method)[paramNum];
+        final int paramNum = processParameterContext.getParamNum();
+        final Class<?> parameterType = processParameterContext.getMethod().getParameterTypes()[paramNum];
+        final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[paramNum];
         for (int j = 0; j < parameterAnnotations.length; j++) {
             if (parameterAnnotations[j] instanceof DescribedAs) {
-                return FacetUtil.addFacet(create((DescribedAs) parameterAnnotations[j], holder));
+                FacetUtil.addFacet(create((DescribedAs) parameterAnnotations[j], processParameterContext.getFacetHolder()));
+                return;
             }
         }
 
-        // otherwise, fall back to a description on the parameter'ss type, if available
+        // otherwise, fall back to a description on the parameter's type, if available
         final DescribedAsFacet parameterTypeDescribedAsFacet = getDescribedAsFacet(parameterType);
         if (parameterTypeDescribedAsFacet != null) {
-            return FacetUtil.addFacet(new DescribedAsFacetDerivedFromType(parameterTypeDescribedAsFacet, holder));
+            FacetUtil.addFacet(new DescribedAsFacetDerivedFromType(parameterTypeDescribedAsFacet, processParameterContext.getFacetHolder()));
+            return;
         }
 
-        return false;
     }
 
     private DescribedAsFacet create(final DescribedAs annotation, final FacetHolder holder) {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsFacetAnnotation.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetAnnotation.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsFacetAnnotation.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsFacetAnnotation.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetAnnotation.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetAnnotation.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsFacetAnnotation.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.naming.describedas;
+package org.apache.isis.core.progmodel.facets.describedas.annotation;
 
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.naming.describedas.DescribedAsFacetAbstract;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsFacetDerivedFromType.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetDerivedFromType.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsFacetDerivedFromType.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsFacetDerivedFromType.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetDerivedFromType.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsFacetDerivedFromType.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/describedas/annotation/DescribedAsFacetDerivedFromType.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.naming.describedas;
+package org.apache.isis.core.progmodel.facets.describedas.annotation;
 
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.naming.describedas.DescribedAsFacet;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableAnnotationFacetFactory.java (from r1056832, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableAnnotationFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableAnnotationFacetFactory.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableAnnotationFacetFactory.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableAnnotationFacetFactory.java&r1=1056832&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableAnnotationFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableAnnotationFacetFactory.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.encodeable;
+package org.apache.isis.core.progmodel.facets.encodeable;
 
 import org.apache.isis.applib.annotation.Encodable;
 import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -29,7 +29,6 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.FacetUtil;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facetapi.MethodRemover;
 import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
 import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
 import org.apache.isis.core.metamodel.runtimecontext.DependencyInjector;
@@ -48,8 +47,8 @@ public class EncodableAnnotationFacetFac
     }
 
     @Override
-    public boolean process(final Class<?> cls, final MethodRemover methodRemover, final FacetHolder holder) {
-        return FacetUtil.addFacet(create(cls, holder));
+    public void process(ProcessClassContext processClassContaxt) {
+        FacetUtil.addFacet(create(processClassContaxt.getCls(), processClassContaxt.getFacetHolder()));
     }
 
     /**

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetAbstract.java (from r1056832, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetAbstract.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetAbstract.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetAbstract.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetAbstract.java&r1=1056832&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetAbstract.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.encodeable;
+package org.apache.isis.core.progmodel.facets.encodeable;
 
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -27,7 +27,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
 import org.apache.isis.core.metamodel.runtimecontext.DependencyInjector;
-import org.apache.isis.core.progmodel.facets.ClassUtil;
+import org.apache.isis.core.progmodel.util.ClassUtil;
 
 
 public abstract class EncodableFacetAbstract extends FacetAbstract implements EncodableFacet {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetAnnotation.java (from r1056832, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetAnnotation.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetAnnotation.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetAnnotation.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetAnnotation.java&r1=1056832&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetAnnotation.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetAnnotation.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.encodeable;
+package org.apache.isis.core.progmodel.facets.encodeable;
 
 import org.apache.isis.applib.annotation.Encodable;
 import org.apache.isis.core.commons.config.IsisConfiguration;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetFromConfiguration.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetFromConfiguration.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetFromConfiguration.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetFromConfiguration.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetFromConfiguration.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetFromConfiguration.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetFromConfiguration.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.encodeable;
+package org.apache.isis.core.progmodel.facets.encodeable;
 
 import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetUsingEncoderDecoder.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetUsingEncoderDecoder.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetUsingEncoderDecoder.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetUsingEncoderDecoder.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetUsingEncoderDecoder.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncodableFacetUsingEncoderDecoder.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncodableFacetUsingEncoderDecoder.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.encodeable;
+package org.apache.isis.core.progmodel.facets.encodeable;
 
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.core.commons.ensure.Assert;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncoderDecoderUtil.java (from r1056832, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncoderDecoderUtil.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncoderDecoderUtil.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncoderDecoderUtil.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncoderDecoderUtil.java&r1=1056832&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/encodeable/EncoderDecoderUtil.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/encodeable/EncoderDecoderUtil.java Mon Jan 17 08:48:40 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.encodeable;
+package org.apache.isis.core.progmodel.facets.encodeable;
 
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.core.commons.config.IsisConfiguration;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/ignore/annotation/RemoveIgnoreAnnotationMethodsFacetFactory.java (from r1056813, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/ignore/RemoveIgnoreAnnotationMethodsFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/ignore/annotation/RemoveIgnoreAnnotationMethodsFacetFactory.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/ignore/annotation/RemoveIgnoreAnnotationMethodsFacetFactory.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/ignore/RemoveIgnoreAnnotationMethodsFacetFactory.java&r1=1056813&r2=1059813&rev=1059813&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/ignore/RemoveIgnoreAnnotationMethodsFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/ignore/annotation/RemoveIgnoreAnnotationMethodsFacetFactory.java Mon Jan 17 08:48:40 2011
@@ -18,12 +18,11 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.ignore;
+package org.apache.isis.core.progmodel.facets.ignore.annotation;
 
 import java.lang.reflect.Method;
 
 import org.apache.isis.applib.annotation.Ignore;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
 import org.apache.isis.core.metamodel.facetapi.MethodRemover;
 import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
@@ -36,9 +35,8 @@ public class RemoveIgnoreAnnotationMetho
     }
 
     @Override
-    public boolean process(final Class<?> cls, final MethodRemover methodRemover, final FacetHolder holder) {
-        removeIgnoredMethods(cls, methodRemover);
-        return false;
+    public void process(ProcessClassContext processClassContext) {
+        removeIgnoredMethods(processClassContext.getCls(), processClassContext);
     }
 
     private void removeIgnoredMethods(final Class<?> cls, final MethodRemover methodRemover) {

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/staticmethod/DescribedAsFacetViaDescriptionMethodFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/staticmethod/DescribedAsFacetViaDescriptionMethodFacetFactory.java?rev=1059813&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/staticmethod/DescribedAsFacetViaDescriptionMethodFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/staticmethod/DescribedAsFacetViaDescriptionMethodFacetFactory.java Mon Jan 17 08:48:40 2011
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.members.describedas.staticmethod;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.core.commons.lang.NameUtils;
+import org.apache.isis.core.metamodel.adapter.util.InvokeUtils;
+import org.apache.isis.core.metamodel.exceptions.MetaModelException;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.naming.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+
+/**
+ * Sets up a {@link DescribedAsFacet} if a {@value MethodPrefixConstants#DESCRIPTION_PREFIX}-prefixed method is present.
+ */
+public class DescribedAsFacetViaDescriptionMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.DESCRIPTION_PREFIX };
+
+    /**
+     * Note that the {@link Facet}s registered are the generic ones from noa-architecture (where they exist)
+     */
+    public DescribedAsFacetViaDescriptionMethodFacetFactory() {
+        super(FeatureType.PROPERTIES_COLLECTIONS_AND_ACTIONS, PREFIXES);
+    }
+
+    // ///////////////////////////////////////////////////////
+    // Actions
+    // ///////////////////////////////////////////////////////
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+        attachDescribedAsFacetIfDescriptionMethodIsFound(processMethodContext);
+    }
+
+    public static void attachDescribedAsFacetIfDescriptionMethodIsFound(
+        final ProcessMethodContext processMethodContext) {
+
+        final Method method = processMethodContext.getMethod();
+        final String capitalizedName = NameUtils.javaBaseNameStripAccessorPrefixIfRequired(method.getName());
+
+        final Class<?> cls = processMethodContext.getCls();
+        Method descriptionMethod =
+            MethodFinderUtils.findMethod(cls, MethodScope.CLASS,
+                MethodPrefixConstants.DESCRIPTION_PREFIX + capitalizedName, String.class, new Class[0]);
+        if (descriptionMethod == null) {
+            return;
+        }
+
+        processMethodContext.removeMethod(descriptionMethod);
+        String description = invokeDescriptionMethod(descriptionMethod);
+
+        final FacetHolder facetedMethod = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new DescribedAsFacetViaMethod(description, descriptionMethod, facetedMethod));
+    }
+
+    private static String invokeDescriptionMethod(Method descriptionMethod) {
+        String description = null;
+        try {
+            description = (String) InvokeUtils.invokeStatic(descriptionMethod);
+        } catch (ClassCastException ex) {
+            // ignore
+        }
+        if(description == null) {
+            throw new MetaModelException("method " + descriptionMethod + "must return a string");
+        }
+        return description;
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/staticmethod/DescribedAsFacetViaMethod.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/staticmethod/DescribedAsFacetViaMethod.java?rev=1059813&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/staticmethod/DescribedAsFacetViaMethod.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/staticmethod/DescribedAsFacetViaMethod.java Mon Jan 17 08:48:40 2011
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.members.describedas.staticmethod;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.naming.describedas.DescribedAsFacetAbstract;
+
+
+public class DescribedAsFacetViaMethod extends DescribedAsFacetAbstract implements ImperativeFacet {
+
+    private final Method method;
+
+    public DescribedAsFacetViaMethod(
+    		final String value, 
+    		final Method method, 
+    		final FacetHolder holder) {
+        super(value, holder);
+        this.method = method;
+    }
+
+    public List<Method> getMethods() {
+    	return Collections.singletonList(method);
+    }
+
+
+	public boolean impliesResolve() {
+		return false;
+	}
+
+	public boolean impliesObjectChanged() {
+		return false;
+	}
+
+}
+

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/disable/DisableForContextFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/disable/DisableForContextFacet.java?rev=1059813&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/disable/DisableForContextFacet.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/disable/DisableForContextFacet.java Mon Jan 17 08:48:40 2011
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.members.disable;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.interactions.DisablingInteractionAdvisor;
+
+/**
+ * Disable a property, collection or action based on the state of the target {@link ObjectAdapter object}.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to invoking the <tt>disableXxx</tt> support method for the
+ * member.
+ */
+public interface DisableForContextFacet extends Facet, DisablingInteractionAdvisor {
+
+    /**
+     * The reason this object is disabled, or <tt>null</tt> otherwise.
+     */
+    public String disabledReason(ObjectAdapter object);
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/disable/DisableForContextFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/disable/DisableForContextFacetAbstract.java?rev=1059813&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/disable/DisableForContextFacetAbstract.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/members/disable/DisableForContextFacetAbstract.java Mon Jan 17 08:48:40 2011
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.members.disable;
+
+import org.apache.isis.applib.events.UsabilityEvent;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+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.interactions.UsabilityContext;
+
+
+public abstract class DisableForContextFacetAbstract extends FacetAbstract implements DisableForContextFacet {
+
+    public static Class<? extends Facet> type() {
+        return DisableForContextFacet.class;
+    }
+
+    public DisableForContextFacetAbstract(final FacetHolder holder) {
+        super(type(), holder, false);
+    }
+
+    public String disables(final UsabilityContext<? extends UsabilityEvent> ic) {
+        final ObjectAdapter target = ic.getTarget();
+        return disabledReason(target);
+    }
+
+}
+



Mime
View raw message