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

[22/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/callbacks/load/LoadingCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/load/LoadingCallbackFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/load/LoadingCallbackFacetViaMethod.java
new file mode 100644
index 0000000..58d82d9
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/load/LoadingCallbackFacetViaMethod.java
@@ -0,0 +1,71 @@
+/*
+ *  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.callbacks.load;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+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.ImperativeFacet;
+
+public class LoadingCallbackFacetViaMethod extends LoadingCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public LoadingCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return false;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        AdapterInvokeUtils.invoke(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistCallbackFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistCallbackFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistCallbackFacetFactory.java
new file mode 100644
index 0000000..c6a0bd8
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistCallbackFacetFactory.java
@@ -0,0 +1,80 @@
+/*
+ *  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.callbacks.persist;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+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.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistedCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistingCallbackFacet;
+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 PersistCallbackFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.PERSISTED_PREFIX, MethodPrefixConstants.PERSISTING_PREFIX, };
+
+    public PersistCallbackFacetFactory() {
+        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 List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.PERSISTING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final PersistingCallbackFacet facet = facetHolder.getFacet(PersistingCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new PersistingCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.PERSISTED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final PersistedCallbackFacet facet = facetHolder.getFacet(PersistedCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new PersistedCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistCallbackViaSaveMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistCallbackViaSaveMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistCallbackViaSaveMethodFacetFactory.java
new file mode 100644
index 0000000..38aa30b
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistCallbackViaSaveMethodFacetFactory.java
@@ -0,0 +1,80 @@
+/*
+ *  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.callbacks.persist;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+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.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistedCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistingCallbackFacet;
+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 PersistCallbackViaSaveMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.SAVED_PREFIX, MethodPrefixConstants.SAVING_PREFIX, };
+
+    public PersistCallbackViaSaveMethodFacetFactory() {
+        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 List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.SAVING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final PersistingCallbackFacet facet = facetHolder.getFacet(PersistingCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new PersistingCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.SAVED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final PersistedCallbackFacet facet = facetHolder.getFacet(PersistedCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new PersistedCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistedCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistedCallbackFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistedCallbackFacetAbstract.java
new file mode 100644
index 0000000..a23b19b
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistedCallbackFacetAbstract.java
@@ -0,0 +1,37 @@
+/*
+ *  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.callbacks.persist;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistedCallbackFacet;
+import org.apache.isis.core.progmodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class PersistedCallbackFacetAbstract extends CallbackFacetAbstract implements PersistedCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return PersistedCallbackFacet.class;
+    }
+
+    public PersistedCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), 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/callbacks/persist/PersistedCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistedCallbackFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistedCallbackFacetViaMethod.java
new file mode 100644
index 0000000..616e6c1
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistedCallbackFacetViaMethod.java
@@ -0,0 +1,71 @@
+/*
+ *  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.callbacks.persist;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+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.ImperativeFacet;
+
+public class PersistedCallbackFacetViaMethod extends PersistedCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public PersistedCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return false;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        AdapterInvokeUtils.invoke(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistingCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistingCallbackFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistingCallbackFacetAbstract.java
new file mode 100644
index 0000000..88bfba1
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistingCallbackFacetAbstract.java
@@ -0,0 +1,37 @@
+/*
+ *  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.callbacks.persist;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistingCallbackFacet;
+import org.apache.isis.core.progmodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class PersistingCallbackFacetAbstract extends CallbackFacetAbstract implements PersistingCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return PersistingCallbackFacet.class;
+    }
+
+    public PersistingCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), 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/callbacks/persist/PersistingCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistingCallbackFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistingCallbackFacetViaMethod.java
new file mode 100644
index 0000000..ad35aca
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/persist/PersistingCallbackFacetViaMethod.java
@@ -0,0 +1,71 @@
+/*
+ *  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.callbacks.persist;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+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.ImperativeFacet;
+
+public class PersistingCallbackFacetViaMethod extends PersistingCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public PersistingCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return false;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        AdapterInvokeUtils.invoke(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemoveCallbackFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemoveCallbackFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemoveCallbackFacetFactory.java
new file mode 100644
index 0000000..a71160b
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemoveCallbackFacetFactory.java
@@ -0,0 +1,80 @@
+/*
+ *  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.callbacks.remove;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+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.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.object.callbacks.RemovedCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.RemovingCallbackFacet;
+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 RemoveCallbackFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.REMOVED_PREFIX, MethodPrefixConstants.REMOVING_PREFIX, };
+
+    public RemoveCallbackFacetFactory() {
+        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 List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.REMOVING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final RemovingCallbackFacet facet = facetHolder.getFacet(RemovingCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new RemovingCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.REMOVED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final RemovedCallbackFacet facet = facetHolder.getFacet(RemovedCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new RemovedCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemoveCallbackViaDeleteMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemoveCallbackViaDeleteMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemoveCallbackViaDeleteMethodFacetFactory.java
new file mode 100644
index 0000000..c878579
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemoveCallbackViaDeleteMethodFacetFactory.java
@@ -0,0 +1,80 @@
+/*
+ *  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.callbacks.remove;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+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.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.object.callbacks.RemovedCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.RemovingCallbackFacet;
+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 RemoveCallbackViaDeleteMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.DELETED_PREFIX, MethodPrefixConstants.DELETING_PREFIX, };
+
+    public RemoveCallbackViaDeleteMethodFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        final List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.DELETING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final RemovingCallbackFacet facet = holder.getFacet(RemovingCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new RemovingCallbackFacetViaMethod(method, holder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.DELETED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final RemovedCallbackFacet facet = holder.getFacet(RemovedCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new RemovedCallbackFacetViaMethod(method, holder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovedCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovedCallbackFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovedCallbackFacetAbstract.java
new file mode 100644
index 0000000..fd4f01c
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovedCallbackFacetAbstract.java
@@ -0,0 +1,37 @@
+/*
+ *  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.callbacks.remove;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.RemovedCallbackFacet;
+import org.apache.isis.core.progmodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class RemovedCallbackFacetAbstract extends CallbackFacetAbstract implements RemovedCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return RemovedCallbackFacet.class;
+    }
+
+    public RemovedCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), 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/callbacks/remove/RemovedCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovedCallbackFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovedCallbackFacetViaMethod.java
new file mode 100644
index 0000000..2de2fa7
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovedCallbackFacetViaMethod.java
@@ -0,0 +1,71 @@
+/*
+ *  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.callbacks.remove;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+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.ImperativeFacet;
+
+public class RemovedCallbackFacetViaMethod extends RemovedCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public RemovedCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return false;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        AdapterInvokeUtils.invoke(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovingCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovingCallbackFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovingCallbackFacetAbstract.java
new file mode 100644
index 0000000..d1ceaf7
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovingCallbackFacetAbstract.java
@@ -0,0 +1,37 @@
+/*
+ *  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.callbacks.remove;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.RemovingCallbackFacet;
+import org.apache.isis.core.progmodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class RemovingCallbackFacetAbstract extends CallbackFacetAbstract implements RemovingCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return RemovingCallbackFacet.class;
+    }
+
+    public RemovingCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), 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/callbacks/remove/RemovingCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovingCallbackFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovingCallbackFacetViaMethod.java
new file mode 100644
index 0000000..0f5940a
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/remove/RemovingCallbackFacetViaMethod.java
@@ -0,0 +1,71 @@
+/*
+ *  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.callbacks.remove;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+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.ImperativeFacet;
+
+public class RemovingCallbackFacetViaMethod extends RemovingCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public RemovingCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return false;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        AdapterInvokeUtils.invoke(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdateCallbackFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdateCallbackFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdateCallbackFacetFactory.java
new file mode 100644
index 0000000..32c9a53
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdateCallbackFacetFactory.java
@@ -0,0 +1,68 @@
+/*
+ *  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.callbacks.update;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+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.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;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+
+public class UpdateCallbackFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.UPDATED_PREFIX, MethodPrefixConstants.UPDATING_PREFIX, };
+
+    public UpdateCallbackFacetFactory() {
+        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 List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.UPDATING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            facets.add(new UpdatingCallbackFacetViaMethod(method, facetHolder));
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.UPDATED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            facets.add(new UpdatedCallbackFacetViaMethod(method, facetHolder));
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatedCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatedCallbackFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatedCallbackFacetAbstract.java
new file mode 100644
index 0000000..85b06fb
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatedCallbackFacetAbstract.java
@@ -0,0 +1,37 @@
+/*
+ *  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.callbacks.update;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.UpdatedCallbackFacet;
+import org.apache.isis.core.progmodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class UpdatedCallbackFacetAbstract extends CallbackFacetAbstract implements UpdatedCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return UpdatedCallbackFacet.class;
+    }
+
+    public UpdatedCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), 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/callbacks/update/UpdatedCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatedCallbackFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatedCallbackFacetViaMethod.java
new file mode 100644
index 0000000..ce8e5d4
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatedCallbackFacetViaMethod.java
@@ -0,0 +1,71 @@
+/*
+ *  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.callbacks.update;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+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.ImperativeFacet;
+
+public class UpdatedCallbackFacetViaMethod extends UpdatedCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public UpdatedCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return false;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        AdapterInvokeUtils.invoke(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatingCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatingCallbackFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatingCallbackFacetAbstract.java
new file mode 100644
index 0000000..71bf816
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatingCallbackFacetAbstract.java
@@ -0,0 +1,37 @@
+/*
+ *  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.callbacks.update;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.UpdatingCallbackFacet;
+import org.apache.isis.core.progmodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class UpdatingCallbackFacetAbstract extends CallbackFacetAbstract implements UpdatingCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return UpdatingCallbackFacet.class;
+    }
+
+    public UpdatingCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), 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/callbacks/update/UpdatingCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatingCallbackFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatingCallbackFacetViaMethod.java
new file mode 100644
index 0000000..1a7ff19
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/callbacks/update/UpdatingCallbackFacetViaMethod.java
@@ -0,0 +1,71 @@
+/*
+ *  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.callbacks.update;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+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.ImperativeFacet;
+
+public class UpdatingCallbackFacetViaMethod extends UpdatingCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public UpdatingCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return false;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        AdapterInvokeUtils.invoke(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/ChoicesFacetEnum.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/ChoicesFacetEnum.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/ChoicesFacetEnum.java
new file mode 100644
index 0000000..6fb73c7
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/ChoicesFacetEnum.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.choices.enums;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.choices.ChoicesFacetAbstract;
+
+public class ChoicesFacetEnum extends ChoicesFacetAbstract {
+
+    private final Object[] choices;
+
+    public ChoicesFacetEnum(final FacetHolder holder, final Object[] choices) {
+        super(holder);
+        this.choices = choices;
+    }
+
+    @Override
+    public Object[] getChoices(final ObjectAdapter adapter) {
+        return choices;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumFacet.java
new file mode 100644
index 0000000..5254d51
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumFacet.java
@@ -0,0 +1,26 @@
+/*
+ *  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.choices.enums;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface EnumFacet extends 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/choices/enums/EnumFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumFacetFactory.java
new file mode 100644
index 0000000..c951b3a
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumFacetFactory.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.choices.enums;
+
+import org.apache.isis.core.commons.lang.CastUtils;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class EnumFacetFactory<T extends Enum<T>> extends ValueUsingValueSemanticsProviderFacetFactory<T> {
+
+    public EnumFacetFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (!cls.isEnum()) {
+            return;
+        }
+
+        addFacets(new EnumValueSemanticsProvider<T>(holder, asT(cls), getConfiguration(), getContext()));
+        FacetUtil.addFacet(new ChoicesFacetEnum(holder, cls.getEnumConstants()));
+    }
+
+    protected Class<T> asT(final Class<?> cls) {
+        return CastUtils.cast(cls);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumValueSemanticsProvider.java
new file mode 100644
index 0000000..a10e271
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/choices/enums/EnumValueSemanticsProvider.java
@@ -0,0 +1,86 @@
+/*
+ *  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.choices.enums;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public class EnumValueSemanticsProvider<T extends Enum<T>> extends ValueSemanticsProviderAndFacetAbstract<T> implements EnumFacet {
+
+    private static final int TYPICAL_LENGTH = 8;
+
+    private static <T> T defaultFor(final Class<T> adaptedClass) {
+        return adaptedClass.getEnumConstants()[0];
+    }
+
+    private static Class<? extends Facet> type() {
+        return EnumFacet.class;
+    }
+    
+    /**
+     * Required because {@link Parser} and {@link EncoderDecoder}.
+     */
+    public EnumValueSemanticsProvider() {
+        this(null, null, null, null);
+    }
+
+    public EnumValueSemanticsProvider(final FacetHolder holder, final Class<T> adaptedClass, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, adaptedClass, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, defaultFor(adaptedClass), configuration, context);
+    }
+
+    @Override
+    protected T doParse(final Object context, final String entry) {
+        final T[] enumConstants = getAdaptedClass().getEnumConstants();
+        for (final T enumConstant : enumConstants) {
+            if (enumConstant.toString().equals(entry)) {
+                return enumConstant;
+            }
+        }
+        throw new TextEntryParseException("Unknown enum constant '" + entry + "'");
+    }
+
+    @Override
+    protected String doEncode(final Object object) {
+        return titleString(object, null);
+    }
+
+    @Override
+    protected T doRestore(final String data) {
+        return doParse(null, data);
+    }
+
+    @Override
+    protected String titleString(final Object object, final Localization localization) {
+        return object.toString();
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(value, 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/defaults/DefaultedFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacet.java
new file mode 100644
index 0000000..a6d7dd1
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacet.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.defaults;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.MarkerFacet;
+import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet;
+import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
+
+/**
+ * Indicates that this class has a default.
+ * 
+ * <p>
+ * The mechanism for providing a default will vary by the applib. In the Java
+ * applib, this is done by implementing the DefaultProvider interface.
+ * 
+ * <p>
+ * The rest of the framework does not used this directly, but instead we infer
+ * {@link PropertyDefaultFacet} and {@link ActionDefaultsFacet} from the
+ * method's return type / parameter types, and copy over.
+ */
+public interface DefaultedFacet extends MarkerFacet {
+
+    /**
+     * The default (as a pojo, not a {@link ObjectAdapter}).
+     * 
+     * @return
+     */
+    Object getDefault();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAbstract.java
new file mode 100644
index 0000000..2eec4fc
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetAbstract.java
@@ -0,0 +1,85 @@
+/*
+ *  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.defaults;
+
+import org.apache.isis.applib.adapters.DefaultsProvider;
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.core.commons.lang.ClassUtil;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+public abstract class DefaultedFacetAbstract extends FacetAbstract implements DefaultedFacet {
+
+    private final Class<?> defaultsProviderClass;
+
+    // to delegate to
+    private final DefaultedFacetUsingDefaultsProvider defaultedFacetUsingDefaultsProvider;
+
+    private final ServicesInjector dependencyInjector;
+
+    public DefaultedFacetAbstract(final String candidateEncoderDecoderName, final Class<?> candidateEncoderDecoderClass, final FacetHolder holder, final ServicesInjector dependencyInjector) {
+        super(DefaultedFacet.class, holder, Derivation.NOT_DERIVED);
+
+        this.defaultsProviderClass = DefaultsProviderUtil.defaultsProviderOrNull(candidateEncoderDecoderClass, candidateEncoderDecoderName);
+        this.dependencyInjector = dependencyInjector;
+        if (isValid()) {
+            final DefaultsProvider<?> defaultsProvider = (DefaultsProvider<?>) ClassUtil.newInstance(defaultsProviderClass, FacetHolder.class, holder);
+            this.defaultedFacetUsingDefaultsProvider = new DefaultedFacetUsingDefaultsProvider(defaultsProvider, holder, getDependencyInjector());
+        } else {
+            this.defaultedFacetUsingDefaultsProvider = null;
+        }
+    }
+
+    /**
+     * Discover whether either of the candidate defaults provider name or class
+     * is valid.
+     */
+    public boolean isValid() {
+        return defaultsProviderClass != null;
+    }
+
+    /**
+     * Guaranteed to implement the {@link EncoderDecoder} class, thanks to
+     * generics in the applib.
+     */
+    public Class<?> getDefaultsProviderClass() {
+        return defaultsProviderClass;
+    }
+
+    @Override
+    public Object getDefault() {
+        return defaultedFacetUsingDefaultsProvider.getDefault();
+    }
+
+    @Override
+    protected String toStringValues() {
+        return defaultsProviderClass.getName();
+    }
+
+    // //////////////////////////////////////////////////////
+    // Dependencies (from constructor)
+    // //////////////////////////////////////////////////////
+
+    private ServicesInjector getDependencyInjector() {
+        return dependencyInjector;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetUsingDefaultsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetUsingDefaultsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetUsingDefaultsProvider.java
new file mode 100644
index 0000000..20fda30
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultedFacetUsingDefaultsProvider.java
@@ -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.object.defaults;
+
+import org.apache.isis.applib.adapters.DefaultsProvider;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+public class DefaultedFacetUsingDefaultsProvider extends FacetAbstract implements DefaultedFacet {
+
+    private final DefaultsProvider<?> defaultsProvider;
+    private final ServicesInjector dependencyInjector;
+
+    public DefaultedFacetUsingDefaultsProvider(final DefaultsProvider<?> parser, final FacetHolder holder, final ServicesInjector dependencyInjector) {
+        super(DefaultedFacet.class, holder, Derivation.NOT_DERIVED);
+        this.defaultsProvider = parser;
+        this.dependencyInjector = dependencyInjector;
+    }
+
+    @Override
+    protected String toStringValues() {
+        getDependencyInjector().injectServicesInto(defaultsProvider);
+        return defaultsProvider.toString();
+    }
+
+    @Override
+    public Object getDefault() {
+        getDependencyInjector().injectServicesInto(defaultsProvider);
+        return defaultsProvider.getDefaultValue();
+    }
+
+    // //////////////////////////////////////////////////////
+    // Dependencies (from constructor)
+    // //////////////////////////////////////////////////////
+
+    public ServicesInjector getDependencyInjector() {
+        return dependencyInjector;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultsProviderUtil.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultsProviderUtil.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultsProviderUtil.java
new file mode 100644
index 0000000..ac2aa46
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/DefaultsProviderUtil.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.defaults;
+
+import org.apache.isis.applib.adapters.DefaultsProvider;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.lang.JavaClassUtils;
+import org.apache.isis.core.commons.lang.StringUtils;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+public final class DefaultsProviderUtil {
+
+    private DefaultsProviderUtil() {
+    }
+
+    public static final String DEFAULTS_PROVIDER_NAME_KEY_PREFIX = "isis.reflector.java.facets.defaulted.";
+    public static final String DEFAULTS_PROVIDER_NAME_KEY_SUFFIX = ".providerName";
+
+    public static String defaultsProviderNameFromConfiguration(final Class<?> type, final IsisConfiguration configuration) {
+        final String key = DEFAULTS_PROVIDER_NAME_KEY_PREFIX + type.getCanonicalName() + DEFAULTS_PROVIDER_NAME_KEY_SUFFIX;
+        final String defaultsProviderName = configuration.getString(key);
+        return !StringUtils.isNullOrEmpty(defaultsProviderName) ? defaultsProviderName : null;
+    }
+
+    public static Class<?> defaultsProviderOrNull(final Class<?> candidateClass, final String classCandidateName) {
+        final Class<?> type = candidateClass != null ? JavaClassUtils.implementingClassOrNull(candidateClass.getName(), DefaultsProvider.class, FacetHolder.class) : null;
+        return type != null ? type : JavaClassUtils.implementingClassOrNull(classCandidateName, DefaultsProvider.class, FacetHolder.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/defaults/annotation/DefaultedAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/annotation/DefaultedAnnotationFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/annotation/DefaultedAnnotationFacetFactory.java
new file mode 100644
index 0000000..04e2be3
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/annotation/DefaultedAnnotationFacetFactory.java
@@ -0,0 +1,95 @@
+/*
+ *  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.defaults.annotation;
+
+import org.apache.isis.applib.annotation.Defaulted;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationAware;
+import org.apache.isis.core.commons.lang.StringUtils;
+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.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
+import org.apache.isis.core.progmodel.facets.object.defaults.DefaultedFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.defaults.DefaultsProviderUtil;
+
+public class DefaultedAnnotationFacetFactory extends FacetFactoryAbstract implements IsisConfigurationAware, ServicesInjectorAware {
+
+    private IsisConfiguration configuration;
+    private ServicesInjector servicesInjector;
+
+    public DefaultedAnnotationFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        FacetUtil.addFacet(create(processClassContext.getCls(), processClassContext.getFacetHolder()));
+    }
+
+    private DefaultedFacetAbstract create(final Class<?> cls, final FacetHolder holder) {
+        final Defaulted annotation = Annotations.getAnnotation(cls, Defaulted.class);
+
+        // create from annotation, if present
+        if (annotation != null) {
+            final DefaultedFacetAbstract facet = new DefaultedFacetAnnotation(cls, getIsisConfiguration(), holder, getServicesInjector());
+            if (facet.isValid()) {
+                return facet;
+            }
+        }
+
+        // otherwise, try to create from configuration, if present
+        final String providerName = DefaultsProviderUtil.defaultsProviderNameFromConfiguration(cls, getIsisConfiguration());
+        if (!StringUtils.isNullOrEmpty(providerName)) {
+            final DefaultedFacetFromConfiguration facet = new DefaultedFacetFromConfiguration(providerName, holder, getServicesInjector());
+            if (facet.isValid()) {
+                return facet;
+            }
+        }
+
+        return null;
+    }
+
+    // ////////////////////////////////////////////////////////////////////
+    // Injected
+    // ////////////////////////////////////////////////////////////////////
+
+    public IsisConfiguration getIsisConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public void setConfiguration(final IsisConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    private ServicesInjector getServicesInjector() {
+        return servicesInjector;
+    }
+
+    @Override
+    public void setServicesInjector(final ServicesInjector dependencyInjector) {
+        this.servicesInjector = dependencyInjector;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/annotation/DefaultedFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/annotation/DefaultedFacetAnnotation.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/annotation/DefaultedFacetAnnotation.java
new file mode 100644
index 0000000..4087758
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/object/defaults/annotation/DefaultedFacetAnnotation.java
@@ -0,0 +1,54 @@
+/*
+ *  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.defaults.annotation;
+
+import org.apache.isis.applib.annotation.Defaulted;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.lang.StringUtils;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.progmodel.facets.object.defaults.DefaultedFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.defaults.DefaultsProviderUtil;
+
+public class DefaultedFacetAnnotation extends DefaultedFacetAbstract {
+
+    private static String providerName(final Class<?> annotatedClass, final IsisConfiguration configuration) {
+        final Defaulted annotation = annotatedClass.getAnnotation(Defaulted.class);
+        final String providerName = annotation.defaultsProviderName();
+        if (!StringUtils.isNullOrEmpty(providerName)) {
+            return providerName;
+        }
+        return DefaultsProviderUtil.defaultsProviderNameFromConfiguration(annotatedClass, configuration);
+    }
+
+    private static Class<?> providerClass(final Class<?> annotatedClass) {
+        final Defaulted annotation = annotatedClass.getAnnotation(Defaulted.class);
+        return annotation.defaultsProviderClass();
+    }
+
+    public DefaultedFacetAnnotation(final Class<?> annotatedClass, final IsisConfiguration configuration, final FacetHolder holder, final ServicesInjector dependencyInjector) {
+        this(providerName(annotatedClass, configuration), providerClass(annotatedClass), holder, dependencyInjector);
+    }
+
+    private DefaultedFacetAnnotation(final String candidateProviderName, final Class<?> candidateProviderClass, final FacetHolder holder, final ServicesInjector dependencyInjector) {
+        super(candidateProviderName, candidateProviderClass, holder, dependencyInjector);
+    }
+
+}