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 2014/07/11 12:56:38 UTC

[26/61] [partial] ISIS-831: digression: moving progmodel/facets into metamodel/facets

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueFacet.java
new file mode 100644
index 0000000..0ddac2e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueFacet.java
@@ -0,0 +1,26 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.value.blobs;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface BlobValueFacet extends Facet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..ae3c79d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueFacetUsingSemanticsProviderFactory.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.value.blobs;
+
+import org.apache.isis.applib.value.Blob;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class BlobValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Blob> {
+
+    public BlobValueFacetUsingSemanticsProviderFactory() {
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+        if (type != Blob.class) {
+            return;
+        }
+        addFacets(new BlobValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueSemanticsProvider.java
new file mode 100644
index 0000000..acc8b9c
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/blobs/BlobValueSemanticsProvider.java
@@ -0,0 +1,120 @@
+/*
+ *  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.value.blobs;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+
+import org.apache.commons.codec.binary.Base64;
+
+import org.apache.isis.applib.adapters.DefaultsProvider;
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.applib.value.Blob;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class BlobValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<Blob> implements BlobValueFacet {
+
+    private static final int TYPICAL_LENGTH = 0;
+
+    private static Class<? extends Facet> type() {
+        return BlobValueFacet.class;
+    }
+
+    private static final Blob DEFAULT_VALUE = null;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public BlobValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public BlobValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, Blob.class, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.NOT_HONOURED, DEFAULT_VALUE, configuration, context);
+    }
+
+    @Override
+    public String titleString(final Object object, final Localization localization) {
+        return object != null? ((Blob)object).getName(): "[null]";
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(value, null);
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public Parser<Blob> getParser() {
+        return null;
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // DefaultsProvider
+    // //////////////////////////////////////////////////////////////////
+    
+    @Override
+    public DefaultsProvider<Blob> getDefaultsProvider() {
+        return null;
+    }
+    
+    // //////////////////////////////////////////////////////////////////
+    // EncoderDecoder
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        Blob blob = (Blob)object;
+        return blob.getName() + ":" + blob.getMimeType().getBaseType() + ":" + Base64.encodeBase64String((blob.getBytes()));
+    }
+
+    @Override
+    protected Blob doRestore(final String data) {
+        final int colonIdx = data.indexOf(':');
+        final String name  = data.substring(0, colonIdx);
+        final int colon2Idx  = data.indexOf(":", colonIdx+1);
+        final String mimeTypeBase = data.substring(colonIdx+1, colon2Idx);
+        final byte[] bytes = Base64.decodeBase64(data.substring(colon2Idx+1));
+        try {
+            return new Blob(name, new MimeType(mimeTypeBase), bytes);
+        } catch (MimeTypeParseException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "BlobValueSemanticsProvider";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanPrimitiveValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanPrimitiveValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanPrimitiveValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..ee4d52d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanPrimitiveValueFacetUsingSemanticsProviderFactory.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.value.booleans;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class BooleanPrimitiveValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Boolean> {
+
+    public BooleanPrimitiveValueFacetUsingSemanticsProviderFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != boolean.class) {
+            return;
+        }
+        addFacets(new BooleanPrimitiveValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanPrimitiveValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanPrimitiveValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanPrimitiveValueSemanticsProvider.java
new file mode 100644
index 0000000..8dac70a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanPrimitiveValueSemanticsProvider.java
@@ -0,0 +1,76 @@
+/*
+ *  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.value.booleans;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class BooleanPrimitiveValueSemanticsProvider extends BooleanValueSemanticsProviderAbstract implements PropertyDefaultFacet {
+
+    private static final Boolean DEFAULT_VALUE = Boolean.FALSE;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public BooleanPrimitiveValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public BooleanPrimitiveValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, boolean.class, DEFAULT_VALUE, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // PropertyDefault
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public ObjectAdapter getDefault(final ObjectAdapter inObject) {
+        return createAdapter(boolean.class, Boolean.FALSE);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // BooleanValueFacet impl
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public void reset(final ObjectAdapter object) {
+        object.replacePojo(Boolean.FALSE);
+    }
+
+    @Override
+    public void set(final ObjectAdapter object) {
+        object.replacePojo(Boolean.TRUE);
+    }
+
+    @Override
+    public void toggle(final ObjectAdapter object) {
+        final boolean current = ((Boolean) object.getObject()).booleanValue();
+        final boolean toggled = !current;
+        object.replacePojo(Boolean.valueOf(toggled));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanValueFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanValueFacet.java
new file mode 100644
index 0000000..785c0e1
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanValueFacet.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.value.booleans;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface BooleanValueFacet extends Facet {
+
+    boolean isSet(ObjectAdapter object);
+
+    void set(ObjectAdapter object);
+
+    void reset(ObjectAdapter object);
+
+    void toggle(ObjectAdapter object);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanValueSemanticsProviderAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanValueSemanticsProviderAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanValueSemanticsProviderAbstract.java
new file mode 100644
index 0000000..1c64944
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanValueSemanticsProviderAbstract.java
@@ -0,0 +1,130 @@
+/*
+ *  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.value.booleans;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.util.AdapterUtils;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public abstract class BooleanValueSemanticsProviderAbstract extends ValueSemanticsProviderAndFacetAbstract<Boolean> implements BooleanValueFacet {
+
+    private static Class<? extends Facet> type() {
+        return BooleanValueFacet.class;
+    }
+
+    private static final int TYPICAL_LENGTH = 5;
+
+    public BooleanValueSemanticsProviderAbstract(final FacetHolder holder, final Class<Boolean> adaptedClass, final Boolean defaultValue, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, adaptedClass, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, defaultValue, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Parsing
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected Boolean doParse(final Object context, final String entry) {
+        final String compareTo = entry.trim().toLowerCase();
+        if ("true".equals(compareTo)) {
+            return Boolean.TRUE;
+        } else if ("false".startsWith(compareTo)) {
+            return Boolean.FALSE;
+        } else {
+            throw new TextEntryParseException(String.format("'%s' cannot be parsed as a boolean", entry));
+        }
+    }
+
+    @Override
+    public String titleString(final Object value, final Localization localization) {
+        return value == null ? "" : isSet(value) ? "True" : "False";
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(value, null);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Encode, Decode
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        return isSet(object) ? "T" : "F";
+    }
+
+    @Override
+    protected Boolean doRestore(final String data) {
+        final int dataLength = data.length();
+        if (dataLength == 1) {
+            switch (data.charAt(0)) {
+            case 'T':
+                return Boolean.TRUE;
+            case 'F':
+                return Boolean.FALSE;
+            default:
+                throw new IsisException("Invalid data for logical, expected 'T', 'F' or 'N, but got " + data.charAt(0));
+            }
+        } else if (dataLength == 4 || dataLength == 5) {
+            switch (data.charAt(0)) {
+            case 't':
+                return Boolean.TRUE;
+            case 'f':
+                return Boolean.FALSE;
+            default:
+                throw new IsisException("Invalid data for logical, expected 't' or 'f', but got " + data.charAt(0));
+            }
+        }
+        throw new IsisException("Invalid data for logical, expected 1, 4 or 5 bytes, got " + dataLength + ": " + data);
+    }
+
+    private boolean isSet(final Object value) {
+        return ((Boolean) value).booleanValue();
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // BooleanValueFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public boolean isSet(final ObjectAdapter adapter) {
+        if (!AdapterUtils.exists(adapter)) {
+            return false;
+        }
+        final Object object = adapter.getObject();
+        final Boolean objectAsBoolean = (Boolean) object;
+        return objectAsBoolean.booleanValue();
+    }
+
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "BooleanValueSemanticsProvider";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanWrapperValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanWrapperValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanWrapperValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..658a5e5
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanWrapperValueFacetUsingSemanticsProviderFactory.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.value.booleans;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class BooleanWrapperValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Boolean> {
+
+    public BooleanWrapperValueFacetUsingSemanticsProviderFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != Boolean.class) {
+            return;
+        }
+        addFacets(new BooleanWrapperValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanWrapperValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanWrapperValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanWrapperValueSemanticsProvider.java
new file mode 100644
index 0000000..d8dae39
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/booleans/BooleanWrapperValueSemanticsProvider.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.metamodel.facets.value.booleans;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class BooleanWrapperValueSemanticsProvider extends BooleanValueSemanticsProviderAbstract {
+
+    private static final Boolean DEFAULT_PROVIDER = Boolean.FALSE;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public BooleanWrapperValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public BooleanWrapperValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, Boolean.class, DEFAULT_PROVIDER, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // BooleanValueFacet impl
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public void reset(final ObjectAdapter adapter) {
+        adapter.replacePojo(Boolean.FALSE);
+    }
+
+    @Override
+    public void set(final ObjectAdapter adapter) {
+        adapter.replacePojo(Boolean.TRUE);
+    }
+
+    @Override
+    public void toggle(final ObjectAdapter adapter) {
+        final Object currentObj = adapter.getObject();
+        if (currentObj == null) {
+            set(adapter);
+            return;
+        }
+        final boolean current = ((Boolean) currentObj).booleanValue();
+        final boolean toggled = !current;
+        adapter.replacePojo(Boolean.valueOf(toggled));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/BytePrimitiveValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/BytePrimitiveValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/BytePrimitiveValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..39f0edc
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/BytePrimitiveValueFacetUsingSemanticsProviderFactory.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.value.bytes;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class BytePrimitiveValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Byte> {
+
+    public BytePrimitiveValueFacetUsingSemanticsProviderFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != byte.class) {
+            return;
+        }
+        addFacets(new BytePrimitiveValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/BytePrimitiveValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/BytePrimitiveValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/BytePrimitiveValueSemanticsProvider.java
new file mode 100644
index 0000000..e7f3ebd
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/BytePrimitiveValueSemanticsProvider.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.metamodel.facets.value.bytes;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class BytePrimitiveValueSemanticsProvider extends ByteValueSemanticsProviderAbstract implements PropertyDefaultFacet {
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public BytePrimitiveValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public BytePrimitiveValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, byte.class, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // PropertyDefaultFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public ObjectAdapter getDefault(final ObjectAdapter adapter) {
+        return createAdapter(byte.class, Byte.valueOf((byte) 0));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteValueFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteValueFacet.java
new file mode 100644
index 0000000..618e72d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteValueFacet.java
@@ -0,0 +1,29 @@
+/*
+ *  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.value.bytes;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface ByteValueFacet extends Facet {
+    Byte byteValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(Byte value);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteValueSemanticsProviderAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteValueSemanticsProviderAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteValueSemanticsProviderAbstract.java
new file mode 100644
index 0000000..eeb8b1d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteValueSemanticsProviderAbstract.java
@@ -0,0 +1,109 @@
+/*
+ *  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.value.bytes;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.ParseException;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public abstract class ByteValueSemanticsProviderAbstract extends ValueSemanticsProviderAndFacetAbstract<Byte> implements ByteValueFacet {
+
+    private static Class<? extends Facet> type() {
+        return ByteValueFacet.class;
+    }
+
+    private static final Byte DEFAULT_VALUE = Byte.valueOf((byte) 0);
+    private static final int TYPICAL_LENGTH = 4;
+
+    private final NumberFormat format;
+
+    public ByteValueSemanticsProviderAbstract(final FacetHolder holder, final Class<Byte> adaptedClass, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, adaptedClass, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, DEFAULT_VALUE, configuration, context);
+        format = determineNumberFormat("value.format.byte");
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected Byte doParse(final Object context, final String entry) {
+        try {
+            return Byte.valueOf(format.parse(entry).byteValue());
+        } catch (final ParseException e) {
+            throw new TextEntryParseException("Not a number " + entry, e);
+        }
+    }
+
+    @Override
+    public String titleString(final Object value, final Localization localization) {
+        return titleString(format, value);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // EncoderDecoder
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public String doEncode(final Object object) {
+        return object.toString();
+    }
+
+    @Override
+    protected Byte doRestore(final String data) {
+        return new Byte(data);
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(new DecimalFormat(usingMask), value);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // ByteValueFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public Byte byteValue(final ObjectAdapter object) {
+        return (Byte) object.getObject();
+    }
+
+    @Override
+    public ObjectAdapter createValue(final Byte value) {
+        return getAdapterManager().adapterFor(value);
+    }
+
+    // ///// toString ///////
+
+    @Override
+    public String toString() {
+        return "ByteValueSemanticsProvider: " + format;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteWrapperValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteWrapperValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteWrapperValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..ac05297
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteWrapperValueFacetUsingSemanticsProviderFactory.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.value.bytes;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class ByteWrapperValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Byte> {
+
+    public ByteWrapperValueFacetUsingSemanticsProviderFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != Byte.class) {
+            return;
+        }
+        addFacets(new ByteWrapperValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteWrapperValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteWrapperValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteWrapperValueSemanticsProvider.java
new file mode 100644
index 0000000..d38aa3e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/bytes/ByteWrapperValueSemanticsProvider.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.value.bytes;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class ByteWrapperValueSemanticsProvider extends ByteValueSemanticsProviderAbstract {
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public ByteWrapperValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public ByteWrapperValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, Byte.class, configuration, context);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharPrimitiveValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharPrimitiveValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharPrimitiveValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..110cca2
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharPrimitiveValueFacetUsingSemanticsProviderFactory.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.value.chars;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class CharPrimitiveValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Character> {
+
+    public CharPrimitiveValueFacetUsingSemanticsProviderFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != char.class) {
+            return;
+        }
+        addFacets(new CharPrimitiveValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharPrimitiveValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharPrimitiveValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharPrimitiveValueSemanticsProvider.java
new file mode 100644
index 0000000..7433983
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharPrimitiveValueSemanticsProvider.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.metamodel.facets.value.chars;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class CharPrimitiveValueSemanticsProvider extends CharValueSemanticsProviderAbstract implements PropertyDefaultFacet {
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public CharPrimitiveValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public CharPrimitiveValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, char.class, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // PropertyDefaultFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public ObjectAdapter getDefault(final ObjectAdapter inObject) {
+        return createAdapter(char.class, Character.valueOf(' '));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharValueFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharValueFacet.java
new file mode 100644
index 0000000..d13dba5
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharValueFacet.java
@@ -0,0 +1,29 @@
+/*
+ *  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.value.chars;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface CharValueFacet extends Facet {
+    Character charValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(Character value);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharValueSemanticsProviderAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharValueSemanticsProviderAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharValueSemanticsProviderAbstract.java
new file mode 100644
index 0000000..0cee3c9
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharValueSemanticsProviderAbstract.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.metamodel.facets.value.chars;
+
+import java.text.DecimalFormat;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.InvalidEntryException;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public abstract class CharValueSemanticsProviderAbstract extends ValueSemanticsProviderAndFacetAbstract<Character> implements CharValueFacet {
+
+    private static Class<? extends Facet> type() {
+        return CharValueFacet.class;
+    }
+
+    private static final Character DEFAULT_VALUE = Character.valueOf((char) 0);
+    private static final int TYPICAL_LENGTH = 1;
+
+    public CharValueSemanticsProviderAbstract(final FacetHolder holder, final Class<Character> adaptedClass, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, adaptedClass, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, DEFAULT_VALUE, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public Character doParse(final Object context, final String entry) {
+        if (entry.length() > 1) {
+            throw new InvalidEntryException("Only a single character is required");
+        } else {
+            return Character.valueOf(entry.charAt(0));
+        }
+    }
+
+    @Override
+    public String titleString(final Object value, final Localization localization) {
+        return value == null ? "" : value.toString();
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(new DecimalFormat(usingMask), value);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // EncoderDecoder
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        return object.toString();
+    }
+
+    @Override
+    protected Character doRestore(final String data) {
+        return Character.valueOf(data.charAt(0));
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // CharValueFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public Character charValue(final ObjectAdapter object) {
+        return object == null ? null : (Character) object.getObject();
+    }
+
+    @Override
+    public ObjectAdapter createValue(final Character value) {
+        return getAdapterManager().adapterFor(value);
+    }
+
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "CharacterValueSemanticsProvider";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharWrapperValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharWrapperValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharWrapperValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..014fe8d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharWrapperValueFacetUsingSemanticsProviderFactory.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.value.chars;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class CharWrapperValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Character> {
+
+    public CharWrapperValueFacetUsingSemanticsProviderFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != Character.class) {
+            return;
+        }
+        addFacets(new CharWrapperValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharWrapperValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharWrapperValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharWrapperValueSemanticsProvider.java
new file mode 100644
index 0000000..c9a2131
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/chars/CharWrapperValueSemanticsProvider.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.value.chars;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class CharWrapperValueSemanticsProvider extends CharValueSemanticsProviderAbstract {
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public CharWrapperValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public CharWrapperValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, Character.class, configuration, context);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueFacet.java
new file mode 100644
index 0000000..b1257a3
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueFacet.java
@@ -0,0 +1,26 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.value.clobs;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface ClobValueFacet extends Facet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..fa5a02e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueFacetUsingSemanticsProviderFactory.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.value.clobs;
+
+import org.apache.isis.applib.value.Clob;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class ClobValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Clob> {
+
+    public ClobValueFacetUsingSemanticsProviderFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+        if (type != Clob.class) {
+            return;
+        }
+        addFacets(new ClobValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueSemanticsProvider.java
new file mode 100644
index 0000000..a303db7
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/clobs/ClobValueSemanticsProvider.java
@@ -0,0 +1,119 @@
+/*
+ *  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.value.clobs;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+
+import org.apache.isis.applib.adapters.DefaultsProvider;
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.applib.value.Clob;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class ClobValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<Clob> implements ClobValueFacet {
+
+    private static final int TYPICAL_LENGTH = 0;
+
+    private static Class<? extends Facet> type() {
+        return ClobValueFacet.class;
+    }
+
+    private static final Clob DEFAULT_VALUE = null;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public ClobValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public ClobValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, Clob.class, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.NOT_HONOURED, DEFAULT_VALUE, configuration, context);
+    }
+
+    @Override
+    public String titleString(final Object object, final Localization localization) {
+        return object != null? ((Clob)object).getName(): "[null]";
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(value, null);
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public Parser<Clob> getParser() {
+        return null;
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // DefaultsProvider
+    // //////////////////////////////////////////////////////////////////
+    
+    @Override
+    public DefaultsProvider<Clob> getDefaultsProvider() {
+        return null;
+    }
+    
+    // //////////////////////////////////////////////////////////////////
+    // EncoderDecoder
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        Clob clob = (Clob)object;
+        return clob.getName() + ":" + clob.getMimeType().getBaseType() + ":" + clob.getChars();
+    }
+
+    @Override
+    protected Clob doRestore(final String data) {
+        final int colonIdx = data.indexOf(':');
+        final String name  = data.substring(0, colonIdx);
+        final int colon2Idx  = data.indexOf(":", colonIdx+1);
+        final String mimeTypeBase = data.substring(colonIdx+1, colon2Idx);
+        final CharSequence chars = data.substring(colon2Idx+1);
+        try {
+            return new Clob(name, new MimeType(mimeTypeBase), chars);
+        } catch (MimeTypeParseException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "ClobValueSemanticsProvider";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueFacet.java
new file mode 100644
index 0000000..6c4442e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueFacet.java
@@ -0,0 +1,29 @@
+/*
+ *  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.value.color;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface ColorValueFacet extends Facet {
+    int colorValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(ObjectAdapter object, int color);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..77caa5a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueFacetUsingSemanticsProviderFactory.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.value.color;
+
+import org.apache.isis.applib.value.Color;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class ColorValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Color> {
+
+    public ColorValueFacetUsingSemanticsProviderFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != Color.class) {
+            return;
+        }
+        addFacets(new ColorValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueSemanticsProvider.java
new file mode 100644
index 0000000..b4b1138
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/color/ColorValueSemanticsProvider.java
@@ -0,0 +1,127 @@
+/*
+ *  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.value.color;
+
+import java.text.DecimalFormat;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.applib.value.Color;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderContext;
+
+public class ColorValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<Color> implements ColorValueFacet {
+
+    public static Class<? extends Facet> type() {
+        return ColorValueFacet.class;
+    }
+
+    private static final Color DEFAULT_VALUE = Color.BLACK;
+    private static final int TYPICAL_LENGTH = 4;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public ColorValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public ColorValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, Color.class, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.NOT_HONOURED, DEFAULT_VALUE, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected Color doParse(final Object context, final String text) {
+        try {
+            if (text.startsWith("0x")) {
+                return new Color(Integer.parseInt(text.substring(2), 16));
+            } else if (text.startsWith("#")) {
+                return new Color(Integer.parseInt(text.substring(1), 16));
+            } else {
+                return new Color(Integer.parseInt(text));
+            }
+        } catch (final NumberFormatException e) {
+            throw new TextEntryParseException("Not a number " + text, e);
+        }
+    }
+
+    @Override
+    public String titleString(final Object object, final Localization localization) {
+        final Color color = (Color) object;
+        return color.title();
+    }
+
+    @Override
+    public String titleStringWithMask(final Object object, final String usingMask) {
+        final Color color = (Color) object;
+        return titleString(new DecimalFormat(usingMask), color.intValue());
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Encode, Decode
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        final Color color = (Color) object;
+        return Integer.toHexString(color.intValue());
+    }
+
+    @Override
+    protected Color doRestore(final String data) {
+        return new Color(Integer.parseInt(data, 16));
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // ColorValueFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public int colorValue(final ObjectAdapter object) {
+        if (object == null) {
+            return 0;
+        }
+        final Color color = (Color) object.getObject();
+        return color.intValue();
+    }
+
+    @Override
+    public ObjectAdapter createValue(final ObjectAdapter object, final int colorAsInt) {
+        final Color color = new Color(colorAsInt);
+        return getAdapterManager().adapterFor(color);
+    }
+
+    @Override
+    public String toString() {
+        return "ColorValueSemanticsProvider";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/date/DateValueFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/date/DateValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/date/DateValueFacet.java
new file mode 100644
index 0000000..d202f93
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/date/DateValueFacet.java
@@ -0,0 +1,33 @@
+/*
+ *  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.value.date;
+
+import java.util.Date;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface DateValueFacet extends Facet {
+
+    Date dateValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(Date date);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/date/DateValueFacetUsingSemanticsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/date/DateValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/date/DateValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..b94115f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/date/DateValueFacetUsingSemanticsProviderFactory.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.value.date;
+
+import org.apache.isis.applib.value.Date;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+
+public class DateValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<Date> {
+
+    public DateValueFacetUsingSemanticsProviderFactory() {
+        super(); // as per inherited
+                                     // DateTimeValueSemanticsProvider#facetType
+        // (inherited)
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != org.apache.isis.applib.value.Date.class) {
+            return;
+        }
+        addFacets(new DateValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}