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 2015/01/15 11:28:06 UTC

[26/49] isis git commit: ISIS-970: facet factory for @Property annotation.

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/mandatory/MandatoryFacetOnPropertyMandatoryAnnotationFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/mandatory/MandatoryFacetOnPropertyMandatoryAnnotationFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/mandatory/MandatoryFacetOnPropertyMandatoryAnnotationFactory.java
index 1679786..19cbd06 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/mandatory/MandatoryFacetOnPropertyMandatoryAnnotationFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/mandatory/MandatoryFacetOnPropertyMandatoryAnnotationFactory.java
@@ -20,12 +20,10 @@
 package org.apache.isis.core.metamodel.facets.properties.mandatory.annotation.mandatory;
 
 import org.apache.isis.applib.annotation.Mandatory;
-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.propparam.mandatory.MandatoryFacet;
 
 public class MandatoryFacetOnPropertyMandatoryAnnotationFactory extends FacetFactoryAbstract {
 
@@ -35,15 +33,11 @@ public class MandatoryFacetOnPropertyMandatoryAnnotationFactory extends FacetFac
 
     @Override
     public void process(final ProcessMethodContext processMethodContext) {
-        if (!Annotations.isAnnotationPresent(processMethodContext.getMethod(), Mandatory.class)) {
+        final Mandatory annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Mandatory.class);
+        if(annotation == null) {
             return;
         }
-        final Mandatory annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Mandatory.class);
-        FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
-    }
-
-    private MandatoryFacet create(final Mandatory annotation, final FacetHolder holder) {
-        return annotation != null ? new MandatoryFacetOnPropertyMandatoryAnnotation(holder) : null;
+        FacetUtil.addFacet(MandatoryFacetOnPropertyMandatoryAnnotation.create(annotation, processMethodContext.getFacetHolder()));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotation.java
index 083e250..59294e6 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotation.java
@@ -19,7 +19,10 @@
 
 package org.apache.isis.core.metamodel.facets.properties.mandatory.annotation.optional;
 
+import java.lang.reflect.Method;
+import org.apache.isis.applib.annotation.Optional;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet;
 import org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacetAbstract;
 
 /**
@@ -34,4 +37,12 @@ public class MandatoryFacetOnPropertyInvertedByOptionalAnnotation extends Mandat
     public MandatoryFacetOnPropertyInvertedByOptionalAnnotation(final FacetHolder holder) {
         super(holder, Semantics.OPTIONAL);
     }
+
+    static MandatoryFacet create(final Optional annotation, Method method, final FacetHolder holder) {
+        final Class<?> returnType = method.getReturnType();
+        if (returnType.isPrimitive()) {
+            return null;
+        }
+        return new MandatoryFacetOnPropertyInvertedByOptionalAnnotation(holder);
+    }
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotationFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotationFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotationFactory.java
index aef6b79..e2f6149 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotationFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/mandatory/annotation/optional/MandatoryFacetOnPropertyInvertedByOptionalAnnotationFactory.java
@@ -19,13 +19,13 @@
 
 package org.apache.isis.core.metamodel.facets.properties.mandatory.annotation.optional;
 
+import java.lang.reflect.Method;
 import org.apache.isis.applib.annotation.Optional;
-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.propparam.mandatory.MandatoryFacet;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
 
 public class MandatoryFacetOnPropertyInvertedByOptionalAnnotationFactory extends FacetFactoryAbstract {
 
@@ -35,19 +35,15 @@ public class MandatoryFacetOnPropertyInvertedByOptionalAnnotationFactory extends
 
     @Override
     public void process(final ProcessMethodContext processMethodContext) {
-        final Class<?> returnType = processMethodContext.getMethod().getReturnType();
-        if (returnType.isPrimitive()) {
+        final Method method = processMethodContext.getMethod();
+        final Optional annotation = Annotations.getAnnotation(method, Optional.class);
+        if(annotation == null) {
             return;
         }
-        if (!Annotations.isAnnotationPresent(processMethodContext.getMethod(), Optional.class)) {
-            return;
-        }
-        final Optional annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Optional.class);
-        FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
-    }
+        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
 
-    private MandatoryFacet create(final Optional annotation, final FacetHolder holder) {
-        return annotation != null ? new MandatoryFacetOnPropertyInvertedByOptionalAnnotation(holder) : null;
+        FacetUtil.addFacet(
+                MandatoryFacetOnPropertyInvertedByOptionalAnnotation.create(annotation, method, facetHolder));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFactory.java
index 27469ff..84ef727 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFactory.java
@@ -27,7 +27,7 @@ import org.apache.isis.core.metamodel.facetapi.FeatureType;
 import org.apache.isis.core.metamodel.facets.Annotations;
 import org.apache.isis.core.metamodel.facets.ContributeeMemberFacetFactory;
 import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.propparam.layout.LabelAtFacetInferredFromMultiLineFacet;
+import org.apache.isis.core.metamodel.facets.propparam.labelat.LabelAtFacetInferredFromMultiLineFacet;
 import org.apache.isis.core.metamodel.facets.propparam.multiline.MultiLineFacet;
 
 public class MultiLineFacetOnPropertyFactory extends FacetFactoryAbstract implements ContributeeMemberFacetFactory {

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotation.java
index e15e8a6..65085fd 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotation.java
@@ -19,7 +19,9 @@
 
 package org.apache.isis.core.metamodel.facets.properties.notpersisted.annotation;
 
+import org.apache.isis.applib.annotation.NotPersisted;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacet;
 import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacetAbstract;
 
 public class NotPersistedFacetOnPropertyAnnotation extends NotPersistedFacetAbstract {
@@ -28,4 +30,7 @@ public class NotPersistedFacetOnPropertyAnnotation extends NotPersistedFacetAbst
         super(holder);
     }
 
+    static NotPersistedFacet create(final NotPersisted annotation, final FacetHolder holder) {
+        return annotation == null ? null : new NotPersistedFacetOnPropertyAnnotation(holder);
+    }
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotationFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotationFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotationFactory.java
index a4f2ff0..23fdad8 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotationFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/notpersisted/annotation/NotPersistedFacetOnPropertyAnnotationFactory.java
@@ -20,7 +20,6 @@
 package org.apache.isis.core.metamodel.facets.properties.notpersisted.annotation;
 
 import org.apache.isis.applib.annotation.NotPersisted;
-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;
@@ -36,11 +35,8 @@ public class NotPersistedFacetOnPropertyAnnotationFactory extends FacetFactoryAb
     @Override
     public void process(final ProcessMethodContext processMethodContext) {
         final NotPersisted annotation = Annotations.getAnnotation(processMethodContext.getMethod(), NotPersisted.class);
-        FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
-    }
-
-    private NotPersistedFacet create(final NotPersisted annotation, final FacetHolder holder) {
-        return annotation == null ? null : new NotPersistedFacetOnPropertyAnnotation(holder);
+        final NotPersistedFacet notPersistedFacet = NotPersistedFacetOnPropertyAnnotation.create(annotation, processMethodContext.getFacetHolder());
+        FacetUtil.addFacet(notPersistedFacet);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/DisabledFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/DisabledFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/DisabledFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..dbeeb80
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/DisabledFacetForPropertyAnnotation.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.metamodel.facets.properties.property;
+
+import org.apache.isis.applib.annotation.EditPolicy;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
+import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacetImpl;
+
+public class DisabledFacetForPropertyAnnotation extends DisabledFacetImpl {
+
+    public static DisabledFacet create(Property property, FacetHolder holder) {
+        final EditPolicy editPolicy = property.editing();
+        final String disabledReason = property.editingDisabledReason();
+
+        switch (editPolicy) {
+            case AS_CONFIGURED:
+
+                // nothing needs to be done here; the DomainObjectFactory (processing @DomainObject annotation)
+                // will install an ImmutableFacetForDomainObjectAnnotation on the domain object and then a
+                // DisabledFacetOnPropertyInferredFromImmutable facet will be installed.
+
+                return null;
+
+            case DISABLED:
+                return new DisabledFacetForPropertyAnnotation(disabledReason, holder);
+            case ENABLED:
+                return null;
+        }
+        return null;
+    }
+
+    private DisabledFacetForPropertyAnnotation(String reason, final FacetHolder holder) {
+        super(When.ALWAYS, Where.EVERYWHERE, reason, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MandatoryFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MandatoryFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MandatoryFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..5e22fb2
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MandatoryFacetForPropertyAnnotation.java
@@ -0,0 +1,72 @@
+/*
+ *  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.metamodel.facets.properties.property;
+
+import java.lang.reflect.Method;
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet;
+import org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacetAbstract;
+
+public abstract class MandatoryFacetForPropertyAnnotation extends MandatoryFacetAbstract {
+
+    public MandatoryFacetForPropertyAnnotation(final FacetHolder holder, final Semantics semantics) {
+        super(holder, semantics);
+    }
+
+    static MandatoryFacet create(final Property property, Method method, final FacetHolder holder) {
+        final Class<?> returnType = method.getReturnType();
+        if (returnType.isPrimitive()) {
+            return new MandatoryFacetForPropertyAnnotation.Primitive(holder);
+        }
+        final Optionality optionality = property.optional();
+        switch (optionality) {
+            case DEFAULT:
+                // do nothing here; instead will rely on MandatoryFromJdoColumnAnnotationFacetFactory to perform
+                // the remaining processing
+                return null;
+            case FALSE:
+                return new MandatoryFacetForPropertyAnnotation.Required(holder);
+            case TRUE:
+                return new MandatoryFacetForPropertyAnnotation.Optional(holder);
+        }
+        return null;
+    }
+
+    public static class Primitive extends MandatoryFacetForPropertyAnnotation {
+        public Primitive(final FacetHolder holder) {
+            super(holder, Semantics.REQUIRED);
+        }
+    }
+
+    public static class Required extends MandatoryFacetForPropertyAnnotation {
+        public Required(final FacetHolder holder) {
+            super(holder, Semantics.REQUIRED);
+        }
+    }
+
+    public static class Optional extends MandatoryFacetForPropertyAnnotation {
+        public Optional(final FacetHolder holder) {
+            super(holder, Semantics.OPTIONAL);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MaxLengthFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MaxLengthFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MaxLengthFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..677eb2a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MaxLengthFacetForPropertyAnnotation.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.metamodel.facets.properties.property;
+
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.maxlen.MaxLengthFacet;
+import org.apache.isis.core.metamodel.facets.propparam.maxlen.MaxLengthFacetAbstract;
+
+public class MaxLengthFacetForPropertyAnnotation extends MaxLengthFacetAbstract {
+
+    public static MaxLengthFacet create(Property property, FacetHolder holder) {
+        final int maxLength = property.maxLength();
+        return maxLength != -1
+                ? new MaxLengthFacetForPropertyAnnotation(maxLength, holder)
+                : null;
+    }
+
+    private MaxLengthFacetForPropertyAnnotation(final int value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MustSatisfySpecificationFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MustSatisfySpecificationFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MustSatisfySpecificationFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..d2859b5
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MustSatisfySpecificationFacetForPropertyAnnotation.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.property;
+
+import java.util.List;
+import com.google.common.collect.Lists;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.spec.Specification;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.mustsatisfyspec.MustSatisfySpecificationFacetAbstract;
+
+public class MustSatisfySpecificationFacetForPropertyAnnotation extends MustSatisfySpecificationFacetAbstract {
+
+    static Facet create(final Property property, final FacetHolder holder) {
+        final Class<?>[] values = property.mustSatisfy();
+        final List<Specification> specifications = Lists.newArrayList();
+        for (final Class<?> value : values) {
+            final Specification specification = newSpecificationElseNull(value);
+            if (specification != null) {
+                specifications.add(specification);
+            }
+        }
+        return specifications.size() > 0 ? new MustSatisfySpecificationFacetForPropertyAnnotation(specifications, holder) : null;
+    }
+
+
+    private MustSatisfySpecificationFacetForPropertyAnnotation(final List<Specification> specifications, final FacetHolder holder) {
+        super(specifications, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/NotPersistedFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/NotPersistedFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/NotPersistedFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..ee16eb6
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/NotPersistedFacetForPropertyAnnotation.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.metamodel.facets.properties.property;
+
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacet;
+import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacetAbstract;
+
+public class NotPersistedFacetForPropertyAnnotation extends NotPersistedFacetAbstract {
+
+    public NotPersistedFacetForPropertyAnnotation(final FacetHolder holder) {
+        super(holder);
+    }
+
+    static NotPersistedFacet create(final Property property, final FacetHolder holder) {
+        final boolean notPersisted = property.notPersisted();
+        final boolean persisted = !notPersisted;
+        if(persisted) {
+            return null;
+        }
+        return new NotPersistedFacetForPropertyAnnotation(holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyFactory.java
new file mode 100644
index 0000000..c6acaa9
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyFactory.java
@@ -0,0 +1,125 @@
+/*
+ *  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.metamodel.facets.properties.property;
+
+import java.lang.reflect.Method;
+import org.apache.isis.applib.annotation.Property;
+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;
+
+public class PropertyFactory extends FacetFactoryAbstract implements ServicesInjectorAware {
+
+    private ServicesInjector servicesInjector;
+
+    public PropertyFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+
+        final Method method = processMethodContext.getMethod();
+        final Property property = Annotations.getAnnotation(method, Property.class);
+        if (property == null) {
+            return;
+        }
+
+        processInteraction(processMethodContext);
+        processDisabled(processMethodContext);
+        processMaxLength(processMethodContext);
+        processMustSatisfy(processMethodContext);
+        processNotPersisted(processMethodContext);
+        processOptional(processMethodContext);
+        processRegEx(processMethodContext);
+    }
+
+    private void processInteraction(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Property property = Annotations.getAnnotation(method, Property.class);
+        final FacetHolder holder = processMethodContext.getFacetHolder();
+
+        FacetUtil.addFacet(
+                PropertyInteractionFacetForPropertyAnnotation.create(
+                        property, servicesInjector, getSpecificationLoader(), holder));
+    }
+
+    private void processDisabled(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Property property = Annotations.getAnnotation(method, Property.class);
+        final FacetHolder holder = processMethodContext.getFacetHolder();
+
+        FacetUtil.addFacet(
+                DisabledFacetForPropertyAnnotation.create(property, holder));
+    }
+
+    private void processMaxLength(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Property property = Annotations.getAnnotation(method, Property.class);
+        final FacetHolder holder = processMethodContext.getFacetHolder();
+
+        FacetUtil.addFacet(
+                MaxLengthFacetForPropertyAnnotation.create(property, holder));
+    }
+
+    private void processMustSatisfy(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Property property = Annotations.getAnnotation(method, Property.class);
+        final FacetHolder holder = processMethodContext.getFacetHolder();
+
+        FacetUtil.addFacet(
+                MustSatisfySpecificationFacetForPropertyAnnotation.create(property, holder));
+    }
+
+    private void processNotPersisted(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Property property = Annotations.getAnnotation(method, Property.class);
+        final FacetHolder holder = processMethodContext.getFacetHolder();
+
+        FacetUtil.addFacet(
+                NotPersistedFacetForPropertyAnnotation.create(property, holder));
+    }
+
+    private void processOptional(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Property property = Annotations.getAnnotation(method, Property.class);
+        final FacetHolder holder = processMethodContext.getFacetHolder();
+
+        FacetUtil.addFacet(MandatoryFacetForPropertyAnnotation.create(property, method, holder));
+    }
+
+    private void processRegEx(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Property property = Annotations.getAnnotation(method, Property.class);
+        final FacetHolder holder = processMethodContext.getFacetHolder();
+
+        FacetUtil.addFacet(RegExFacetForPropertyAnnotation.create(property, holder));
+    }
+
+
+    @Override
+    public void setServicesInjector(final ServicesInjector servicesInjector) {
+        this.servicesInjector = servicesInjector;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyInteractionFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyInteractionFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyInteractionFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..a0a66dc
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyInteractionFacetForPropertyAnnotation.java
@@ -0,0 +1,60 @@
+/*
+ *  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.metamodel.facets.properties.property;
+
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.services.eventbus.PropertyInteractionEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.interaction.PropertyInteractionFacetAbstract;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class PropertyInteractionFacetForPropertyAnnotation extends PropertyInteractionFacetAbstract {
+
+    static PropertyInteractionFacetAbstract create(
+            final Property property,
+            final ServicesInjector servicesInjector,
+            final SpecificationLoader specificationLoader,
+            final FacetHolder holder) {
+
+        final PropertyOrCollectionAccessorFacet getterFacet = holder.getFacet(PropertyOrCollectionAccessorFacet.class);
+        if(getterFacet == null) {
+            return null;
+        }
+
+        final Class<? extends PropertyInteractionEvent<?, ?>> interaction = property.interaction();
+        if(interaction == null) {
+            return null;
+        }
+
+        return new PropertyInteractionFacetForPropertyAnnotation(
+                interaction, getterFacet, servicesInjector, specificationLoader, holder);
+    }
+
+    private PropertyInteractionFacetForPropertyAnnotation(
+            final Class<? extends PropertyInteractionEvent<?, ?>> eventType,
+            final PropertyOrCollectionAccessorFacet getterFacet,
+            final ServicesInjector servicesInjector, final SpecificationLoader specificationLoader, final FacetHolder holder) {
+        super(eventType, getterFacet, holder, servicesInjector, specificationLoader);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/RegExFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/RegExFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/RegExFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..553983a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/RegExFacetForPropertyAnnotation.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.metamodel.facets.properties.property;
+
+import java.util.regex.Pattern;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.regex.RegExFacet;
+import org.apache.isis.core.metamodel.facets.object.regex.RegExFacetAbstract;
+
+public class RegExFacetForPropertyAnnotation extends RegExFacetAbstract {
+
+    private final Pattern pattern;
+
+    static RegExFacet create(final Property property, final FacetHolder holder) {
+
+        final String pattern = property.regexPattern();
+        final int patternFlags = property.regexPatternFlags();
+
+        return new RegExFacetForPropertyAnnotation(pattern, patternFlags, holder);
+    }
+
+    private RegExFacetForPropertyAnnotation(final String pattern, final int patternFlags, final FacetHolder holder) {
+        super(pattern, "", false, holder);
+        this.pattern = Pattern.compile(pattern, patternFlags);
+    }
+
+    /**
+     * Unused
+     */
+    @Override
+    public String format(String text) {
+        return text;
+    }
+
+    @Override
+    public boolean doesNotMatch(final String text) {
+        if (text == null) {
+            return true;
+        }
+        return !pattern.matcher(text).matches();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutAnnotation.java
new file mode 100644
index 0000000..a4984b6
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+public class CssClassFacetForPropertyLayoutAnnotation extends CssClassFacetAbstract {
+
+    public static CssClassFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+        if(propertyLayout == null) {
+            return null;
+        }
+        final String cssClass = Strings.emptyToNull(propertyLayout.cssClass());
+        return cssClass != null ? new CssClassFacetForPropertyLayoutAnnotation(cssClass, holder) : null;
+    }
+
+    private CssClassFacetForPropertyLayoutAnnotation(String value, FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetOnPropertyFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetOnPropertyFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetOnPropertyFromLayoutProperties.java
new file mode 100644
index 0000000..21b1a07
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetOnPropertyFromLayoutProperties.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import java.util.Properties;
+import com.google.common.base.Strings;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+public class CssClassFacetOnPropertyFromLayoutProperties extends CssClassFacetAbstract {
+
+    public static CssClassFacet create(Properties properties, FacetHolder holder) {
+        final String cssClass = cssClass(properties);
+        return cssClass != null? new CssClassFacetOnPropertyFromLayoutProperties(cssClass, holder): null;
+    }
+
+    private CssClassFacetOnPropertyFromLayoutProperties(String cssClass, FacetHolder holder) {
+        super(cssClass, holder);
+    }
+
+    private static String cssClass(Properties properties) {
+        if(properties == null) {
+            return null;
+        }
+        return Strings.emptyToNull(properties.getProperty("cssClass"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutAnnotation.java
new file mode 100644
index 0000000..7a2b062
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetForPropertyLayoutAnnotation extends DescribedAsFacetAbstract {
+
+    public static DescribedAsFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+        if(propertyLayout == null) {
+            return null;
+        }
+        final String describedAs = Strings.emptyToNull(propertyLayout.describedAs());
+        return describedAs != null ? new DescribedAsFacetForPropertyLayoutAnnotation(describedAs, holder) : null;
+    }
+
+    private DescribedAsFacetForPropertyLayoutAnnotation(String value, FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetOnPropertyFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetOnPropertyFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetOnPropertyFromLayoutProperties.java
new file mode 100644
index 0000000..0410c49
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetOnPropertyFromLayoutProperties.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import java.util.Properties;
+import com.google.common.base.Strings;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetOnPropertyFromLayoutProperties extends DescribedAsFacetAbstract {
+
+    public static DescribedAsFacet create(Properties properties, FacetHolder holder) {
+        final String describedAs = describedAs(properties);
+        return describedAs != null? new DescribedAsFacetOnPropertyFromLayoutProperties(describedAs, holder): null;
+    }
+
+    private DescribedAsFacetOnPropertyFromLayoutProperties(String describedAs, FacetHolder holder) {
+        super(describedAs, holder);
+    }
+
+    private static String describedAs(Properties properties) {
+        if(properties == null) {
+            return null;
+        }
+        String describedAs = Strings.emptyToNull(properties.getProperty("describedAs"));
+        if(describedAs == null) {
+            // alternate key
+            describedAs = Strings.emptyToNull(properties.getProperty("description"));
+        }
+        return describedAs;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java
new file mode 100644
index 0000000..0ee0b82
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java
@@ -0,0 +1,52 @@
+/*
+ *  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.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract;
+
+public class HiddenFacetForPropertyLayoutAnnotation extends HiddenFacetAbstract {
+
+    public static HiddenFacet create(final PropertyLayout propertyLayout, final FacetHolder holder) {
+        if (propertyLayout == null) {
+            return null;
+        }
+        final Where where = propertyLayout.hidden();
+        return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetForPropertyLayoutAnnotation(where, holder) : null;
+    }
+
+    private HiddenFacetForPropertyLayoutAnnotation(final Where where, final FacetHolder holder) {
+        super(When.ALWAYS, where, holder);
+    }
+
+    @Override
+    public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) {
+        if(!where().includes(whereContext)) {
+            return null;
+        }
+        return "Hidden on " + where().getFriendlyName();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java
new file mode 100644
index 0000000..3fb9354
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java
@@ -0,0 +1,60 @@
+/*
+ *  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.metamodel.facets.properties.propertylayout;
+
+import java.util.Properties;
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract;
+
+public class HiddenFacetOnPropertyFromLayoutProperties extends HiddenFacetAbstract {
+
+    public static HiddenFacet create(Properties properties, FacetHolder holder) {
+        final Where where = hidden(properties);
+        return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetOnPropertyFromLayoutProperties(where, holder): null;
+    }
+
+    private static Where hidden(Properties properties) {
+        if(properties == null) {
+            return null;
+        }
+        String hidden = Strings.emptyToNull(properties.getProperty("hidden"));
+        if(hidden == null) {
+            return null;
+        }
+        return Where.valueOf(hidden);
+    }
+
+    private HiddenFacetOnPropertyFromLayoutProperties(Where where, FacetHolder holder) {
+        super(When.ALWAYS, where, holder);
+    }
+
+    @Override
+    public String hiddenReason(final ObjectAdapter targetAdapter, Where whereContext) {
+        if(!where().includes(whereContext)) {
+            return null;
+        }
+        return "Hidden on " + where().getFriendlyName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutAnnotation.java
new file mode 100644
index 0000000..77d7d65
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.annotation.LabelPosition;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.labelat.LabelAtFacet;
+import org.apache.isis.core.metamodel.facets.propparam.labelat.LabelAtFacetAbstract;
+
+public class LabelAtFacetForPropertyLayoutAnnotation extends LabelAtFacetAbstract {
+
+    public static LabelAtFacet create(final PropertyLayout propertyLayout, FacetHolder holder) {
+        if (propertyLayout == null) {
+            return null;
+        }
+        final LabelPosition labelPosition = propertyLayout.labelPosition();
+        return labelPosition != null ? new LabelAtFacetForPropertyLayoutAnnotation(labelPosition, holder) : null;
+    }
+
+    private LabelAtFacetForPropertyLayoutAnnotation(final LabelPosition value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetOnPropertyFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetOnPropertyFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetOnPropertyFromLayoutProperties.java
new file mode 100644
index 0000000..abd1a67
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetOnPropertyFromLayoutProperties.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.metamodel.facets.properties.propertylayout;
+
+import java.util.Properties;
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.LabelPosition;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.labelat.LabelAtFacet;
+import org.apache.isis.core.metamodel.facets.propparam.labelat.LabelAtFacetAbstract;
+
+public class LabelAtFacetOnPropertyFromLayoutProperties extends LabelAtFacetAbstract {
+
+    public static LabelAtFacet create(Properties properties, FacetHolder holder) {
+        final LabelPosition labelPosition = labelPosition(properties);
+        return labelPosition != null? new LabelAtFacetOnPropertyFromLayoutProperties(labelPosition, holder): null;
+    }
+
+    private LabelAtFacetOnPropertyFromLayoutProperties(LabelPosition labelPosition, FacetHolder holder) {
+        super(labelPosition, holder);
+    }
+
+    private static LabelPosition labelPosition(Properties properties) {
+        if(properties == null) {
+            return null;
+        }
+        String labelPosition = Strings.emptyToNull(properties.getProperty("labelPosition"));
+        if(labelPosition == null) {
+            // alternative key (cos I keep forgetting which to use).
+            labelPosition = Strings.emptyToNull(properties.getProperty("labelAt"));
+        }
+        if(labelPosition == null) {
+            return null;
+        }
+        return LabelPosition.valueOf(labelPosition);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutAnnotation.java
new file mode 100644
index 0000000..3191115
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutAnnotation.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.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.multiline.MultiLineFacet;
+import org.apache.isis.core.metamodel.facets.propparam.multiline.MultiLineFacetAbstract;
+
+public class MultiLineFacetForPropertyLayoutAnnotation extends MultiLineFacetAbstract {
+
+    public static MultiLineFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+        if(propertyLayout == null) {
+            return null;
+        }
+        final int multiLine = propertyLayout.multiLine();
+        return multiLine > 1 ? new MultiLineFacetForPropertyLayoutAnnotation(multiLine, false, holder) : null;
+    }
+
+    private MultiLineFacetForPropertyLayoutAnnotation(int numberOfLines, boolean preventWrapping, FacetHolder holder) {
+        super(numberOfLines, preventWrapping, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetOnPropertyFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetOnPropertyFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetOnPropertyFromLayoutProperties.java
new file mode 100644
index 0000000..d49b092
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetOnPropertyFromLayoutProperties.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import java.util.Properties;
+import com.google.common.base.Strings;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.multiline.MultiLineFacet;
+import org.apache.isis.core.metamodel.facets.propparam.multiline.MultiLineFacetAbstract;
+
+public class MultiLineFacetOnPropertyFromLayoutProperties extends MultiLineFacetAbstract {
+
+    public static MultiLineFacet create(Properties properties, FacetHolder holder) {
+        final int multiLine = multiLine(properties);
+        return multiLine > 1? new MultiLineFacetOnPropertyFromLayoutProperties(multiLine, holder): null;
+    }
+
+    private MultiLineFacetOnPropertyFromLayoutProperties(int multiLine, FacetHolder holder) {
+        super(multiLine, false, holder);
+    }
+
+    private static int multiLine(Properties properties) {
+        if(properties == null) {
+            return -1;
+        }
+        String multiLine = Strings.emptyToNull(properties.getProperty("multiLine"));
+        if(multiLine == null) {
+            return -1;
+        }
+        return Integer.parseInt(multiLine);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutAnnotation.java
new file mode 100644
index 0000000..8fef193
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutAnnotation.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+public class NamedFacetForPropertyLayoutAnnotation extends NamedFacetAbstract {
+
+    public static NamedFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+        if(propertyLayout == null) {
+            return null;
+        }
+        final String named = Strings.emptyToNull(propertyLayout.named());
+        return named != null ? new NamedFacetForPropertyLayoutAnnotation(named, propertyLayout.namedEscaped(), holder) : null;
+    }
+
+    private NamedFacetForPropertyLayoutAnnotation(
+        final String value,
+        final boolean escaped,
+        final FacetHolder holder) {
+
+        super(value, escaped, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetOnPropertyFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetOnPropertyFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetOnPropertyFromLayoutProperties.java
new file mode 100644
index 0000000..dabe28a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetOnPropertyFromLayoutProperties.java
@@ -0,0 +1,67 @@
+/*
+ *  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.metamodel.facets.properties.propertylayout;
+
+import java.util.Properties;
+import com.google.common.base.Strings;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+public class NamedFacetOnPropertyFromLayoutProperties extends NamedFacetAbstract {
+
+    public static NamedFacet create(Properties properties, FacetHolder holder) {
+        final String value = named(properties);
+        final boolean escaped = namedEscaped(properties);
+        return value != null? new NamedFacetOnPropertyFromLayoutProperties(value, escaped, holder): null;
+    }
+
+    private NamedFacetOnPropertyFromLayoutProperties(
+        final String named,
+        final boolean escaped,
+        final FacetHolder holder) {
+
+        super(named, escaped, holder);
+    }
+
+    private static String named(Properties properties) {
+        if(properties == null) {
+            return null;
+        }
+        String named = Strings.emptyToNull(properties.getProperty("named"));
+        if(named == null) {
+            // alternate key
+            named = Strings.emptyToNull(properties.getProperty("name"));
+        }
+        return named;
+    }
+
+    private static boolean namedEscaped(final Properties properties) {
+        boolean escaped = true;
+        if(properties != null) {
+            String namedEscapedValue = Strings.emptyToNull(properties.getProperty("namedEscaped"));
+            if("false".equalsIgnoreCase(namedEscapedValue)) {
+                escaped = false;
+            }
+        }
+        return escaped;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/PropertyLayoutFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/PropertyLayoutFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/PropertyLayoutFactory.java
new file mode 100644
index 0000000..b9075c3
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/PropertyLayoutFactory.java
@@ -0,0 +1,175 @@
+/*
+ *  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.metamodel.facets.properties.propertylayout;
+
+import java.util.Properties;
+import org.apache.isis.applib.annotation.PropertyLayout;
+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.ContributeeMemberFacetFactory;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import org.apache.isis.core.metamodel.facets.objpropparam.typicallen.TypicalLengthFacet;
+import org.apache.isis.core.metamodel.facets.propparam.labelat.LabelAtFacet;
+import org.apache.isis.core.metamodel.facets.propparam.multiline.MultiLineFacet;
+import org.apache.isis.core.metamodel.facets.propparam.renderedadjusted.RenderedAdjustedFacet;
+
+public class PropertyLayoutFactory extends FacetFactoryAbstract implements ContributeeMemberFacetFactory {
+
+    public PropertyLayoutFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+
+        final FacetHolder holder = processMethodContext.getFacetHolder();
+
+        Properties properties = processMethodContext.metadataProperties("propertyLayout");
+        if(properties == null) {
+            // alternate key
+            properties = processMethodContext.metadataProperties("layout");
+        }
+        final PropertyLayout propertyLayout = Annotations.getAnnotation(processMethodContext.getMethod(), PropertyLayout.class);
+
+
+        // cssClass
+        CssClassFacet cssClassFacet = CssClassFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        if(cssClassFacet == null) {
+            cssClassFacet = CssClassFacetForPropertyLayoutAnnotation.create(propertyLayout, holder);
+        }
+        FacetUtil.addFacet(cssClassFacet);
+
+
+        // describedAs
+        DescribedAsFacet describedAsFacet = DescribedAsFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        if(describedAsFacet == null) {
+            describedAsFacet = DescribedAsFacetForPropertyLayoutAnnotation.create(propertyLayout, holder);
+        }
+        FacetUtil.addFacet(describedAsFacet);
+
+
+        // hidden
+        HiddenFacet hiddenFacet = HiddenFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        if(hiddenFacet == null) {
+            hiddenFacet = HiddenFacetForPropertyLayoutAnnotation.create(propertyLayout, holder);
+        }
+        FacetUtil.addFacet(hiddenFacet);
+
+
+        // labelAt
+        LabelAtFacet labelAtFacet = LabelAtFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        if(labelAtFacet == null) {
+            labelAtFacet = LabelAtFacetForPropertyLayoutAnnotation.create(propertyLayout, holder);
+        }
+        FacetUtil.addFacet(labelAtFacet);
+
+
+        // multiLine
+        MultiLineFacet multiLineFacet = MultiLineFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        if(multiLineFacet == null) {
+            multiLineFacet = MultiLineFacetForPropertyLayoutAnnotation.create(propertyLayout, holder);
+        }
+        FacetUtil.addFacet(multiLineFacet);
+
+
+        // named
+        NamedFacet namedFacet = NamedFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        if(namedFacet == null) {
+            namedFacet = NamedFacetForPropertyLayoutAnnotation.create(propertyLayout, holder);
+        }
+        FacetUtil.addFacet(namedFacet);
+
+
+        // renderedAsDayBefore
+        RenderedAdjustedFacet renderedAdjustedFacet = RenderedAdjustedFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        if(renderedAdjustedFacet == null) {
+            renderedAdjustedFacet = RenderedAdjustedFacetForPropertyLayoutAnnotation.create(propertyLayout, holder);
+        }
+        FacetUtil.addFacet(renderedAdjustedFacet);
+
+
+        // typicalLength
+        TypicalLengthFacet typicalLengthFacet = TypicalLengthFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        if(typicalLengthFacet == null) {
+            typicalLengthFacet = TypicalLengthFacetForPropertyLayoutAnnotation.create(propertyLayout, holder);
+        }
+        FacetUtil.addFacet(typicalLengthFacet);
+
+    }
+
+    @Override
+    public void process(ProcessContributeeMemberContext processMemberContext) {
+        final FacetHolder holder = processMemberContext.getFacetHolder();
+
+        Properties properties = processMemberContext.metadataProperties("propertyLayout");
+        if(properties == null) {
+            // alternate key
+            properties = processMemberContext.metadataProperties("layout");
+        }
+
+
+        // cssClass
+        CssClassFacet cssClassFacet = CssClassFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        FacetUtil.addFacet(cssClassFacet);
+
+
+        // describedAs
+        DescribedAsFacet describedAsFacet = DescribedAsFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        FacetUtil.addFacet(describedAsFacet);
+
+
+        // hidden
+        HiddenFacet hiddenFacet = HiddenFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        FacetUtil.addFacet(hiddenFacet);
+
+
+        // labelAt
+        LabelAtFacet labelAtFacet = LabelAtFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        FacetUtil.addFacet(labelAtFacet);
+
+
+        // multiLine
+        MultiLineFacet multiLineFacet = MultiLineFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        FacetUtil.addFacet(multiLineFacet);
+
+
+        // named
+        NamedFacet namedFacet = NamedFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        FacetUtil.addFacet(namedFacet);
+
+
+        // renderedAsDayBefore
+        RenderedAdjustedFacet renderedAdjustedFacet = RenderedAdjustedFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        FacetUtil.addFacet(renderedAdjustedFacet);
+
+
+        // typicalLength
+        TypicalLengthFacet typicalLengthFacet = TypicalLengthFacetOnPropertyFromLayoutProperties.create(properties, holder);
+        FacetUtil.addFacet(typicalLengthFacet);
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutAnnotation.java
new file mode 100644
index 0000000..d3e2104
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutAnnotation.java
@@ -0,0 +1,43 @@
+/*
+ *  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.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.renderedadjusted.RenderedAdjustedFacet;
+import org.apache.isis.core.metamodel.facets.propparam.renderedadjusted.RenderedAdjustedFacetAbstract;
+
+public class RenderedAdjustedFacetForPropertyLayoutAnnotation extends RenderedAdjustedFacetAbstract {
+
+    public static RenderedAdjustedFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+        if(propertyLayout == null) {
+            return null;
+        }
+        final boolean renderedAsDayBefore = propertyLayout.renderedAsDayBefore();
+        return renderedAsDayBefore ? new RenderedAdjustedFacetForPropertyLayoutAnnotation(holder) : null;
+    }
+
+    public static final int ADJUST_BY = -1;
+
+    private RenderedAdjustedFacetForPropertyLayoutAnnotation(FacetHolder holder) {
+        super(ADJUST_BY, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3f2d5fa3/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetOnPropertyFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetOnPropertyFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetOnPropertyFromLayoutProperties.java
new file mode 100644
index 0000000..e9755c9
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetOnPropertyFromLayoutProperties.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import java.util.Properties;
+import com.google.common.base.Strings;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.renderedadjusted.RenderedAdjustedFacet;
+import org.apache.isis.core.metamodel.facets.propparam.renderedadjusted.RenderedAdjustedFacetAbstract;
+
+public class RenderedAdjustedFacetOnPropertyFromLayoutProperties extends RenderedAdjustedFacetAbstract {
+
+    public static final int ADJUST_BY = -1;
+
+    public static RenderedAdjustedFacet create(Properties properties, FacetHolder holder) {
+        final boolean renderedAsDayBefore = renderedAsDayBefore(properties);
+        return renderedAsDayBefore ? new RenderedAdjustedFacetOnPropertyFromLayoutProperties(holder): null;
+    }
+
+    private RenderedAdjustedFacetOnPropertyFromLayoutProperties(FacetHolder holder) {
+        super(ADJUST_BY, holder);
+    }
+
+    private static boolean renderedAsDayBefore(Properties properties) {
+        if(properties == null) {
+            return false;
+        }
+        String renderedAsDayBefore = Strings.emptyToNull(properties.getProperty("renderedAsDayBefore"));
+        return renderedAsDayBefore != null && Boolean.parseBoolean(renderedAsDayBefore);
+    }
+
+}