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:10 UTC

[28/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/param/choices/method/ActionChoicesFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/method/ActionChoicesFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/method/ActionChoicesFacetViaMethod.java
new file mode 100644
index 0000000..34a6934
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/method/ActionChoicesFacetViaMethod.java
@@ -0,0 +1,110 @@
+/*
+ *  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.param.choices.method;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.commons.lang.ArrayUtil;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.actions.choices.ActionChoicesFacetAbstract;
+import org.apache.isis.core.metamodel.spec.DomainModelException;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.CollectionUtils;
+
+public class ActionChoicesFacetViaMethod extends ActionChoicesFacetAbstract implements ImperativeFacet {
+
+    private final Method method;
+    private final Class<?> choicesType;
+    private final SpecificationLoader specificationLookup;
+    private final AdapterManager adapterMap;
+
+    public ActionChoicesFacetViaMethod(final Method method, final Class<?> choicesType, final FacetHolder holder, final SpecificationLoader specificationLookup, final AdapterManager adapterManager) {
+        super(holder);
+        this.method = method;
+        this.choicesType = choicesType;
+        this.specificationLookup = specificationLookup;
+        this.adapterMap = adapterManager;
+    }
+
+    /**
+     * Returns a singleton list of the {@link Method} provided in the
+     * constructor.
+     */
+    @Override
+    public List<Method> getMethods() {
+        return Collections.singletonList(method);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return true;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public Object[][] getChoices(final ObjectAdapter owningAdapter) {
+        final Object invoke = AdapterInvokeUtils.invoke(method, owningAdapter);
+        if (!(invoke instanceof Object[])) {
+            throw new DomainModelException("Expected an array of collections (Object[]) containing choices for all parameters, but got " + invoke + " instead. Perhaps the parameter number is missing!");
+        }
+        final Object[] options = (Object[]) invoke;
+        final Object[][] results = new Object[options.length][];
+        for (int i = 0; i < results.length; i++) {
+            if (options[i] == null) {
+                results[i] = null;
+            } else if (options[i].getClass().isArray()) {
+                results[i] = ArrayUtil.getObjectAsObjectArray(options[i]);
+            } else {
+                final ObjectSpecification specification = getSpecificationLookup().loadSpecification(choicesType);
+                results[i] = CollectionUtils.getCollectionAsObjectArray(options[i], specification, getAdapterMap());
+            }
+        }
+        return results;
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "method=" + method + ",type=" + choicesType;
+    }
+
+    // ///////////////////////////////////////////////////////
+    // Dependencies
+    // ///////////////////////////////////////////////////////
+
+    private SpecificationLoader getSpecificationLookup() {
+        return specificationLookup;
+    }
+
+    private AdapterManager getAdapterMap() {
+        return adapterMap;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetFactory.java
new file mode 100644
index 0000000..62f585f
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetFactory.java
@@ -0,0 +1,128 @@
+/*
+ *  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.param.choices.methodnum;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.isis.core.commons.lang.NameUtils;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
+import org.apache.isis.core.metamodel.exceptions.MetaModelException;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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.FacetedMethodParameter;
+import org.apache.isis.core.metamodel.facets.actions.choices.ActionChoicesFacet;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+
+/**
+ * Sets up all the {@link Facet}s for an action in a single shot.
+ */
+public class ActionParameterChoicesFacetFactory extends MethodPrefixBasedFacetFactoryAbstract implements AdapterManagerAware {
+
+    private static final String[] PREFIXES = {};
+
+    private AdapterManager adapterManager;
+
+    /**
+     * Note that the {@link Facet}s registered are the generic ones from
+     * noa-architecture (where they exist)
+     */
+    public ActionParameterChoicesFacetFactory() {
+        super(FeatureType.ACTIONS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    // ///////////////////////////////////////////////////////
+    // Actions
+    // ///////////////////////////////////////////////////////
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+
+        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
+        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();
+
+        attachChoicesFacetForParametersIfChoicesNumMethodIsFound(processMethodContext, holderList);
+
+    }
+
+    private void attachChoicesFacetForParametersIfChoicesNumMethodIsFound(final ProcessMethodContext processMethodContext, final List<FacetedMethodParameter> parameters) {
+
+        if (parameters.isEmpty()) {
+            return;
+        }
+
+        final Method actionMethod = processMethodContext.getMethod();
+        final Class<?>[] params = actionMethod.getParameterTypes();
+
+        for (int i = 0; i < params.length; i++) {
+
+            final Class<?> arrayOfParamType = (Array.newInstance(params[i], 0)).getClass();
+
+            Method choicesMethod = findChoicesNumMethodReturning(processMethodContext, i, arrayOfParamType);
+            if (choicesMethod == null) {
+                choicesMethod = findChoicesNumMethodReturning(processMethodContext, i, List.class);
+            }
+            if (choicesMethod == null) {
+                continue;
+            }
+            processMethodContext.removeMethod(choicesMethod);
+
+            final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
+            if (facetedMethod.containsDoOpFacet(ActionChoicesFacet.class)) {
+                final Class<?> cls = processMethodContext.getCls();
+                throw new MetaModelException(cls + " uses both old and new choices syntax - must use one or other");
+            }
+
+            // add facets directly to parameters, not to actions
+            final FacetedMethodParameter paramAsHolder = parameters.get(i);
+            FacetUtil.addFacet(new ActionParameterChoicesFacetViaMethod(choicesMethod, arrayOfParamType, paramAsHolder, getSpecificationLoader(), getAdapterManager()));
+        }
+    }
+
+    private Method findChoicesNumMethodReturning(final ProcessMethodContext processMethodContext, final int i, final Class<?> arrayOfParamType) {
+
+        final Class<?> cls = processMethodContext.getCls();
+        final Method actionMethod = processMethodContext.getMethod();
+        final String capitalizedName = NameUtils.capitalizeName(actionMethod.getName());
+        final String name = MethodPrefixConstants.CHOICES_PREFIX + i + capitalizedName;
+        return MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, name, arrayOfParamType, new Class[0]);
+    }
+
+    // ///////////////////////////////////////////////////////////////
+    // Dependencies
+    // ///////////////////////////////////////////////////////////////
+
+    @Override
+    public void setAdapterManager(final AdapterManager adapterManager) {
+        this.adapterManager = adapterManager;
+    }
+
+    private AdapterManager getAdapterManager() {
+        return adapterManager;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetViaMethod.java
new file mode 100644
index 0000000..5feb056
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetViaMethod.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.param.choices.methodnum;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.commons.lang.ArrayUtil;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.CollectionUtils;
+import org.apache.isis.core.progmodel.facets.param.choices.ActionParameterChoicesFacetAbstract;
+
+public class ActionParameterChoicesFacetViaMethod extends ActionParameterChoicesFacetAbstract implements ImperativeFacet {
+
+    private final Method method;
+    private final Class<?> choicesType;
+
+    public ActionParameterChoicesFacetViaMethod(final Method method, final Class<?> choicesType, final FacetHolder holder, final SpecificationLoader specificationLookup, final AdapterManager adapterManager) {
+        super(holder, specificationLookup, adapterManager);
+        this.method = method;
+        this.choicesType = choicesType;
+    }
+
+    /**
+     * Returns a singleton list of the {@link Method} provided in the
+     * constructor.
+     */
+    @Override
+    public List<Method> getMethods() {
+        return Collections.singletonList(method);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return true;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public Object[] getChoices(final ObjectAdapter owningAdapter) {
+        final Object options = AdapterInvokeUtils.invoke(method, owningAdapter);
+        if (options == null) {
+            return new Object[0];
+        }
+        if (options.getClass().isArray()) {
+            return ArrayUtil.getObjectAsObjectArray(options);
+        } else {
+            final ObjectSpecification specification = getSpecification(choicesType);
+            return CollectionUtils.getCollectionAsObjectArray(options, specification, getAdapterManager());
+        }
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "method=" + method + ",type=" + choicesType;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetAbstract.java
new file mode 100644
index 0000000..eb0f8a0
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetAbstract.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.param.defaults;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.param.defaults.ActionParameterDefaultsFacet;
+
+public abstract class ActionParameterDefaultsFacetAbstract extends FacetAbstract implements ActionParameterDefaultsFacet {
+
+    public static Class<? extends Facet> type() {
+        return ActionParameterDefaultsFacet.class;
+    }
+
+    public ActionParameterDefaultsFacetAbstract(final FacetHolder holder) {
+        super(type(), holder, Derivation.NOT_DERIVED);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetNone.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetNone.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetNone.java
new file mode 100644
index 0000000..85b4c3b
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetNone.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.param.defaults;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+public class ActionParameterDefaultsFacetNone extends ActionParameterDefaultsFacetAbstract {
+
+    public ActionParameterDefaultsFacetNone(final FacetHolder holder) {
+        super(holder);
+    }
+
+    @Override
+    public Object getDefault(final ObjectAdapter inObject) {
+        return null;
+    }
+
+    @Override
+    public boolean isNoop() {
+        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/param/defaults/fromtype/ActionParameterDefaultFacetDerivedFromTypeFacets.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ActionParameterDefaultFacetDerivedFromTypeFacets.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ActionParameterDefaultFacetDerivedFromTypeFacets.java
new file mode 100644
index 0000000..a7523a9
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ActionParameterDefaultFacetDerivedFromTypeFacets.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.param.defaults.fromtype;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.defaults.DefaultedFacet;
+
+public class ActionParameterDefaultFacetDerivedFromTypeFacets extends ActionDefaultsFacetAbstract {
+
+    private final DefaultedFacet[] defaultedFacets;
+
+    public ActionParameterDefaultFacetDerivedFromTypeFacets(final DefaultedFacet[] defaultedFacets, final FacetHolder holder) {
+        super(holder, Derivation.DERIVED);
+        this.defaultedFacets = defaultedFacets;
+    }
+
+    /**
+     * Return the defaults.
+     * 
+     * <p>
+     * Note that we get the defaults fresh each time in case the defaults might
+     * conceivably change.
+     */
+    @Override
+    public Object[] getDefaults(final ObjectAdapter inObject) {
+        final Object[] defaults = new Object[defaultedFacets.length];
+        for (int i = 0; i < defaults.length; i++) {
+            if (defaultedFacets[i] != null) {
+                defaults[i] = defaultedFacets[i].getDefault();
+            }
+        }
+        return defaults;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ParameterDefaultDerivedFromTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ParameterDefaultDerivedFromTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ParameterDefaultDerivedFromTypeFacetFactory.java
new file mode 100644
index 0000000..97c4629
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ParameterDefaultDerivedFromTypeFacetFactory.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.param.defaults.fromtype;
+
+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.actions.defaults.ActionDefaultsFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.progmodel.facets.object.defaults.DefaultedFacet;
+
+public class ParameterDefaultDerivedFromTypeFacetFactory extends FacetFactoryAbstract {
+
+    public ParameterDefaultDerivedFromTypeFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    /**
+     * If there is a {@link DefaultedFacet} on any of the action's parameter
+     * types, then installs a {@link ActionDefaultsFacet} for the action.
+     */
+    @Override
+    public void processParams(final ProcessParameterContext processParameterContext) {
+        // don't overwrite any defaults already picked up
+        if (processParameterContext.getFacetHolder().getFacet(ActionDefaultsFacet.class) != null) {
+            return;
+        }
+
+        // try to infer defaults from any of the parameter's underlying types
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
+        final DefaultedFacet[] parameterTypeDefaultedFacets = new DefaultedFacet[parameterTypes.length];
+        boolean hasAtLeastOneDefault = false;
+        for (int i = 0; i < parameterTypes.length; i++) {
+            final Class<?> paramType = parameterTypes[i];
+            parameterTypeDefaultedFacets[i] = getDefaultedFacet(paramType);
+            hasAtLeastOneDefault = hasAtLeastOneDefault | (parameterTypeDefaultedFacets[i] != null);
+        }
+        if (hasAtLeastOneDefault) {
+            FacetUtil.addFacet(new ActionParameterDefaultFacetDerivedFromTypeFacets(parameterTypeDefaultedFacets, processParameterContext.getFacetHolder()));
+        }
+    }
+
+    private DefaultedFacet getDefaultedFacet(final Class<?> paramType) {
+        final ObjectSpecification paramTypeSpec = getSpecificationLoader().loadSpecification(paramType);
+        return paramTypeSpec.getFacet(DefaultedFacet.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/methodnum/ActionParameterDefaultsFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/methodnum/ActionParameterDefaultsFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/methodnum/ActionParameterDefaultsFacetFactory.java
new file mode 100644
index 0000000..afe97f0
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/methodnum/ActionParameterDefaultsFacetFactory.java
@@ -0,0 +1,98 @@
+/*
+ *  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.param.defaults.methodnum;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.isis.core.commons.lang.NameUtils;
+import org.apache.isis.core.metamodel.exceptions.MetaModelException;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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.FacetedMethodParameter;
+import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+
+/**
+ * Sets up all the {@link Facet}s for an action in a single shot.
+ */
+public class ActionParameterDefaultsFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = {};
+
+    /**
+     * Note that the {@link Facet}s registered are the generic ones from
+     * noa-architecture (where they exist)
+     */
+    public ActionParameterDefaultsFacetFactory() {
+        super(FeatureType.ACTIONS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    // ///////////////////////////////////////////////////////
+    // Actions
+    // ///////////////////////////////////////////////////////
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+
+        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
+        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();
+
+        attachDefaultFacetForParametersIfDefaultsNumMethodIsFound(processMethodContext, holderList);
+    }
+
+    private static void attachDefaultFacetForParametersIfDefaultsNumMethodIsFound(final ProcessMethodContext processMethodContext, final List<FacetedMethodParameter> parameters) {
+
+        if (parameters.isEmpty()) {
+            return;
+        }
+
+        final Class<?> cls = processMethodContext.getCls();
+        final Method actionMethod = processMethodContext.getMethod();
+
+        final Class<?>[] paramTypes = actionMethod.getParameterTypes();
+        final String capitalizedName = NameUtils.capitalizeName(actionMethod.getName());
+
+        for (int i = 0; i < paramTypes.length; i++) {
+
+            final Method defaultMethod = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.DEFAULT_PREFIX + i + capitalizedName, paramTypes[i], new Class[0]);
+
+            if (defaultMethod == null) {
+                continue;
+            }
+            processMethodContext.removeMethod(defaultMethod);
+
+            final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
+            if (facetedMethod.containsDoOpFacet(ActionDefaultsFacet.class)) {
+                throw new MetaModelException(cls + " uses both old and new default syntax for " + actionMethod.getName() + "(...) - must use one or other");
+            }
+
+            // add facets directly to parameters, not to actions
+            final FacetedMethodParameter paramAsHolder = parameters.get(i);
+            FacetUtil.addFacet(new ActionParameterDefaultsFacetViaMethod(defaultMethod, paramAsHolder));
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/methodnum/ActionParameterDefaultsFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/methodnum/ActionParameterDefaultsFacetViaMethod.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/methodnum/ActionParameterDefaultsFacetViaMethod.java
new file mode 100644
index 0000000..d935c0e
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/methodnum/ActionParameterDefaultsFacetViaMethod.java
@@ -0,0 +1,70 @@
+/*
+ *  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.param.defaults.methodnum;
+
+import java.lang.reflect.Method;
+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;
+import org.apache.isis.core.progmodel.facets.param.defaults.ActionParameterDefaultsFacetAbstract;
+
+public class ActionParameterDefaultsFacetViaMethod extends ActionParameterDefaultsFacetAbstract implements ImperativeFacet {
+
+    private final Method method;
+
+    public ActionParameterDefaultsFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        this.method = method;
+    }
+
+    /**
+     * Returns a singleton list of the {@link Method} provided in the
+     * constructor.
+     */
+    @Override
+    public List<Method> getMethods() {
+        return Collections.singletonList(method);
+    }
+
+    @Override
+    public boolean impliesResolve() {
+        return true;
+    }
+
+    @Override
+    public boolean impliesObjectChanged() {
+        return false;
+    }
+
+    @Override
+    public Object getDefault(final ObjectAdapter owningAdapter) {
+        return AdapterInvokeUtils.invoke(method, owningAdapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "method=" + method;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsAnnotationOnParameterFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsAnnotationOnParameterFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsAnnotationOnParameterFacetFactory.java
new file mode 100644
index 0000000..cc6e86d
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsAnnotationOnParameterFacetFactory.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.param.describedas.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.DescribedAs;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public class DescribedAsAnnotationOnParameterFacetFactory extends FacetFactoryAbstract {
+
+    public DescribedAsAnnotationOnParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(final ProcessParameterContext processParameterContext) {
+
+        final int paramNum = processParameterContext.getParamNum();
+        final Class<?> parameterType = processParameterContext.getMethod().getParameterTypes()[paramNum];
+        final Annotation[] parameterAnnotations = Annotations.getParameterAnnotations(processParameterContext.getMethod())[paramNum];
+        for (final Annotation parameterAnnotation : parameterAnnotations) {
+            if (parameterAnnotation instanceof DescribedAs) {
+                FacetUtil.addFacet(create((DescribedAs) parameterAnnotation, processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+
+        // otherwise, fall back to a description on the parameter's type, if
+        // available
+        final DescribedAsFacet parameterTypeDescribedAsFacet = getDescribedAsFacet(parameterType);
+        if (parameterTypeDescribedAsFacet != null) {
+            FacetUtil.addFacet(new DescribedAsFacetForParameterDerivedFromType(parameterTypeDescribedAsFacet, processParameterContext.getFacetHolder()));
+            return;
+        }
+
+    }
+
+    private DescribedAsFacet create(final DescribedAs annotation, final FacetHolder holder) {
+        return annotation == null ? null : new DescribedAsFacetAnnotationOnParameter(annotation.value(), holder);
+    }
+
+    private DescribedAsFacet getDescribedAsFacet(final Class<?> type) {
+        final ObjectSpecification paramTypeSpec = getSpecificationLoader().loadSpecification(type);
+        return paramTypeSpec.getFacet(DescribedAsFacet.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetAnnotationOnParameter.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetAnnotationOnParameter.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetAnnotationOnParameter.java
new file mode 100644
index 0000000..f265dad
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetAnnotationOnParameter.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.param.describedas.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetAnnotationOnParameter extends DescribedAsFacetAbstract {
+
+    public DescribedAsFacetAnnotationOnParameter(final String 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/param/describedas/annotation/DescribedAsFacetForParameterDerivedFromType.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetForParameterDerivedFromType.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetForParameterDerivedFromType.java
new file mode 100644
index 0000000..3f9ceab
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetForParameterDerivedFromType.java
@@ -0,0 +1,32 @@
+/*
+ *  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.param.describedas.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetForParameterDerivedFromType extends DescribedAsFacetAbstract {
+
+    public DescribedAsFacetForParameterDerivedFromType(final DescribedAsFacet describedAsFacet, final FacetHolder holder) {
+        super(describedAsFacet.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/param/describedas/staticmethod/ActionParameterDescriptionsMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/staticmethod/ActionParameterDescriptionsMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/staticmethod/ActionParameterDescriptionsMethodFacetFactory.java
new file mode 100644
index 0000000..e32d99f
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/staticmethod/ActionParameterDescriptionsMethodFacetFactory.java
@@ -0,0 +1,101 @@
+/*
+ *  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.param.describedas.staticmethod;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.isis.core.commons.lang.NameUtils;
+import org.apache.isis.core.metamodel.adapter.util.InvokeUtils;
+import org.apache.isis.core.metamodel.exceptions.MetaModelException;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.FacetedMethodParameter;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+import org.apache.isis.core.progmodel.facets.members.describedas.staticmethod.DescribedAsFacetViaMethod;
+
+public class ActionParameterDescriptionsMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.DESCRIPTION_PREFIX };
+
+    /**
+     * Note that the {@link Facet}s registered are the generic ones from
+     * noa-architecture (where they exist)
+     */
+    public ActionParameterDescriptionsMethodFacetFactory() {
+        super(FeatureType.ACTIONS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    // ///////////////////////////////////////////////////////
+    // Actions
+    // ///////////////////////////////////////////////////////
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+
+        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
+        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();
+
+        attachDescribedAsFacetForParametersIfParameterDescriptionsMethodIsFound(processMethodContext, holderList);
+    }
+
+    private static void attachDescribedAsFacetForParametersIfParameterDescriptionsMethodIsFound(final ProcessMethodContext processMethodContext, final List<FacetedMethodParameter> parameters) {
+
+        if (parameters.isEmpty()) {
+            return;
+        }
+
+        final Method actionMethod = processMethodContext.getMethod();
+
+        final String capitalizedName = NameUtils.capitalizeName(actionMethod.getName());
+
+        final Class<?> cls = processMethodContext.getCls();
+        final Method descriptionMethod = MethodFinderUtils.findMethod(cls, MethodScope.CLASS, MethodPrefixConstants.DESCRIPTION_PREFIX + capitalizedName, String[].class, new Class[0]);
+        if (descriptionMethod == null) {
+            return;
+        }
+        processMethodContext.removeMethod(descriptionMethod);
+
+        final String[] descriptions = invokeDescriptionsMethod(descriptionMethod, parameters.size());
+        for (int i = 0; i < descriptions.length; i++) {
+            // add facets directly to parameters, not to actions
+            FacetUtil.addFacet(new DescribedAsFacetViaMethod(descriptions[i], descriptionMethod, parameters.get(i)));
+        }
+    }
+
+    private static String[] invokeDescriptionsMethod(final Method descriptionMethod, final int numElementsRequired) {
+        String[] descriptions = null;
+        try {
+            descriptions = (String[]) InvokeUtils.invokeStatic(descriptionMethod, new Object[0]);
+        } catch (final ClassCastException ex) {
+            // ignore
+        }
+        if (descriptions == null || descriptions.length != numElementsRequired) {
+            throw new MetaModelException(descriptionMethod + " must return an String[] array of same size as number of parameters of action");
+        }
+        return descriptions;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/MandatoryFacetInvertedByOptionalForParameter.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/MandatoryFacetInvertedByOptionalForParameter.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/MandatoryFacetInvertedByOptionalForParameter.java
new file mode 100644
index 0000000..21ff14f
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/MandatoryFacetInvertedByOptionalForParameter.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.param.mandatory.annotation;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+/**
+ * Derived by presence of an <tt>@Optional</tt> method.
+ * 
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i>
+ * mandatory, as per {@link #isInvertedSemantics()}.
+ */
+public class MandatoryFacetInvertedByOptionalForParameter extends MandatoryFacetAbstract {
+
+    public MandatoryFacetInvertedByOptionalForParameter(final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in
+     * fact optional.
+     */
+    @Override
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    @Override
+    public boolean isInvertedSemantics() {
+        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/param/mandatory/annotation/OptionalAnnotationForParameterFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/OptionalAnnotationForParameterFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/OptionalAnnotationForParameterFacetFactory.java
new file mode 100644
index 0000000..d390b63
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/OptionalAnnotationForParameterFacetFactory.java
@@ -0,0 +1,55 @@
+/*
+ *  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.param.mandatory.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.Optional;
+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;
+
+public class OptionalAnnotationForParameterFacetFactory extends FacetFactoryAbstract {
+
+    public OptionalAnnotationForParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(final ProcessParameterContext processParameterContext) {
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
+        if (processParameterContext.getParamNum() >= parameterTypes.length) {
+            // ignore
+            return;
+        }
+        if (parameterTypes[processParameterContext.getParamNum()].isPrimitive()) {
+            return;
+        }
+        final Annotation[] parameterAnnotations = Annotations.getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (final Annotation parameterAnnotation : parameterAnnotations) {
+            if (parameterAnnotation instanceof Optional) {
+                FacetUtil.addFacet(new MandatoryFacetInvertedByOptionalForParameter(processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/dflt/MandatoryDefaultForParametersFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/dflt/MandatoryDefaultForParametersFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/dflt/MandatoryDefaultForParametersFacetFactory.java
new file mode 100644
index 0000000..b438d5e
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/dflt/MandatoryDefaultForParametersFacetFactory.java
@@ -0,0 +1,57 @@
+/*
+ *  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.param.mandatory.dflt;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
+import org.apache.isis.core.metamodel.specloader.facetprocessor.FacetProcessor;
+
+/**
+ * Simply installs a {@link MandatoryFacetDefault} onto all properties and
+ * parameters.
+ * 
+ * <p>
+ * The idea is that this {@link FacetFactory} is included early on in the
+ * {@link FacetProcessor}, but other {@link MandatoryFacet} implementations
+ * which don't require mandatory semantics will potentially replace these where
+ * the property or parameter is annotated or otherwise indicated as being
+ * optional.
+ */
+public class MandatoryDefaultForParametersFacetFactory extends FacetFactoryAbstract {
+
+    public MandatoryDefaultForParametersFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(final ProcessParameterContext processParameterContext) {
+        FacetUtil.addFacet(create(processParameterContext.getFacetHolder()));
+    }
+
+    private MandatoryFacet create(final FacetHolder holder) {
+        return new MandatoryFacetDefault(holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/ActionParameterOptionalViaMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/ActionParameterOptionalViaMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/ActionParameterOptionalViaMethodFacetFactory.java
new file mode 100644
index 0000000..b802639
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/ActionParameterOptionalViaMethodFacetFactory.java
@@ -0,0 +1,104 @@
+/*
+ *  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.param.mandatory.staticmethod;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.isis.core.commons.lang.NameUtils;
+import org.apache.isis.core.metamodel.adapter.util.InvokeUtils;
+import org.apache.isis.core.metamodel.exceptions.MetaModelException;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.FacetedMethodParameter;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+
+/**
+ * Sets up all the {@link Facet}s for an action in a single shot.
+ */
+public class ActionParameterOptionalViaMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.OPTIONAL_PREFIX };
+
+    /**
+     * Note that the {@link Facet}s registered are the generic ones from
+     * noa-architecture (where they exist)
+     */
+    public ActionParameterOptionalViaMethodFacetFactory() {
+        super(FeatureType.ACTIONS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+
+        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
+        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();
+
+        attachMandatoryFacetForParametersIfOptionalMethodIsFound(processMethodContext, holderList);
+
+    }
+
+    private static void attachMandatoryFacetForParametersIfOptionalMethodIsFound(final ProcessMethodContext processMethodContext, final List<FacetedMethodParameter> parameters) {
+
+        if (parameters.isEmpty()) {
+            return;
+        }
+
+        final Method actionMethod = processMethodContext.getMethod();
+        final String capitalizedName = NameUtils.capitalizeName(actionMethod.getName());
+
+        final Class<?> cls = processMethodContext.getCls();
+        final Method optionalMethod = MethodFinderUtils.findMethod(cls, MethodScope.CLASS, MethodPrefixConstants.OPTIONAL_PREFIX + capitalizedName, boolean[].class, new Class[0]);
+        if (optionalMethod == null) {
+            return;
+        }
+        try {
+            final boolean[] optionals = invokeOptionalsMethod(optionalMethod, parameters.size());
+
+            for (int i = 0; i < optionals.length; i++) {
+                if (optionals[i]) {
+                    // add facets directly to parameters, not to actions
+                    FacetUtil.addFacet(new MandatoryFacetOptionalViaMethodForParameter(parameters.get(i)));
+                }
+            }
+        } finally {
+            processMethodContext.removeMethod(optionalMethod);
+        }
+    }
+
+    private static boolean[] invokeOptionalsMethod(final Method optionalMethod, final int numElementsRequired) {
+        boolean[] optionals = null;
+        try {
+            optionals = (boolean[]) InvokeUtils.invokeStatic(optionalMethod, new Object[0]);
+        } catch (final ClassCastException ex) {
+            // ignore, test below
+        }
+        if (optionals == null || optionals.length != numElementsRequired) {
+            throw new MetaModelException(optionalMethod + " must return an boolean[] array of same size as number of parameters of action");
+        }
+        return optionals;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/MandatoryFacetOptionalViaMethodForParameter.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/MandatoryFacetOptionalViaMethodForParameter.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/MandatoryFacetOptionalViaMethodForParameter.java
new file mode 100644
index 0000000..1c7231f
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/MandatoryFacetOptionalViaMethodForParameter.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.param.mandatory.staticmethod;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+/**
+ * Derived by presence of an <tt>optionalXxx</tt> method.
+ * 
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i>
+ * mandatory, as per {@link #isInvertedSemantics()}.
+ */
+public class MandatoryFacetOptionalViaMethodForParameter extends MandatoryFacetAbstract {
+
+    public MandatoryFacetOptionalViaMethodForParameter(final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in
+     * fact optional.
+     */
+    @Override
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    @Override
+    public boolean isInvertedSemantics() {
+        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/param/multiline/annotation/MultiLineAnnotationOnParameterFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineAnnotationOnParameterFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineAnnotationOnParameterFacetFactory.java
new file mode 100644
index 0000000..7bb3758
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineAnnotationOnParameterFacetFactory.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.param.multiline.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.MultiLine;
+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.multiline.MultiLineFacet;
+
+public class MultiLineAnnotationOnParameterFacetFactory extends FacetFactoryAbstract {
+
+    public MultiLineAnnotationOnParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(final ProcessParameterContext processParameterContext) {
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
+        if (processParameterContext.getParamNum() >= parameterTypes.length) {
+            // ignore
+            return;
+        }
+        if (!Annotations.isString(parameterTypes[processParameterContext.getParamNum()])) {
+            return;
+        }
+        final Annotation[] parameterAnnotations = Annotations.getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (final Annotation parameterAnnotation : parameterAnnotations) {
+            if (parameterAnnotation instanceof MultiLine) {
+                final MultiLine annotation = (MultiLine) parameterAnnotation;
+                FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+    }
+
+    private MultiLineFacet create(final MultiLine annotation, final FacetHolder holder) {
+        return (annotation != null) ? new MultiLineFacetAnnotationOnParameter(annotation.numberOfLines(), annotation.preventWrapping(), 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/param/multiline/annotation/MultiLineFacetAnnotationOnParameter.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineFacetAnnotationOnParameter.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineFacetAnnotationOnParameter.java
new file mode 100644
index 0000000..95a1bb2
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineFacetAnnotationOnParameter.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.param.multiline.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacetAbstract;
+
+public class MultiLineFacetAnnotationOnParameter extends MultiLineFacetAbstract {
+
+    public MultiLineFacetAnnotationOnParameter(final int numberOfLines, final boolean preventWrapping, final FacetHolder holder) {
+        super(numberOfLines, preventWrapping, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedAnnotationOnParameterFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedAnnotationOnParameterFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedAnnotationOnParameterFacetFactory.java
new file mode 100644
index 0000000..4ce7412
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedAnnotationOnParameterFacetFactory.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.param.named.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.Named;
+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.named.NamedFacet;
+
+public class NamedAnnotationOnParameterFacetFactory extends FacetFactoryAbstract {
+
+    public NamedAnnotationOnParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(final ProcessParameterContext processParameterContext) {
+        final Annotation[] parameterAnnotations = Annotations.getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (final Annotation parameterAnnotation : parameterAnnotations) {
+            if (parameterAnnotation instanceof Named) {
+                final Named annotation = (Named) parameterAnnotation;
+                FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+    }
+
+    private NamedFacet create(final Named annotation, final FacetHolder holder) {
+        return annotation != null ? new NamedFacetAnnotationOnParameter(annotation.value(), 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/param/named/annotation/NamedFacetAnnotationOnParameter.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedFacetAnnotationOnParameter.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedFacetAnnotationOnParameter.java
new file mode 100644
index 0000000..d60eb8f
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedFacetAnnotationOnParameter.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.param.named.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.named.NamedFacetAbstract;
+
+public class NamedFacetAnnotationOnParameter extends NamedFacetAbstract {
+
+    public NamedFacetAnnotationOnParameter(final String 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/param/named/staticmethod/ActionParameterNamesMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/staticmethod/ActionParameterNamesMethodFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/staticmethod/ActionParameterNamesMethodFacetFactory.java
new file mode 100644
index 0000000..43f2df7
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/staticmethod/ActionParameterNamesMethodFacetFactory.java
@@ -0,0 +1,104 @@
+/*
+ *  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.param.named.staticmethod;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.isis.core.commons.lang.NameUtils;
+import org.apache.isis.core.metamodel.adapter.util.InvokeUtils;
+import org.apache.isis.core.metamodel.exceptions.MetaModelException;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.FacetedMethodParameter;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
+import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
+import org.apache.isis.core.progmodel.facets.members.named.staticmethod.NamedFacetViaMethod;
+
+/**
+ * Sets up all the {@link Facet}s for an action in a single shot.
+ */
+public class ActionParameterNamesMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.NAME_PREFIX };
+
+    /**
+     * Note that the {@link Facet}s registered are the generic ones from
+     * noa-architecture (where they exist)
+     */
+    public ActionParameterNamesMethodFacetFactory() {
+        super(FeatureType.ACTIONS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    // ///////////////////////////////////////////////////////
+    // Actions
+    // ///////////////////////////////////////////////////////
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+
+        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
+        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();
+
+        attachNamedFacetForParametersIfParameterNamesMethodIsFound(processMethodContext, holderList);
+    }
+
+    private static void attachNamedFacetForParametersIfParameterNamesMethodIsFound(final ProcessMethodContext processMethodContext, final List<FacetedMethodParameter> parameters) {
+
+        if (parameters.isEmpty()) {
+            return;
+        }
+
+        final Method actionMethod = processMethodContext.getMethod();
+        final String capitalizedName = NameUtils.capitalizeName(actionMethod.getName());
+
+        final Class<?> cls = processMethodContext.getCls();
+        final Method namesMethod = MethodFinderUtils.findMethod(cls, MethodScope.CLASS, MethodPrefixConstants.NAME_PREFIX + capitalizedName, String[].class, new Class[0]);
+        if (namesMethod == null) {
+            return;
+        }
+        try {
+            final String[] names = invokeNamesMethod(namesMethod, parameters.size());
+            for (int i = 0; i < names.length; i++) {
+                // add facets directly to parameters, not to actions
+                FacetUtil.addFacet(new NamedFacetViaMethod(names[i], namesMethod, parameters.get(i)));
+            }
+        } finally {
+            processMethodContext.removeMethod(namesMethod);
+        }
+    }
+
+    private static String[] invokeNamesMethod(final Method namesMethod, final int numElementsRequired) {
+        String[] names = null;
+        try {
+            names = (String[]) InvokeUtils.invokeStatic(namesMethod, new Object[0]);
+        } catch (final ClassCastException ex) {
+            // ignore
+        }
+        if (names == null || names.length != numElementsRequired) {
+            throw new MetaModelException(namesMethod + " must return an String[] array of same size as number of parameters of action");
+        }
+        return names;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthAnnotationOnParameterFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthAnnotationOnParameterFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthAnnotationOnParameterFacetFactory.java
new file mode 100644
index 0000000..31c2701
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthAnnotationOnParameterFacetFactory.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.param.typicallen.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.TypicalLength;
+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.typicallen.TypicalLengthFacet;
+
+public class TypicalLengthAnnotationOnParameterFacetFactory extends FacetFactoryAbstract {
+
+    public TypicalLengthAnnotationOnParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(final ProcessParameterContext processParameterContext) {
+        final Annotation[] parameterAnnotations = Annotations.getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (final Annotation parameterAnnotation : parameterAnnotations) {
+            if (parameterAnnotation instanceof TypicalLength) {
+                final TypicalLength annotation = (TypicalLength) parameterAnnotation;
+                FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+    }
+
+    private TypicalLengthFacet create(final TypicalLength annotation, final FacetHolder holder) {
+        return annotation != null ? new TypicalLengthFacetAnnotationOnParameter(annotation.value(), 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/param/typicallen/annotation/TypicalLengthFacetAnnotationOnParameter.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthFacetAnnotationOnParameter.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthFacetAnnotationOnParameter.java
new file mode 100644
index 0000000..b6f3d47
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthFacetAnnotationOnParameter.java
@@ -0,0 +1,39 @@
+/*
+ *  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.param.typicallen.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.typicallen.TypicalLengthFacetAbstract;
+
+public class TypicalLengthFacetAnnotationOnParameter extends TypicalLengthFacetAbstract {
+
+    private final int value;
+
+    public TypicalLengthFacetAnnotationOnParameter(final int value, final FacetHolder holder) {
+        super(holder, false);
+        this.value = value;
+    }
+
+    @Override
+    public int value() {
+        return value;
+    }
+
+}