You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/12/05 00:41:09 UTC

[24/52] [partial] ISIS-188: consolidating isis-core

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/hidden/method/HiddenObjectViaHiddenMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/hidden/method/HiddenObjectViaHiddenMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/hidden/method/HiddenObjectViaHiddenMethodFacetFactory.java
new file mode 100644
index 0000000..fd61854
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/hidden/method/HiddenObjectViaHiddenMethodFacetFactory.java
@@ -0,0 +1,90 @@
+/*
+ *  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.object.hidden.method;
+
+import java.lang.reflect.Method;
+
+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.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.hide.HiddenObjectFacet;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+
+/**
+ * Installs the {@link HiddenObjectFacetViaHiddenMethod} on the
+ * {@link ObjectSpecification}, and copies this facet onto each
+ * {@link ObjectMember}.
+ * 
+ * <p>
+ * This two-pass design is required because, at the time that the
+ * {@link #process(org.apache.isis.core.metamodel.facets.FacetFactory.ProcessClassContext)
+ * class is being processed}, the {@link ObjectMember member}s for the
+ * {@link ObjectSpecification spec} are not known.
+ */
+public class HiddenObjectViaHiddenMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String HIDDEN_PREFIX = "hidden";
+
+    private static final String[] PREFIXES = { HIDDEN_PREFIX, };
+
+    public HiddenObjectViaHiddenMethodFacetFactory() {
+        super(FeatureType.EVERYTHING_BUT_PARAMETERS, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        for (final Class<?> returnType : new Class<?>[] { Boolean.class, boolean.class }) {
+            if (addFacetIfMethodFound(processClassContext, returnType)) {
+                return;
+            }
+        }
+        return;
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        final FacetedMethod member = processMethodContext.getFacetHolder();
+        final Class<?> owningClass = processMethodContext.getCls();
+        final ObjectSpecification owningSpec = getSpecificationLoader().loadSpecification(owningClass);
+        final HiddenObjectFacet facet = owningSpec.getFacet(HiddenObjectFacet.class);
+        if (facet != null) {
+            facet.copyOnto(member);
+        }
+    }
+
+    private boolean addFacetIfMethodFound(final ProcessClassContext processClassContext, final Class<?> returnType) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+        final Method method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, HIDDEN_PREFIX, returnType, NO_PARAMETERS_TYPES);
+        if (method == null) {
+            return false;
+        }
+        FacetUtil.addFacet(new HiddenObjectFacetViaHiddenMethod(method, facetHolder));
+        processClassContext.removeMethod(method);
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/icon/method/IconFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/icon/method/IconFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/icon/method/IconFacetViaMethod.java
new file mode 100644
index 0000000..14606a8
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/icon/method/IconFacetViaMethod.java
@@ -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.object.icon.method;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.icon.IconFacetAbstract;
+
+public class IconFacetViaMethod extends IconFacetAbstract {
+
+    private final Method method;
+
+    public IconFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        this.method = method;
+    }
+
+    @Override
+    public String iconName(final ObjectAdapter owningAdapter) {
+        try {
+            return (String) AdapterInvokeUtils.invoke(method, owningAdapter);
+        } catch (final RuntimeException ex) {
+            return null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/icon/method/IconMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/icon/method/IconMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/icon/method/IconMethodFacetFactory.java
new file mode 100644
index 0000000..ffd8bda
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/icon/method/IconMethodFacetFactory.java
@@ -0,0 +1,53 @@
+/*
+ *  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.object.icon.method;
+
+import java.lang.reflect.Method;
+
+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.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+
+public class IconMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String ICON_NAME_PREFIX = "iconName";
+
+    private static final String[] PREFIXES = { ICON_NAME_PREFIX, };
+
+    public IconMethodFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+        final Method method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, ICON_NAME_PREFIX, String.class, NO_PARAMETERS_TYPES);
+        if (method == null) {
+            return;
+        }
+        processClassContext.removeMethod(method);
+        FacetUtil.addFacet(new IconFacetViaMethod(method, facetHolder));
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/annotation/RemoveProgrammaticOrIgnoreAnnotationMethodsFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/annotation/RemoveProgrammaticOrIgnoreAnnotationMethodsFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/annotation/RemoveProgrammaticOrIgnoreAnnotationMethodsFacetFactory.java
new file mode 100644
index 0000000..f87b435
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/annotation/RemoveProgrammaticOrIgnoreAnnotationMethodsFacetFactory.java
@@ -0,0 +1,63 @@
+/*
+ *  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.object.ignore.annotation;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import org.apache.isis.applib.annotation.Ignore;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facetapi.MethodRemover;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+public class RemoveProgrammaticOrIgnoreAnnotationMethodsFacetFactory extends FacetFactoryAbstract {
+
+    public RemoveProgrammaticOrIgnoreAnnotationMethodsFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        removeIgnoredMethods(processClassContext.getCls(), processClassContext);
+    }
+
+    @SuppressWarnings("deprecation")
+    private void removeIgnoredMethods(final Class<?> cls, final MethodRemover methodRemover) {
+        if (cls == null) {
+            return;
+        }
+
+        final Method[] methods = cls.getMethods();
+        for (final Method method : methods) {
+            removeAnnotatedMethods(methodRemover, method, Ignore.class);
+            removeAnnotatedMethods(methodRemover, method, Programmatic.class);
+        }
+    }
+
+    private static <T extends Annotation> void removeAnnotatedMethods(final MethodRemover methodRemover, final Method method, Class<T> annotationClass) {
+        if (!Annotations.isAnnotationPresent(method, annotationClass)) {
+            return;
+        } 
+        methodRemover.removeMethod(method);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/isis/RemoveSetDomainObjectContainerMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/isis/RemoveSetDomainObjectContainerMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/isis/RemoveSetDomainObjectContainerMethodFacetFactory.java
new file mode 100644
index 0000000..b6a6220
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/isis/RemoveSetDomainObjectContainerMethodFacetFactory.java
@@ -0,0 +1,42 @@
+/*
+ *  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.object.ignore.isis;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+
+/**
+ * Removes any calls to <tt>setContainer(DomainObjectContainer)</tt>.
+ */
+public class RemoveSetDomainObjectContainerMethodFacetFactory extends FacetFactoryAbstract {
+
+    public RemoveSetDomainObjectContainerMethodFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        processClassContext.removeMethod(MethodScope.OBJECT, "setContainer", void.class, new Class[] { DomainObjectContainer.class });
+        processClassContext.removeMethod(MethodScope.OBJECT, "set_Container", void.class, new Class[] { DomainObjectContainer.class });
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/isis/RemoveStaticGettersAndSettersFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/isis/RemoveStaticGettersAndSettersFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/isis/RemoveStaticGettersAndSettersFacetFactory.java
new file mode 100644
index 0000000..6a4571a
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/isis/RemoveStaticGettersAndSettersFacetFactory.java
@@ -0,0 +1,41 @@
+/*
+ *  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.object.ignore.isis;
+
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+
+/**
+ * Removes any static getter or setter methods.
+ */
+public class RemoveStaticGettersAndSettersFacetFactory extends FacetFactoryAbstract {
+
+    public RemoveStaticGettersAndSettersFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        processClassContext.removeMethods(MethodScope.CLASS, "get", null, false, 0);
+        processClassContext.removeMethods(MethodScope.CLASS, "set", null, false, 0);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/AbstractRemoveMethodsFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/AbstractRemoveMethodsFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/AbstractRemoveMethodsFacetFactory.java
new file mode 100644
index 0000000..11091db
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/AbstractRemoveMethodsFacetFactory.java
@@ -0,0 +1,81 @@
+/*
+ *  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.object.ignore.javalang;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+import org.apache.isis.core.commons.factory.InstanceUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+
+/**
+ * Removes all methods inherited specified class.
+ */
+public abstract class AbstractRemoveMethodsFacetFactory extends FacetFactoryAbstract {
+
+    private static class MethodAndParameterTypes {
+        private final String methodName;
+        private final Class<?>[] methodParameters;
+
+        public MethodAndParameterTypes(final String methodName, final Class<?>[] methodParameters) {
+            this.methodName = methodName;
+            this.methodParameters = methodParameters;
+        }
+    }
+
+    private final List<MethodAndParameterTypes> methodsToIgnore = Lists.newArrayList();
+
+    public AbstractRemoveMethodsFacetFactory(final Class<?> typeToIgnore) {
+        super(FeatureType.OBJECTS_ONLY);
+        final Method[] methods = typeToIgnore.getMethods();
+        for (final Method method : methods) {
+            methodsToIgnore.add(new MethodAndParameterTypes(method.getName(), method.getParameterTypes()));
+        }
+    }
+
+    public AbstractRemoveMethodsFacetFactory(final String typeToIgnoreIfOnClasspath) {
+        super(FeatureType.OBJECTS_ONLY);
+        try {
+            Class<?> typeToIgnore = InstanceUtil.loadClass(typeToIgnoreIfOnClasspath);
+            addMethodsToBeIgnored(typeToIgnore);
+        } catch(Exception ex) {
+            // ignore
+        }
+    }
+
+    private void addMethodsToBeIgnored(Class<?> typeToIgnore) {
+        final Method[] methods = typeToIgnore.getMethods();
+        for (final Method method : methods) {
+            methodsToIgnore.add(new MethodAndParameterTypes(method.getName(), method.getParameterTypes()));
+        }
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        for (final MethodAndParameterTypes mapt : methodsToIgnore) {
+            processClassContext.removeMethod(MethodScope.OBJECT, mapt.methodName, null, mapt.methodParameters);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/IteratorFilteringFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/IteratorFilteringFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/IteratorFilteringFacetFactory.java
new file mode 100644
index 0000000..eef92e5
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/IteratorFilteringFacetFactory.java
@@ -0,0 +1,56 @@
+/*
+ *  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.object.ignore.javalang;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodFilteringFacetFactory;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+
+/**
+ * Designed to simply filter out {@link Iterable#iterator()} method if it
+ * exists.
+ * 
+ * <p>
+ * Does not add any {@link Facet}s.
+ */
+public class IteratorFilteringFacetFactory extends FacetFactoryAbstract implements MethodFilteringFacetFactory {
+
+    public IteratorFilteringFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContaxt) {
+        processClassContaxt.removeMethod(MethodScope.OBJECT, "iterator", java.util.Iterator.class, new Class[] {});
+    }
+
+    @Override
+    public boolean recognizes(final Method method) {
+        if (method.toString().equals("public abstract java.util.Iterator java.lang.Iterable.iterator()")) {
+            return true;
+        }
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveGetClassMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveGetClassMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveGetClassMethodFacetFactory.java
new file mode 100644
index 0000000..91d6ec3
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveGetClassMethodFacetFactory.java
@@ -0,0 +1,44 @@
+/*
+ *  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.object.ignore.javalang;
+
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+
+/**
+ * Removes any static getter or setter methods.
+ * 
+ * <p>
+ * TODO: this is probably redundant given we also have
+ * {@link RemoveJavaLangObjectMethodsFacetFactory}.
+ */
+public class RemoveGetClassMethodFacetFactory extends FacetFactoryAbstract {
+
+    public RemoveGetClassMethodFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        processClassContext.removeMethod(MethodScope.OBJECT, "getClass", Class.class, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveInitMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveInitMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveInitMethodFacetFactory.java
new file mode 100644
index 0000000..f183e62
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveInitMethodFacetFactory.java
@@ -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.object.ignore.javalang;
+
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+
+/**
+ * Removes any calls to <tt>init</tt>.
+ */
+public class RemoveInitMethodFacetFactory extends FacetFactoryAbstract {
+
+    public RemoveInitMethodFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        processClassContext.removeMethod(MethodScope.OBJECT, "init", void.class, new Class[0]);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveJavaLangComparableMethodsFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveJavaLangComparableMethodsFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveJavaLangComparableMethodsFacetFactory.java
new file mode 100644
index 0000000..c46f966
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveJavaLangComparableMethodsFacetFactory.java
@@ -0,0 +1,31 @@
+/*
+ *  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.object.ignore.javalang;
+
+/**
+ * Removes all methods inherited from {@link Object}.
+ */
+public class RemoveJavaLangComparableMethodsFacetFactory extends AbstractRemoveMethodsFacetFactory {
+
+    public RemoveJavaLangComparableMethodsFacetFactory() {
+        super(Comparable.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveJavaLangObjectMethodsFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveJavaLangObjectMethodsFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveJavaLangObjectMethodsFacetFactory.java
new file mode 100644
index 0000000..318dd3c
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveJavaLangObjectMethodsFacetFactory.java
@@ -0,0 +1,31 @@
+/*
+ *  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.object.ignore.javalang;
+
+/**
+ * Removes all methods inherited from {@link Object}.
+ */
+public class RemoveJavaLangObjectMethodsFacetFactory extends AbstractRemoveMethodsFacetFactory {
+
+    public RemoveJavaLangObjectMethodsFacetFactory() {
+        super(Object.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveSuperclassMethodsFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveSuperclassMethodsFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveSuperclassMethodsFacetFactory.java
new file mode 100644
index 0000000..e86f641
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/RemoveSuperclassMethodsFacetFactory.java
@@ -0,0 +1,65 @@
+/*
+ *  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.object.ignore.javalang;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.core.commons.lang.JavaClassUtils;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facetapi.MethodRemover;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+/**
+ * Removes all superclass methods of the class, but doesn't add any
+ * {@link Facet}s.
+ */
+public class RemoveSuperclassMethodsFacetFactory extends FacetFactoryAbstract {
+
+    @SuppressWarnings("unused")
+    private static final String JAVA_CLASS_PREFIX = "java.";
+
+    public RemoveSuperclassMethodsFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        removeSuperclassMethods(processClassContext.getCls(), processClassContext);
+    }
+
+    private void removeSuperclassMethods(final Class<?> type, final MethodRemover methodRemover) {
+        if (type == null) {
+            return;
+        }
+
+        if (!JavaClassUtils.isJavaClass(type)) {
+            removeSuperclassMethods(type.getSuperclass(), methodRemover);
+            return;
+        }
+
+        final Method[] methods = type.getMethods();
+        for (final Method method : methods) {
+            methodRemover.removeMethod(method);
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/SyntheticMethodFilteringFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/SyntheticMethodFilteringFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/SyntheticMethodFilteringFacetFactory.java
new file mode 100644
index 0000000..5396624
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/javalang/SyntheticMethodFilteringFacetFactory.java
@@ -0,0 +1,62 @@
+/*
+ *  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.object.ignore.javalang;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodFilteringFacetFactory;
+
+/**
+ * Designed to simply filter out any synthetic methods.
+ * 
+ * <p>
+ * Does not add any {@link Facet}s.
+ */
+public class SyntheticMethodFilteringFacetFactory extends FacetFactoryAbstract implements MethodFilteringFacetFactory {
+
+    public SyntheticMethodFilteringFacetFactory() {
+        super(new ArrayList<FeatureType>());
+    }
+
+    @Override
+    public boolean recognizes(final Method method) {
+        return isSynthetic(method);
+    }
+
+    private boolean isSynthetic(final Method method) {
+        try {
+            final Class<?> type = method.getClass();
+            try {
+                return ((Boolean) type.getMethod("isSynthetic", (Class[]) null).invoke(method, (Object[]) null)).booleanValue();
+            } catch (final NoSuchMethodException nsm) {
+                // pre java 5
+                return false;
+            }
+        } catch (final Exception e) {
+            throw new IsisException(e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/jdo/RemoveJdoEnhancementTypesFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/jdo/RemoveJdoEnhancementTypesFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/jdo/RemoveJdoEnhancementTypesFacetFactory.java
new file mode 100644
index 0000000..b351a56
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/jdo/RemoveJdoEnhancementTypesFacetFactory.java
@@ -0,0 +1,34 @@
+/*
+ *  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.object.ignore.jdo;
+
+
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.AbstractRemoveMethodsFacetFactory;
+
+/**
+ * Removes all methods inherited from <tt>javax.jdo.spi.PersistenceCapable</tt> (if JDO is on the classpath).
+ */
+public class RemoveJdoEnhancementTypesFacetFactory extends AbstractRemoveMethodsFacetFactory {
+
+    public RemoveJdoEnhancementTypesFacetFactory() {
+        super("javax.jdo.spi.PersistenceCapable");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/jdo/RemoveJdoPrefixedMethodsFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/jdo/RemoveJdoPrefixedMethodsFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/jdo/RemoveJdoPrefixedMethodsFacetFactory.java
new file mode 100644
index 0000000..d0e5a78
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/ignore/jdo/RemoveJdoPrefixedMethodsFacetFactory.java
@@ -0,0 +1,48 @@
+/*
+ *  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.object.ignore.jdo;
+
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+/**
+ * Removes all methods inherited from <tt>javax.jdo.spi.PersistenceCapable</tt> (if JDO is on the classpath).
+ */
+public class RemoveJdoPrefixedMethodsFacetFactory extends FacetFactoryAbstract {
+
+    public RemoveJdoPrefixedMethodsFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+    
+    @Override
+    public void process(ProcessClassContext context) {
+        Class<?> cls = context.getCls();
+        Method[] methods = cls.getMethods();
+        for(Method method: methods) {
+            if(method.getName().startsWith("jdo")) {
+                context.removeMethod(method);
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/annotation/ImmutableAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/annotation/ImmutableAnnotationFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/annotation/ImmutableAnnotationFacetFactory.java
new file mode 100644
index 0000000..9377758
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/annotation/ImmutableAnnotationFacetFactory.java
@@ -0,0 +1,59 @@
+/*
+ *  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.object.immutable.annotation;
+
+import org.apache.isis.applib.annotation.Immutable;
+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.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.object.immutable.ImmutableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public class ImmutableAnnotationFacetFactory extends FacetFactoryAbstract {
+
+    public ImmutableAnnotationFacetFactory() {
+        super(FeatureType.EVERYTHING_BUT_PARAMETERS);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContaxt) {
+        final Immutable annotation = Annotations.getAnnotation(processClassContaxt.getCls(), Immutable.class);
+        FacetUtil.addFacet(create(annotation, processClassContaxt.getFacetHolder()));
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        final FacetedMethod member = processMethodContext.getFacetHolder();
+        final Class<?> owningClass = processMethodContext.getCls();
+        final ObjectSpecification owningSpec = getSpecificationLoader().loadSpecification(owningClass);
+        final ImmutableFacet facet = owningSpec.getFacet(ImmutableFacet.class);
+        if (facet != null) {
+            facet.copyOnto(member);
+        }
+    }
+
+    private ImmutableFacet create(final Immutable annotation, final FacetHolder holder) {
+        return annotation == null ? null : new ImmutableFacetAnnotation(annotation.value(), holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/annotation/ImmutableFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/annotation/ImmutableFacetAnnotation.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/annotation/ImmutableFacetAnnotation.java
new file mode 100644
index 0000000..532de02
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/annotation/ImmutableFacetAnnotation.java
@@ -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.object.immutable.annotation;
+
+import org.apache.isis.applib.annotation.When;
+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.facets.object.immutable.ImmutableFacetAbstract;
+
+public class ImmutableFacetAnnotation extends ImmutableFacetAbstract {
+
+    public ImmutableFacetAnnotation(final When value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+    @Override
+    public void copyOnto(final FacetHolder holder) {
+        final Facet facet = new ImmutableFacetAnnotation(this.when(), holder);
+        FacetUtil.addFacet(facet);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/markerifc/ImmutableFacetMarkerInterface.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/markerifc/ImmutableFacetMarkerInterface.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/markerifc/ImmutableFacetMarkerInterface.java
new file mode 100644
index 0000000..ffa4485
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/markerifc/ImmutableFacetMarkerInterface.java
@@ -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.object.immutable.markerifc;
+
+import org.apache.isis.applib.annotation.When;
+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.facets.object.immutable.ImmutableFacetAbstract;
+
+public class ImmutableFacetMarkerInterface extends ImmutableFacetAbstract {
+
+    public ImmutableFacetMarkerInterface(final When value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+    @Override
+    public void copyOnto(final FacetHolder holder) {
+        final Facet facet = new ImmutableFacetMarkerInterface(this.when(), holder);
+        FacetUtil.addFacet(facet);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/markerifc/ImmutableMarkerInterfaceFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/markerifc/ImmutableMarkerInterfaceFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/markerifc/ImmutableMarkerInterfaceFacetFactory.java
new file mode 100644
index 0000000..5780503
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/immutable/markerifc/ImmutableMarkerInterfaceFacetFactory.java
@@ -0,0 +1,45 @@
+/*
+ *  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.object.immutable.markerifc;
+
+import org.apache.isis.applib.annotation.When;
+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.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.object.immutable.ImmutableFacet;
+
+public class ImmutableMarkerInterfaceFacetFactory extends FacetFactoryAbstract {
+
+    public ImmutableMarkerInterfaceFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final When when = When.lookupForMarkerInterface(processClassContext.getCls());
+        FacetUtil.addFacet(create(when, processClassContext.getFacetHolder()));
+    }
+
+    private ImmutableFacet create(final When when, final FacetHolder holder) {
+        return when == null ? null : new ImmutableFacetMarkerInterface(when, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskEvaluator.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskEvaluator.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskEvaluator.java
new file mode 100644
index 0000000..e2245d9
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskEvaluator.java
@@ -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.object.mask;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class MaskEvaluator {
+
+    interface Converter {
+        void convert(String str, StringBuilder buf);
+    }
+
+    static class RegExConverter implements Converter {
+        private final String mask;
+        private final String regex;
+
+        public RegExConverter(final String mask, final String regex) {
+            this.mask = mask;
+            this.regex = regex;
+        }
+
+        public String getMask() {
+            return mask;
+        }
+
+        public String getRegex() {
+            return regex;
+        }
+
+        @Override
+        public void convert(final String str, final StringBuilder buf) {
+            final String convert = str.replace(mask, regex);
+            if (!convert.equals(str)) {
+                buf.append(convert);
+            }
+        }
+    }
+
+    @SuppressWarnings("serial")
+    private static List<Converter> converters = new ArrayList<Converter>() {
+        {
+            add("#", "[0-9]");
+            // add(".", "[\\" +
+            // DecimalFormatSymbols.getInstance().getDecimalSeparator()+"]");
+            // add(",",
+            // "["+DecimalFormatSymbols.getInstance().getGroupingSeparator()+"]");
+            add("&", "[A-Za-z]");
+            add("?", "[A-Za-z]");
+            add("A", "[A-Za-z0-9]");
+            add("a", "[ A-Za-z0-9]");
+            add("9", "[ 0-9]");
+            add("U", "[A-Z]");
+            add("L", "[a-z]");
+
+            add(new Converter() {
+                @Override
+                public void convert(final String str, final StringBuilder buf) {
+                    if (buf.length() == 0) {
+                        buf.append(str);
+                    }
+                }
+            });
+        }
+
+        public void add(final String mask, final String regex) {
+            add(new RegExConverter(mask, regex));
+        }
+    };
+
+    private final Pattern pattern;
+
+    public MaskEvaluator(final String mask) {
+        final StringBuilder buf = new StringBuilder();
+        for (int i = 0; i < mask.length(); i++) {
+            final String charAt = "" + mask.charAt(i);
+            for (final Converter converter : converters) {
+                converter.convert(charAt, buf);
+            }
+        }
+        pattern = Pattern.compile(buf.toString());
+    }
+
+    public boolean evaluate(final String str) {
+        return pattern.matcher(str).matches();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskFacet.java
new file mode 100644
index 0000000..007982e
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskFacet.java
@@ -0,0 +1,46 @@
+/*
+ *  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.object.mask;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.SingleStringValueFacet;
+import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
+import org.apache.isis.core.progmodel.facets.object.regex.RegExFacet;
+
+/**
+ * Whether the (string) property or a parameter must correspond to a specific
+ * mask.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to the
+ * <tt>@Mask</tt> annotation.
+ * 
+ * <p>
+ * TODO: not yet implemented by the framework or any viewer.
+ * 
+ * @see RegExFacet
+ */
+public interface MaskFacet extends SingleStringValueFacet, ValidatingInteractionAdvisor {
+
+    /**
+     * Whether the provided string matches the mask.
+     */
+    public boolean doesNotMatch(ObjectAdapter adapter);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskFacetAbstract.java
new file mode 100644
index 0000000..8fc83c3
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/MaskFacetAbstract.java
@@ -0,0 +1,53 @@
+/*
+ *  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.object.mask;
+
+import org.apache.isis.applib.events.ValidityEvent;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.SingleStringValueFacetAbstract;
+import org.apache.isis.core.metamodel.interactions.ProposedHolder;
+import org.apache.isis.core.metamodel.interactions.ValidityContext;
+
+public abstract class MaskFacetAbstract extends SingleStringValueFacetAbstract implements MaskFacet {
+
+    public static Class<? extends Facet> type() {
+        return MaskFacet.class;
+    }
+
+    public MaskFacetAbstract(final String value, final FacetHolder holder) {
+        super(type(), holder, value);
+    }
+
+    @Override
+    public String invalidates(final ValidityContext<? extends ValidityEvent> context) {
+        if (!(context instanceof ProposedHolder)) {
+            return null;
+        }
+        final ProposedHolder proposedHolder = (ProposedHolder) context;
+        final ObjectAdapter proposedArgument = proposedHolder.getProposed();
+        if (doesNotMatch(proposedArgument)) {
+            return "'" + proposedArgument.titleString() + "' does not match the mask '" + value() + "'";
+        }
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/TitleFacetBasedOnMask.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/TitleFacetBasedOnMask.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/TitleFacetBasedOnMask.java
new file mode 100644
index 0000000..affe150
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/TitleFacetBasedOnMask.java
@@ -0,0 +1,50 @@
+/*
+ *  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.object.mask;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.title.TitleFacet;
+import org.apache.isis.core.metamodel.facets.object.title.TitleFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.title.TitleFacetUsingParser;
+
+public class TitleFacetBasedOnMask extends TitleFacetAbstract {
+    private final MaskFacet maskFacet;
+    private final TitleFacet underlyingTitleFacet;
+
+    public TitleFacetBasedOnMask(final MaskFacet maskFacet, final TitleFacet underlyingTitleFacet) {
+        super(maskFacet.getFacetHolder());
+        this.maskFacet = maskFacet;
+        this.underlyingTitleFacet = underlyingTitleFacet;
+    }
+
+    @Override
+    public String title(final ObjectAdapter object, final Localization localization) {
+        final String mask = maskFacet.value();
+        final TitleFacetUsingParser titleFacetUsingParser = (TitleFacetUsingParser) underlyingTitleFacet.getUnderlyingFacet();
+        if (titleFacetUsingParser != null) {
+            final String titleString = titleFacetUsingParser.title(object, mask);
+            return titleString;
+        } else {
+            return underlyingTitleFacet.title(object, localization);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/annotation/MaskAnnotationForTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/annotation/MaskAnnotationForTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/annotation/MaskAnnotationForTypeFacetFactory.java
new file mode 100644
index 0000000..4589c3d
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/annotation/MaskAnnotationForTypeFacetFactory.java
@@ -0,0 +1,49 @@
+/*
+ *  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.object.mask.annotation;
+
+import org.apache.isis.applib.annotation.Mask;
+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.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskFacet;
+
+public class MaskAnnotationForTypeFacetFactory extends FacetFactoryAbstract {
+
+    public MaskAnnotationForTypeFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    /**
+     * In readiness for supporting <tt>@Value</tt> in the future.
+     */
+    @Override
+    public void process(final ProcessClassContext processClassContaxt) {
+        final Mask annotation = Annotations.getAnnotation(processClassContaxt.getCls(), Mask.class);
+        FacetUtil.addFacet(createMaskFacet(annotation, processClassContaxt.getFacetHolder()));
+    }
+
+    private MaskFacet createMaskFacet(final Mask annotation, final FacetHolder holder) {
+        return annotation != null ? new MaskFacetAnnotationForType(annotation.value(), null, holder) : null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/annotation/MaskFacetAnnotationForType.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/annotation/MaskFacetAnnotationForType.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/annotation/MaskFacetAnnotationForType.java
new file mode 100644
index 0000000..0b9074c
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/mask/annotation/MaskFacetAnnotationForType.java
@@ -0,0 +1,51 @@
+/*
+ *  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.object.mask.annotation;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskEvaluator;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskFacetAbstract;
+
+public class MaskFacetAnnotationForType extends MaskFacetAbstract {
+    private final MaskEvaluator evaluator;
+
+    public MaskFacetAnnotationForType(final String outputMask, final String inputMask, final FacetHolder holder) {
+        super(outputMask, holder);
+        evaluator = inputMask == null ? null : new MaskEvaluator(inputMask);
+    }
+
+    @Override
+    public boolean doesNotMatch(final ObjectAdapter adapter) {
+        if (evaluator == null) {
+            return false;
+        } else {
+            if (adapter == null) {
+                return false;
+            }
+            final Object object = adapter.getObject();
+            if (object == null) {
+                return false;
+            }
+            return !evaluator.evaluate(object.toString());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/maxlen/annotation/MaxLengthAnnotationForTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/maxlen/annotation/MaxLengthAnnotationForTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/maxlen/annotation/MaxLengthAnnotationForTypeFacetFactory.java
new file mode 100644
index 0000000..d344b87
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/maxlen/annotation/MaxLengthAnnotationForTypeFacetFactory.java
@@ -0,0 +1,48 @@
+/*
+ *  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.object.maxlen.annotation;
+
+import org.apache.isis.applib.annotation.MaxLength;
+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.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.maxlen.MaxLengthFacet;
+
+public class MaxLengthAnnotationForTypeFacetFactory extends FacetFactoryAbstract {
+
+    public MaxLengthAnnotationForTypeFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    /**
+     * In readiness for supporting <tt>@Value</tt> in the future.
+     */
+    @Override
+    public void process(final ProcessClassContext processClassContaxt) {
+        final MaxLength annotation = Annotations.getAnnotation(processClassContaxt.getCls(), MaxLength.class);
+        FacetUtil.addFacet(create(annotation, processClassContaxt.getFacetHolder()));
+    }
+
+    private MaxLengthFacet create(final MaxLength annotation, final FacetHolder holder) {
+        return annotation == null ? null : new MaxLengthFacetAnnotationForType(annotation.value(), holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/maxlen/annotation/MaxLengthFacetAnnotationForType.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/maxlen/annotation/MaxLengthFacetAnnotationForType.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/maxlen/annotation/MaxLengthFacetAnnotationForType.java
new file mode 100644
index 0000000..44ca38d
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/maxlen/annotation/MaxLengthFacetAnnotationForType.java
@@ -0,0 +1,31 @@
+/*
+ *  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.object.maxlen.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.maxlen.MaxLengthFacetAbstract;
+
+public class MaxLengthFacetAnnotationForType extends MaxLengthFacetAbstract {
+
+    public MaxLengthFacetAnnotationForType(final int value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/MemberGroupsFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/MemberGroupsFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/MemberGroupsFacetAbstract.java
new file mode 100644
index 0000000..606a74e
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/MemberGroupsFacetAbstract.java
@@ -0,0 +1,38 @@
+/*
+ *  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.object.membergroups;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.SingleValueFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupsFacet;
+
+public abstract class MemberGroupsFacetAbstract extends SingleValueFacetAbstract<List<String>> implements MemberGroupsFacet {
+
+    public static Class<? extends Facet> type() {
+        return MemberGroupsFacet.class;
+    }
+
+    public MemberGroupsFacetAbstract(List<String> value, FacetHolder holder) {
+        super(type(), value, holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsAnnotationElseFallbackFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsAnnotationElseFallbackFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsAnnotationElseFallbackFacetFactory.java
new file mode 100644
index 0000000..bde3d7f
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsAnnotationElseFallbackFacetFactory.java
@@ -0,0 +1,53 @@
+/*
+ *  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.object.membergroups.annotation;
+
+import org.apache.isis.applib.annotation.MemberGroups;
+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.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.object.facets.FacetsFacet;
+import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupsFacet;
+
+public class MemberGroupsAnnotationElseFallbackFacetFactory extends FacetFactoryAbstract {
+
+    public MemberGroupsAnnotationElseFallbackFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContaxt) {
+        final MemberGroups annotation = Annotations.getAnnotation(processClassContaxt.getCls(), MemberGroups.class);
+        FacetUtil.addFacet(create(annotation, processClassContaxt.getFacetHolder()));
+    }
+
+    /**
+     * Returns a {@link FacetsFacet} impl provided that at least one valid
+     * {@link FacetsFacet#facetFactories() factory} was specified.
+     */
+    private MemberGroupsFacet create(final MemberGroups annotation, final FacetHolder holder) {
+        if (annotation == null) {
+            return new MemberGroupsFacetFallback(holder);
+        }
+        return new MemberGroupsFacetAnnotation(annotation, holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsFacetAnnotation.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsFacetAnnotation.java
new file mode 100644
index 0000000..aaa561d
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsFacetAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  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.object.membergroups.annotation;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.isis.applib.annotation.MemberGroups;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupsFacet;
+import org.apache.isis.core.progmodel.facets.object.membergroups.MemberGroupsFacetAbstract;
+
+public class MemberGroupsFacetAnnotation extends MemberGroupsFacetAbstract {
+
+    private static List<String> asList(final String[] value) {
+        return value == null || value.length == 0 
+                ? Arrays.asList(MemberGroupsFacet.DEFAULT_GROUP) 
+                : Arrays.asList(value);
+    }
+    
+    public MemberGroupsFacetAnnotation(final MemberGroups annotation, final FacetHolder holder) {
+        super(asList(annotation.value()), holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsFacetFallback.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsFacetFallback.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsFacetFallback.java
new file mode 100644
index 0000000..18979fb
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/membergroups/annotation/MemberGroupsFacetFallback.java
@@ -0,0 +1,34 @@
+/*
+ *  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.object.membergroups.annotation;
+
+import java.util.Arrays;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupsFacet;
+import org.apache.isis.core.progmodel.facets.object.membergroups.MemberGroupsFacetAbstract;
+
+public class MemberGroupsFacetFallback extends MemberGroupsFacetAbstract {
+
+    public MemberGroupsFacetFallback(final FacetHolder holder) {
+        super(Arrays.asList(MemberGroupsFacet.DEFAULT_GROUP), holder);
+    }
+
+}