You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/09/18 13:34:58 UTC
[isis] branch master updated: ISIS-2871: Spring managed value
semantics for short/int/long
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 09acfab ISIS-2871: Spring managed value semantics for short/int/long
09acfab is described below
commit 09acfab4c2f89f013591bc1850ec8fe8ce0955fb
Author: andi-huber <ah...@apache.org>
AuthorDate: Sat Sep 18 15:34:45 2021 +0200
ISIS-2871: Spring managed value semantics for short/int/long
and wrappers; also doing a more robust parsing
---
.../adapters/AbstractValueSemanticsProvider.java | 47 +++++++++
.../core/metamodel/IsisModuleCoreMetamodel.java | 6 ++
...iveValueFacetUsingSemanticsProviderFactory.java | 46 ---------
.../IntPrimitiveValueSemanticsProvider.java | 46 ---------
.../integer/IntValueSemanticsProviderAbstract.java | 115 ---------------------
...perValueFacetUsingSemanticsProviderFactory.java | 46 ---------
.../integer/IntWrapperValueSemanticsProvider.java | 30 ------
.../facets/value/integer/IntegerValueFacet.java | 29 ------
...iveValueFacetUsingSemanticsProviderFactory.java | 46 ---------
.../longs/LongPrimitiveValueSemanticsProvider.java | 42 --------
.../facets/value/longs/LongValueFacet.java | 29 ------
.../longs/LongValueSemanticsProviderAbstract.java | 110 --------------------
...perValueFacetUsingSemanticsProviderFactory.java | 46 ---------
.../longs/LongWrapperValueSemanticsProvider.java | 30 ------
...iveValueFacetUsingSemanticsProviderFactory.java | 46 ---------
.../ShortPrimitiveValueSemanticsProvider.java | 42 --------
.../facets/value/shortint/ShortValueFacet.java | 29 ------
.../ShortValueSemanticsProviderAbstract.java | 113 --------------------
...perValueFacetUsingSemanticsProviderFactory.java | 46 ---------
.../ShortWrapperValueSemanticsProvider.java | 30 ------
.../dflt/ProgrammingModelFacetsJava11.java | 12 ---
.../valuesemantics/BigDecimalValueSemantics.java | 24 +----
.../valuesemantics/BigIntegerValueSemantics.java | 12 +--
.../valuesemantics/ByteValueSemantics.java | 6 +-
...eValueSemantics.java => IntValueSemantics.java} | 36 +++----
...ValueSemantics.java => LongValueSemantics.java} | 36 +++----
...alueSemantics.java => ShortValueSemantics.java} | 38 +++----
.../facets/param/name/ParameterNameFacetTest.java | 2 +-
.../value/IntValueSemanticsProviderTest.java | 16 +--
.../value/LongValueSemanticsProviderTest.java | 15 +--
.../value/ShortValueSemanticsProviderTest.java | 16 +--
31 files changed, 129 insertions(+), 1058 deletions(-)
diff --git a/api/applib/src/main/java/org/apache/isis/applib/adapters/AbstractValueSemanticsProvider.java b/api/applib/src/main/java/org/apache/isis/applib/adapters/AbstractValueSemanticsProvider.java
index bb69452..45d168c 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/adapters/AbstractValueSemanticsProvider.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/adapters/AbstractValueSemanticsProvider.java
@@ -18,15 +18,21 @@
*/
package org.apache.isis.applib.adapters;
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.text.DecimalFormat;
import java.text.NumberFormat;
+import java.text.ParseException;
+import java.text.ParsePosition;
import java.util.Locale;
import java.util.Optional;
import java.util.function.Function;
import org.springframework.lang.Nullable;
+import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
import org.apache.isis.applib.services.iactnlayer.InteractionContext;
+import org.apache.isis.commons.internal.base._Strings;
/**
* @since 2.x {@index}
@@ -86,4 +92,45 @@ implements ValueSemanticsProvider<T> {
.orElse(NULL_REPRESENTATION);
}
+ // -- NUMBER PARSING
+
+ protected @Nullable BigInteger parseInteger(
+ final @Nullable ValueSemanticsProvider.Context context,
+ final @Nullable String text) {
+ final var input = _Strings.blankToNullOrTrim(text);
+ if(input==null) {
+ return null;
+ }
+ try {
+ return parseDecimal(context, input).toBigIntegerExact();
+ } catch (final NumberFormatException | ArithmeticException e) {
+ throw new TextEntryParseException("Not an integer value " + text, e);
+ }
+ }
+
+ protected @Nullable BigDecimal parseDecimal(
+ final @Nullable ValueSemanticsProvider.Context context,
+ final @Nullable String text) {
+ final var input = _Strings.blankToNullOrTrim(text);
+ if(input==null) {
+ return null;
+ }
+ final var format = getNumberFormat(context);
+ format.setParseBigDecimal(true);
+ final var position = new ParsePosition(0);
+
+ try {
+ final var number = (BigDecimal)format.parse(input, position);
+ if (position.getErrorIndex() != -1) {
+ throw new ParseException("could not parse input='" + input + "'", position.getErrorIndex());
+ } else if (position.getIndex() < input.length()) {
+ throw new ParseException("input='" + input + "' wasnt processed completely", position.getIndex());
+ }
+ return number;
+ } catch (final NumberFormatException | ParseException e) {
+ throw new TextEntryParseException("Not a decimal value " + input, e);
+ }
+
+ }
+
}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/IsisModuleCoreMetamodel.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/IsisModuleCoreMetamodel.java
index dca97b0..3b35d06 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/IsisModuleCoreMetamodel.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/IsisModuleCoreMetamodel.java
@@ -57,9 +57,12 @@ import org.apache.isis.core.metamodel.valuesemantics.BooleanValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.BufferedImageValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.ByteValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.ClobValueSemantics;
+import org.apache.isis.core.metamodel.valuesemantics.IntValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.LocalResourcePathValueSemantics;
+import org.apache.isis.core.metamodel.valuesemantics.LongValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.MarkupValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.PasswordValueSemantics;
+import org.apache.isis.core.metamodel.valuesemantics.ShortValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.StringValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.TreeNodeValueSemantics;
import org.apache.isis.core.metamodel.valuesemantics.URLValueSemantics;
@@ -95,6 +98,9 @@ import org.apache.isis.core.security.IsisModuleCoreSecurity;
// Value Semantics (built-in defaults)
BooleanValueSemantics.class,
ByteValueSemantics.class,
+ ShortValueSemantics.class,
+ IntValueSemantics.class,
+ LongValueSemantics.class,
BigDecimalValueSemantics.class,
BigIntegerValueSemantics.class,
StringValueSemantics.class,
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntPrimitiveValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntPrimitiveValueFacetUsingSemanticsProviderFactory.java
deleted file mode 100644
index 6593a57..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntPrimitiveValueFacetUsingSemanticsProviderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.integer;
-
-import javax.inject.Inject;
-
-import org.apache.isis.core.metamodel.context.MetaModelContext;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
-
-public class IntPrimitiveValueFacetUsingSemanticsProviderFactory
-extends ValueFacetUsingSemanticsProviderFactory<Integer> {
-
- @Inject
- public IntPrimitiveValueFacetUsingSemanticsProviderFactory(final MetaModelContext mmc) {
- super(mmc);
- }
-
- @Override
- public void process(final ProcessClassContext processClassContext) {
- final Class<?> type = processClassContext.getCls();
- final FacetHolder holder = processClassContext.getFacetHolder();
-
- if (type != int.class) {
- return;
- }
- addValueFacet(new IntPrimitiveValueSemanticsProvider(holder));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntPrimitiveValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntPrimitiveValueSemanticsProvider.java
deleted file mode 100644
index a96e212..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntPrimitiveValueSemanticsProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.integer;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-
-public class IntPrimitiveValueSemanticsProvider
-extends IntValueSemanticsProviderAbstract
-implements PropertyDefaultFacet {
-
- public IntPrimitiveValueSemanticsProvider() {
- this(null);
- }
-
- public IntPrimitiveValueSemanticsProvider(final FacetHolder holder) {
- super(holder, int.class);
- }
-
- // //////////////////////////////////////////////////////////////////
- // PropertyDefaultFacet
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public ManagedObject getDefault(final ManagedObject inObject) {
- return createAdapter(int.class, Integer.valueOf(0));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntValueSemanticsProviderAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntValueSemanticsProviderAbstract.java
deleted file mode 100644
index a46f00d..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntValueSemanticsProviderAbstract.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.integer;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.Locale;
-import java.util.function.BiConsumer;
-
-import org.apache.isis.applib.adapters.ValueSemanticsProvider;
-import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
-import org.apache.isis.core.metamodel.commons.LocaleUtil;
-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.spec.ManagedObject;
-
-public abstract class IntValueSemanticsProviderAbstract
-extends ValueSemanticsProviderAndFacetAbstract<Integer>
-implements IntegerValueFacet {
-
- private static final Class<? extends Facet> type() {
- return IntegerValueFacet.class;
- }
-
- private static final Integer DEFAULT_VALUE = Integer.valueOf(0);
- private static final int MAX_LENGTH = 9;
- private static final int TYPICAL_LENGTH = MAX_LENGTH;
-
- private final NumberFormat format;
-
- public IntValueSemanticsProviderAbstract(final FacetHolder holder, final Class<Integer> adaptedClass) {
- super(type(), holder, adaptedClass, TYPICAL_LENGTH, MAX_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, DEFAULT_VALUE);
- final String formatRequired = getConfiguration().getValueTypes().getPrimitives().getInt().getFormat();
-
- NumberFormat result;
- if (formatRequired != null) {
- result = new DecimalFormat(formatRequired);
- } else {
- final Locale inLocale = getConfiguration().getCore().getRuntime().getLocale().map(LocaleUtil::findLocale).orElse(Locale.getDefault());
- result = NumberFormat.getNumberInstance(inLocale);
- }
- format = result;
- }
-
- // //////////////////////////////////////////////////////////////////
- // Parser
- // //////////////////////////////////////////////////////////////////
-
- @Override
- protected Integer doParse(final ValueSemanticsProvider.Context context, final String entry) {
- try {
- return Integer.valueOf(format.parse(entry).intValue());
- } catch (final ParseException e) {
- throw new TextEntryParseException("Not a whole number " + entry, e);
- }
- }
-
- @Override
- public String asTitleString(final Integer value) {
- return titleString(format, value);
- }
-
-
- // //////////////////////////////////////////////////////////////////
- // EncoderDecoder
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public String toEncodedString(final Integer object) {
- return object.toString();
- }
-
- @Override
- public Integer fromEncodedString(final String data) {
- return Integer.parseInt(data);
- }
-
- // //////////////////////////////////////////////////////////////////
- // IntegerValueFacet
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public Integer integerValue(final ManagedObject object) {
- return (Integer) (object == null ? null : object.getPojo());
- }
-
- @Override
- public ManagedObject createValue(final Integer value) {
- return value == null ? null : getObjectManager().adapt(value);
- }
-
- @Override
- public void visitAttributes(final BiConsumer<String, Object> visitor) {
- super.visitAttributes(visitor);
- visitor.accept("format", format);
- }
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntWrapperValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntWrapperValueFacetUsingSemanticsProviderFactory.java
deleted file mode 100644
index 6411911..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntWrapperValueFacetUsingSemanticsProviderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.integer;
-
-import javax.inject.Inject;
-
-import org.apache.isis.core.metamodel.context.MetaModelContext;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
-
-public class IntWrapperValueFacetUsingSemanticsProviderFactory
-extends ValueFacetUsingSemanticsProviderFactory<Integer> {
-
- @Inject
- public IntWrapperValueFacetUsingSemanticsProviderFactory(final MetaModelContext mmc) {
- super(mmc);
- }
-
- @Override
- public void process(final ProcessClassContext processClassContext) {
- final Class<?> type = processClassContext.getCls();
- final FacetHolder holder = processClassContext.getFacetHolder();
-
- if (type != Integer.class) {
- return;
- }
- addValueFacet(new IntWrapperValueSemanticsProvider(holder));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntWrapperValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntWrapperValueSemanticsProvider.java
deleted file mode 100644
index b32bbbe..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntWrapperValueSemanticsProvider.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.integer;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-public class IntWrapperValueSemanticsProvider
-extends IntValueSemanticsProviderAbstract {
-
- public IntWrapperValueSemanticsProvider(final FacetHolder holder) {
- super(holder, Integer.class);
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntegerValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntegerValueFacet.java
deleted file mode 100644
index a3a01da..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/integer/IntegerValueFacet.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.integer;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-
-public interface IntegerValueFacet extends Facet {
-
- Integer integerValue(ManagedObject object);
-
- ManagedObject createValue(Integer value);
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongPrimitiveValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongPrimitiveValueFacetUsingSemanticsProviderFactory.java
deleted file mode 100644
index 1800338..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongPrimitiveValueFacetUsingSemanticsProviderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.longs;
-
-import javax.inject.Inject;
-
-import org.apache.isis.core.metamodel.context.MetaModelContext;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
-
-public class LongPrimitiveValueFacetUsingSemanticsProviderFactory
-extends ValueFacetUsingSemanticsProviderFactory<Long> {
-
- @Inject
- public LongPrimitiveValueFacetUsingSemanticsProviderFactory(final MetaModelContext mmc) {
- super(mmc);
- }
-
- @Override
- public void process(final ProcessClassContext processClassContext) {
- final Class<?> type = processClassContext.getCls();
- final FacetHolder holder = processClassContext.getFacetHolder();
-
- if (type != long.class) {
- return;
- }
- addValueFacet(new LongPrimitiveValueSemanticsProvider(holder));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongPrimitiveValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongPrimitiveValueSemanticsProvider.java
deleted file mode 100644
index 09f624e..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongPrimitiveValueSemanticsProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.longs;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-
-public class LongPrimitiveValueSemanticsProvider
-extends LongValueSemanticsProviderAbstract
-implements PropertyDefaultFacet {
-
- public LongPrimitiveValueSemanticsProvider(final FacetHolder holder) {
- super(holder, long.class);
- }
-
- // //////////////////////////////////////////////////////////////////
- // PropertyDefaultFacet
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public ManagedObject getDefault(final ManagedObject inObject) {
- return createAdapter(long.class, Long.valueOf(0L));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongValueFacet.java
deleted file mode 100644
index 9c1e16d..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongValueFacet.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.longs;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-
-public interface LongValueFacet extends Facet {
-
- Long longValue(ManagedObject object);
-
- ManagedObject createValue(Long value);
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongValueSemanticsProviderAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongValueSemanticsProviderAbstract.java
deleted file mode 100644
index d3388ab..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongValueSemanticsProviderAbstract.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.longs;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.Locale;
-import java.util.function.BiConsumer;
-
-import org.apache.isis.applib.adapters.ValueSemanticsProvider;
-import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
-import org.apache.isis.core.metamodel.commons.LocaleUtil;
-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.spec.ManagedObject;
-
-public abstract class LongValueSemanticsProviderAbstract
-extends ValueSemanticsProviderAndFacetAbstract<Long>
-implements LongValueFacet {
-
- private static final Class<? extends Facet> type() {
- return LongValueFacet.class;
- }
-
- private static final Long DEFAULT_VALUE = Long.valueOf(0L);
- private static final int MAX_LENGTH = 18;
- private static final int TYPICAL_LENGTH = MAX_LENGTH;
-
- private final NumberFormat format;
-
- public LongValueSemanticsProviderAbstract(final FacetHolder holder, final Class<Long> adaptedClass) {
- super(type(), holder, adaptedClass, TYPICAL_LENGTH, MAX_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, DEFAULT_VALUE);
- final String formatRequired = getConfiguration().getValueTypes().getJavaLang().getLong().getFormat();
-
- format = formatRequired != null
- ? new DecimalFormat(formatRequired)
- : NumberFormat.getNumberInstance(getConfiguration().getCore().getRuntime().getLocale().map(LocaleUtil::findLocale).orElse(Locale.getDefault()));
- }
-
-
- // //////////////////////////////////////////////////////////////////
- // Parser
- // //////////////////////////////////////////////////////////////////
-
- @Override
- protected Long doParse(final ValueSemanticsProvider.Context context, final String entry) {
- try {
- return Long.valueOf(format.parse(entry).longValue());
- } catch (final ParseException e) {
- throw new TextEntryParseException("Not a whole number " + entry, e);
- }
- }
-
- @Override
- public String asTitleString(final Long value) {
- return titleString(format, value);
- }
-
- // //////////////////////////////////////////////////////////////////
- // EncoderDecoder
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public String toEncodedString(final Long object) {
- return object.toString();
- }
-
- @Override
- public Long fromEncodedString(final String data) {
- return Long.parseLong(data);
- }
-
- // //////////////////////////////////////////////////////////////////
- // LongValueFacet
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public Long longValue(final ManagedObject object) {
- return (Long) (object == null ? null : object.getPojo());
- }
-
- @Override
- public ManagedObject createValue(final Long value) {
- return value == null ? null : getObjectManager().adapt(value);
- }
-
- @Override
- public void visitAttributes(final BiConsumer<String, Object> visitor) {
- super.visitAttributes(visitor);
- visitor.accept("format", format);
- }
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongWrapperValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongWrapperValueFacetUsingSemanticsProviderFactory.java
deleted file mode 100644
index 153a599..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongWrapperValueFacetUsingSemanticsProviderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.longs;
-
-import javax.inject.Inject;
-
-import org.apache.isis.core.metamodel.context.MetaModelContext;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
-
-public class LongWrapperValueFacetUsingSemanticsProviderFactory
-extends ValueFacetUsingSemanticsProviderFactory<Long> {
-
- @Inject
- public LongWrapperValueFacetUsingSemanticsProviderFactory(final MetaModelContext mmc) {
- super(mmc);
- }
-
- @Override
- public void process(final ProcessClassContext processClassContext) {
- final Class<?> type = processClassContext.getCls();
- final FacetHolder holder = processClassContext.getFacetHolder();
-
- if (type != Long.class) {
- return;
- }
- addValueFacet(new LongWrapperValueSemanticsProvider(holder));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongWrapperValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongWrapperValueSemanticsProvider.java
deleted file mode 100644
index 91e61de..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/longs/LongWrapperValueSemanticsProvider.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.longs;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-public class LongWrapperValueSemanticsProvider
-extends LongValueSemanticsProviderAbstract {
-
- public LongWrapperValueSemanticsProvider(final FacetHolder holder) {
- super(holder, Long.class);
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortPrimitiveValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortPrimitiveValueFacetUsingSemanticsProviderFactory.java
deleted file mode 100644
index 1f1d5fe..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortPrimitiveValueFacetUsingSemanticsProviderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.shortint;
-
-import javax.inject.Inject;
-
-import org.apache.isis.core.metamodel.context.MetaModelContext;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
-
-public class ShortPrimitiveValueFacetUsingSemanticsProviderFactory
-extends ValueFacetUsingSemanticsProviderFactory<Short> {
-
- @Inject
- public ShortPrimitiveValueFacetUsingSemanticsProviderFactory(final MetaModelContext mmc) {
- super(mmc);
- }
-
- @Override
- public void process(final ProcessClassContext processClassContext) {
- final Class<?> type = processClassContext.getCls();
- final FacetHolder holder = processClassContext.getFacetHolder();
-
- if (type != short.class) {
- return;
- }
- addValueFacet(new ShortPrimitiveValueSemanticsProvider(holder));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortPrimitiveValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortPrimitiveValueSemanticsProvider.java
deleted file mode 100644
index ebb440e..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortPrimitiveValueSemanticsProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.shortint;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-
-public class ShortPrimitiveValueSemanticsProvider
-extends ShortValueSemanticsProviderAbstract
-implements PropertyDefaultFacet {
-
- public ShortPrimitiveValueSemanticsProvider(final FacetHolder holder) {
- super(holder, short.class);
- }
-
- // //////////////////////////////////////////////////////////////////
- // PropertyDefaultFacet
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public ManagedObject getDefault(final ManagedObject inObject) {
- return createAdapter(short.class, Short.valueOf((short) 0));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortValueFacet.java
deleted file mode 100644
index b6be9cc..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortValueFacet.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.shortint;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-
-public interface ShortValueFacet extends Facet {
-
- Short shortValue(ManagedObject object);
-
- ManagedObject createValue(Short value);
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortValueSemanticsProviderAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortValueSemanticsProviderAbstract.java
deleted file mode 100644
index 22e39d2..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortValueSemanticsProviderAbstract.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.shortint;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.Locale;
-import java.util.function.BiConsumer;
-
-import org.apache.isis.applib.adapters.ValueSemanticsProvider;
-import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
-import org.apache.isis.core.metamodel.commons.LocaleUtil;
-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.spec.ManagedObject;
-
-public class ShortValueSemanticsProviderAbstract
-extends ValueSemanticsProviderAndFacetAbstract<Short>
-implements ShortValueFacet {
-
- private static final Class<? extends Facet> type() {
- return ShortValueFacet.class;
- }
-
- private static final Short DEFAULT_VALUE = Short.valueOf((short) 0);
- private static final int MAX_LENGTH = 6; // allowing for -ve sign
- private static final int TYPICAL_LENGTH = MAX_LENGTH;
-
- private final NumberFormat format;
-
- public ShortValueSemanticsProviderAbstract(final FacetHolder holder, final Class<Short> adaptedClass) {
- super(type(), holder, adaptedClass, TYPICAL_LENGTH, MAX_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, DEFAULT_VALUE);
- format = xdetermineNumberFormat();
- }
- protected NumberFormat xdetermineNumberFormat() {
- final String formatRequired = getConfiguration().getValueTypes().getJavaLang().getShort().getFormat();
-
- return formatRequired != null
- ? new DecimalFormat(formatRequired)
- : NumberFormat.getNumberInstance(getConfiguration().getCore().getRuntime().getLocale().map(LocaleUtil::findLocale).orElse(Locale.getDefault()));
- }
-
- // //////////////////////////////////////////////////////////////////
- // Parser
- // //////////////////////////////////////////////////////////////////
-
- @Override
- protected Short doParse(final ValueSemanticsProvider.Context context, final String entry) {
- try {
- return Short.valueOf(format.parse(entry).shortValue());
- } catch (final ParseException e) {
- throw new TextEntryParseException("Not a whole number " + entry, e);
- }
- }
-
- @Override
- public String asTitleString(final Short value) {
- return titleString(format, value);
- }
-
- // //////////////////////////////////////////////////////////////////
- // EncoderDecoder
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public String toEncodedString(final Short object) {
- return object.toString();
- }
-
- @Override
- public Short fromEncodedString(final String data) {
- return Short.parseShort(data);
- }
-
- // //////////////////////////////////////////////////////////////////
- // ShortValueFacet
- // //////////////////////////////////////////////////////////////////
-
- @Override
- public ManagedObject createValue(final Short value) {
- return getObjectManager().adapt(value);
- }
-
- @Override
- public Short shortValue(final ManagedObject object) {
- return (Short) (object == null ? null : object.getPojo());
- }
-
- @Override
- public void visitAttributes(final BiConsumer<String, Object> visitor) {
- super.visitAttributes(visitor);
- visitor.accept("format", format);
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortWrapperValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortWrapperValueFacetUsingSemanticsProviderFactory.java
deleted file mode 100644
index 897c0b7..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortWrapperValueFacetUsingSemanticsProviderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.shortint;
-
-import javax.inject.Inject;
-
-import org.apache.isis.core.metamodel.context.MetaModelContext;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
-
-public class ShortWrapperValueFacetUsingSemanticsProviderFactory
-extends ValueFacetUsingSemanticsProviderFactory<Short> {
-
- @Inject
- public ShortWrapperValueFacetUsingSemanticsProviderFactory(final MetaModelContext mmc) {
- super(mmc);
- }
-
- @Override
- public void process(final ProcessClassContext processClassContext) {
- final Class<?> type = processClassContext.getCls();
- final FacetHolder holder = processClassContext.getFacetHolder();
-
- if (type != Short.class) {
- return;
- }
- addValueFacet(new ShortWrapperValueSemanticsProvider(holder));
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortWrapperValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortWrapperValueSemanticsProvider.java
deleted file mode 100644
index 866955b..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/shortint/ShortWrapperValueSemanticsProvider.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.shortint;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-public class ShortWrapperValueSemanticsProvider
-extends ShortValueSemanticsProviderAbstract {
-
- public ShortWrapperValueSemanticsProvider(final FacetHolder holder) {
- super(holder, Short.class);
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/progmodels/dflt/ProgrammingModelFacetsJava11.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/progmodels/dflt/ProgrammingModelFacetsJava11.java
index a0af511..bf4339d 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/progmodels/dflt/ProgrammingModelFacetsJava11.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/progmodels/dflt/ProgrammingModelFacetsJava11.java
@@ -94,12 +94,6 @@ import org.apache.isis.core.metamodel.facets.value.doubles.DoublePrimitiveValueF
import org.apache.isis.core.metamodel.facets.value.doubles.DoubleWrapperValueFacetUsingSemanticsProviderFactory;
import org.apache.isis.core.metamodel.facets.value.floats.FloatPrimitiveValueFacetUsingSemanticsProviderFactory;
import org.apache.isis.core.metamodel.facets.value.floats.FloatWrapperValueFacetUsingSemanticsProviderFactory;
-import org.apache.isis.core.metamodel.facets.value.integer.IntPrimitiveValueFacetUsingSemanticsProviderFactory;
-import org.apache.isis.core.metamodel.facets.value.integer.IntWrapperValueFacetUsingSemanticsProviderFactory;
-import org.apache.isis.core.metamodel.facets.value.longs.LongPrimitiveValueFacetUsingSemanticsProviderFactory;
-import org.apache.isis.core.metamodel.facets.value.longs.LongWrapperValueFacetUsingSemanticsProviderFactory;
-import org.apache.isis.core.metamodel.facets.value.shortint.ShortPrimitiveValueFacetUsingSemanticsProviderFactory;
-import org.apache.isis.core.metamodel.facets.value.shortint.ShortWrapperValueFacetUsingSemanticsProviderFactory;
import org.apache.isis.core.metamodel.facets.value.temporal.localdate.LocalDateValueFacetUsingSemanticsProviderFactory;
import org.apache.isis.core.metamodel.facets.value.temporal.localdatetime.LocalDateTimeValueFacetUsingSemanticsProviderFactory;
import org.apache.isis.core.metamodel.facets.value.temporal.localtime.LocalTimeValueFacetUsingSemanticsProviderFactory;
@@ -259,12 +253,6 @@ extends ProgrammingModelAbstract {
addFactory(FacetProcessingOrder.F1_LAYOUT, new CollectionLayoutFacetFactory(mmc));
// built-in value types for Java language
- addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new ShortPrimitiveValueFacetUsingSemanticsProviderFactory(mmc));
- addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new ShortWrapperValueFacetUsingSemanticsProviderFactory(mmc));
- addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new IntPrimitiveValueFacetUsingSemanticsProviderFactory(mmc));
- addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new IntWrapperValueFacetUsingSemanticsProviderFactory(mmc));
- addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new LongPrimitiveValueFacetUsingSemanticsProviderFactory(mmc));
- addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new LongWrapperValueFacetUsingSemanticsProviderFactory(mmc));
addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new FloatPrimitiveValueFacetUsingSemanticsProviderFactory(mmc));
addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new FloatWrapperValueFacetUsingSemanticsProviderFactory(mmc));
addFactory(FacetProcessingOrder.G1_VALUE_TYPES, new DoublePrimitiveValueFacetUsingSemanticsProviderFactory(mmc));
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/BigDecimalValueSemantics.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/BigDecimalValueSemantics.java
index d491cae..2ffc291 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/BigDecimalValueSemantics.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/BigDecimalValueSemantics.java
@@ -19,8 +19,6 @@
package org.apache.isis.core.metamodel.valuesemantics;
import java.math.BigDecimal;
-import java.text.ParseException;
-import java.text.ParsePosition;
import javax.inject.Named;
@@ -33,8 +31,6 @@ import org.apache.isis.applib.adapters.Parser;
import org.apache.isis.applib.adapters.Renderer;
import org.apache.isis.applib.adapters.ValueSemanticsProvider;
import org.apache.isis.applib.exceptions.UnrecoverableException;
-import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
-import org.apache.isis.commons.internal.base._Strings;
@Component
@Named("isis.val.BigDecimalValueSemantics")
@@ -86,25 +82,7 @@ implements
@Override
public BigDecimal parseTextRepresentation(final ValueSemanticsProvider.Context context, final String text) {
- final var input = _Strings.blankToNullOrTrim(text);
- if(input==null) {
- return null;
- }
- final var format = getNumberFormat(context);
- format.setParseBigDecimal(true);
- final var position = new ParsePosition(0);
-
- try {
- final var number = (BigDecimal)format.parse(input, position);
- if (position.getErrorIndex() != -1) {
- throw new ParseException("could not parse input='" + input + "'", position.getErrorIndex());
- } else if (position.getIndex() < input.length()) {
- throw new ParseException("input='" + input + "' wasnt processed completely", position.getIndex());
- }
- return number;
- } catch (final NumberFormatException | ParseException e) {
- throw new TextEntryParseException("Not a decimal " + input, e);
- }
+ return super.parseDecimal(context, text);
}
@Override
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/BigIntegerValueSemantics.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/BigIntegerValueSemantics.java
index bc664cb..860cbff 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/BigIntegerValueSemantics.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/BigIntegerValueSemantics.java
@@ -29,8 +29,6 @@ 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.adapters.Renderer;
-import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
-import org.apache.isis.commons.internal.base._Strings;
@Component
@Named("isis.val.BigIntegerValueSemantics")
@@ -78,15 +76,7 @@ implements
@Override
public BigInteger parseTextRepresentation(final Context context, final String text) {
- final var input = _Strings.blankToNullOrTrim(text);
- if(input==null) {
- return null;
- }
- try {
- return new BigInteger(input);
- } catch (final NumberFormatException e) {
- throw new TextEntryParseException("Not an integer " + input, e);
- }
+ return super.parseInteger(context, text);
}
@Override
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
index ac21468..4fe9b12 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
@@ -84,9 +84,9 @@ implements
return null;
}
try {
- return Byte.valueOf(input);
- } catch (final NumberFormatException e) {
- throw new TextEntryParseException("Not a byte number " + input, e);
+ return super.parseInteger(context, input).byteValueExact();
+ } catch (final NumberFormatException | ArithmeticException e) {
+ throw new TextEntryParseException("Not a 8-bit signed integer " + input, e);
}
}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/IntValueSemantics.java
similarity index 74%
copy from core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
copy to core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/IntValueSemantics.java
index ac21468..22d7075 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/IntValueSemantics.java
@@ -35,42 +35,42 @@ import org.apache.isis.commons.internal.base._Strings;
*/
@Component
@Named("isis.val.ByteValueSemantics")
-public class ByteValueSemantics
-extends AbstractValueSemanticsProvider<Byte>
+public class IntValueSemantics
+extends AbstractValueSemanticsProvider<Integer>
implements
- DefaultsProvider<Byte>,
- EncoderDecoder<Byte>,
- Parser<Byte>,
- Renderer<Byte> {
+ DefaultsProvider<Integer>,
+ EncoderDecoder<Integer>,
+ Parser<Integer>,
+ Renderer<Integer> {
@Override
- public Byte getDefaultValue() {
- return Byte.valueOf((byte) 0);
+ public Integer getDefaultValue() {
+ return 0;
}
// -- ENCODER DECODER
@Override
- public String toEncodedString(final Byte object) {
+ public String toEncodedString(final Integer object) {
return object.toString();
}
@Override
- public Byte fromEncodedString(final String data) {
- return Byte.parseByte(data);
+ public Integer fromEncodedString(final String data) {
+ return Integer.parseInt(data);
}
// -- RENDERER
@Override
- public String presentationValue(final Context context, final Byte value) {
+ public String presentationValue(final Context context, final Integer value) {
return render(value, getNumberFormat(context)::format);
}
// -- PARSER
@Override
- public String parseableTextRepresentation(final Context context, final Byte value) {
+ public String parseableTextRepresentation(final Context context, final Integer value) {
return value==null
? null
: getNumberFormat(context)
@@ -78,15 +78,15 @@ implements
}
@Override
- public Byte parseTextRepresentation(final Context context, final String text) {
+ public Integer parseTextRepresentation(final Context context, final String text) {
final var input = _Strings.blankToNullOrTrim(text);
if(input==null) {
return null;
}
try {
- return Byte.valueOf(input);
- } catch (final NumberFormatException e) {
- throw new TextEntryParseException("Not a byte number " + input, e);
+ return super.parseInteger(context, input).intValueExact();
+ } catch (final NumberFormatException | ArithmeticException e) {
+ throw new TextEntryParseException("Not a 32-bit signed integer " + input, e);
}
}
@@ -97,7 +97,7 @@ implements
@Override
public int maxLength() {
- return 4;
+ return 9;
}
}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/LongValueSemantics.java
similarity index 76%
copy from core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
copy to core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/LongValueSemantics.java
index ac21468..79775db 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/LongValueSemantics.java
@@ -35,42 +35,42 @@ import org.apache.isis.commons.internal.base._Strings;
*/
@Component
@Named("isis.val.ByteValueSemantics")
-public class ByteValueSemantics
-extends AbstractValueSemanticsProvider<Byte>
+public class LongValueSemantics
+extends AbstractValueSemanticsProvider<Long>
implements
- DefaultsProvider<Byte>,
- EncoderDecoder<Byte>,
- Parser<Byte>,
- Renderer<Byte> {
+ DefaultsProvider<Long>,
+ EncoderDecoder<Long>,
+ Parser<Long>,
+ Renderer<Long> {
@Override
- public Byte getDefaultValue() {
- return Byte.valueOf((byte) 0);
+ public Long getDefaultValue() {
+ return 0L;
}
// -- ENCODER DECODER
@Override
- public String toEncodedString(final Byte object) {
+ public String toEncodedString(final Long object) {
return object.toString();
}
@Override
- public Byte fromEncodedString(final String data) {
- return Byte.parseByte(data);
+ public Long fromEncodedString(final String data) {
+ return Long.parseLong(data);
}
// -- RENDERER
@Override
- public String presentationValue(final Context context, final Byte value) {
+ public String presentationValue(final Context context, final Long value) {
return render(value, getNumberFormat(context)::format);
}
// -- PARSER
@Override
- public String parseableTextRepresentation(final Context context, final Byte value) {
+ public String parseableTextRepresentation(final Context context, final Long value) {
return value==null
? null
: getNumberFormat(context)
@@ -78,15 +78,15 @@ implements
}
@Override
- public Byte parseTextRepresentation(final Context context, final String text) {
+ public Long parseTextRepresentation(final Context context, final String text) {
final var input = _Strings.blankToNullOrTrim(text);
if(input==null) {
return null;
}
try {
- return Byte.valueOf(input);
- } catch (final NumberFormatException e) {
- throw new TextEntryParseException("Not a byte number " + input, e);
+ return super.parseInteger(context, input).longValueExact();
+ } catch (final NumberFormatException | ArithmeticException e) {
+ throw new TextEntryParseException("Not a 64-bit signed integer " + input, e);
}
}
@@ -97,7 +97,7 @@ implements
@Override
public int maxLength() {
- return 4;
+ return 18;
}
}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ShortValueSemantics.java
similarity index 73%
copy from core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
copy to core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ShortValueSemantics.java
index ac21468..1cd6311 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ByteValueSemantics.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/valuesemantics/ShortValueSemantics.java
@@ -34,43 +34,43 @@ import org.apache.isis.commons.internal.base._Strings;
* due to auto-boxing also handles the primitive variant
*/
@Component
-@Named("isis.val.ByteValueSemantics")
-public class ByteValueSemantics
-extends AbstractValueSemanticsProvider<Byte>
+@Named("isis.val.ShortValueSemantics")
+public class ShortValueSemantics
+extends AbstractValueSemanticsProvider<Short>
implements
- DefaultsProvider<Byte>,
- EncoderDecoder<Byte>,
- Parser<Byte>,
- Renderer<Byte> {
+ DefaultsProvider<Short>,
+ EncoderDecoder<Short>,
+ Parser<Short>,
+ Renderer<Short> {
@Override
- public Byte getDefaultValue() {
- return Byte.valueOf((byte) 0);
+ public Short getDefaultValue() {
+ return Short.valueOf((short) 0);
}
// -- ENCODER DECODER
@Override
- public String toEncodedString(final Byte object) {
+ public String toEncodedString(final Short object) {
return object.toString();
}
@Override
- public Byte fromEncodedString(final String data) {
- return Byte.parseByte(data);
+ public Short fromEncodedString(final String data) {
+ return Short.parseShort(data);
}
// -- RENDERER
@Override
- public String presentationValue(final Context context, final Byte value) {
+ public String presentationValue(final Context context, final Short value) {
return render(value, getNumberFormat(context)::format);
}
// -- PARSER
@Override
- public String parseableTextRepresentation(final Context context, final Byte value) {
+ public String parseableTextRepresentation(final Context context, final Short value) {
return value==null
? null
: getNumberFormat(context)
@@ -78,15 +78,15 @@ implements
}
@Override
- public Byte parseTextRepresentation(final Context context, final String text) {
+ public Short parseTextRepresentation(final Context context, final String text) {
final var input = _Strings.blankToNullOrTrim(text);
if(input==null) {
return null;
}
try {
- return Byte.valueOf(input);
- } catch (final NumberFormatException e) {
- throw new TextEntryParseException("Not a byte number " + input, e);
+ return super.parseInteger(context, input).shortValueExact();
+ } catch (final NumberFormatException | ArithmeticException e) {
+ throw new TextEntryParseException("Not a 16-bit signed integer " + input, e);
}
}
@@ -97,7 +97,7 @@ implements
@Override
public int maxLength() {
- return 4;
+ return 6;
}
}
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/param/name/ParameterNameFacetTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/param/name/ParameterNameFacetTest.java
index b61f385..4bd06ec 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/param/name/ParameterNameFacetTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/param/name/ParameterNameFacetTest.java
@@ -67,7 +67,7 @@ extends AbstractFacetFactoryJUnit4TestCase {
@Test
public void verifyProgrammingModelNumberOfFactories() {
- assertEquals(89, programmingModel.streamFactories().count());
+ assertEquals(83, programmingModel.streamFactories().count());
}
@Test //verify we have the javac -parameter flag set when compiling this class
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/IntValueSemanticsProviderTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/IntValueSemanticsProviderTest.java
index c968c67..24b6029 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/IntValueSemanticsProviderTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/IntValueSemanticsProviderTest.java
@@ -21,30 +21,24 @@ package org.apache.isis.core.metamodel.facets.value;
import org.junit.Before;
import org.junit.Test;
+import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
+import org.apache.isis.core.metamodel.valuesemantics.IntValueSemantics;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetHolderAbstract;
-import org.apache.isis.core.metamodel.facets.value.integer.IntValueSemanticsProviderAbstract;
-import org.apache.isis.core.metamodel.facets.value.integer.IntWrapperValueSemanticsProvider;
-
public class IntValueSemanticsProviderTest
extends ValueSemanticsProviderAbstractTestCase {
- private IntValueSemanticsProviderAbstract value;
+ private IntValueSemantics value;
private Integer integer;
- private FacetHolder holder;
@Before
public void setUpObjects() throws Exception {
integer = Integer.valueOf(32);
allowMockAdapterToReturn(integer);
- holder = FacetHolderAbstract.forTesting(metaModelContext);
-
- setValue(value = new IntWrapperValueSemanticsProvider(holder));
+ setSemanitcs(value = new IntValueSemantics());
}
@Test
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/LongValueSemanticsProviderTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/LongValueSemanticsProviderTest.java
index 2475ea3..dc022b2 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/LongValueSemanticsProviderTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/LongValueSemanticsProviderTest.java
@@ -21,30 +21,25 @@ package org.apache.isis.core.metamodel.facets.value;
import org.junit.Before;
import org.junit.Test;
+import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
+import org.apache.isis.core.metamodel.valuesemantics.LongValueSemantics;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetHolderAbstract;
-import org.apache.isis.core.metamodel.facets.value.longs.LongValueSemanticsProviderAbstract;
-import org.apache.isis.core.metamodel.facets.value.longs.LongWrapperValueSemanticsProvider;
-
public class LongValueSemanticsProviderTest
extends ValueSemanticsProviderAbstractTestCase {
- private LongValueSemanticsProviderAbstract value;
+ private LongValueSemantics value;
private Long longObj;
- private FacetHolder holder;
@Before
public void setUpObjects() throws Exception {
longObj = Long.valueOf(367322);
allowMockAdapterToReturn(longObj);
- holder = FacetHolderAbstract.forTesting(metaModelContext);
- setValue(value = new LongWrapperValueSemanticsProvider(holder));
+ setSemanitcs(value = new LongValueSemantics());
}
@Test
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/ShortValueSemanticsProviderTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/ShortValueSemanticsProviderTest.java
index 318e086..8d3845b 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/ShortValueSemanticsProviderTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/value/ShortValueSemanticsProviderTest.java
@@ -21,21 +21,17 @@ package org.apache.isis.core.metamodel.facets.value;
import org.junit.Before;
import org.junit.Test;
+import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
+import org.apache.isis.core.metamodel.valuesemantics.ShortValueSemantics;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.apache.isis.applib.exceptions.recoverable.TextEntryParseException;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetHolderAbstract;
-import org.apache.isis.core.metamodel.facets.value.shortint.ShortValueSemanticsProviderAbstract;
-import org.apache.isis.core.metamodel.facets.value.shortint.ShortWrapperValueSemanticsProvider;
-
public class ShortValueSemanticsProviderTest
extends ValueSemanticsProviderAbstractTestCase {
- private ShortValueSemanticsProviderAbstract value;
+ private ShortValueSemantics value;
private Short short1;
- private FacetHolder holder;
@Before
public void setUpObjects() throws Exception {
@@ -43,9 +39,7 @@ extends ValueSemanticsProviderAbstractTestCase {
short1 = Short.valueOf((short) 32);
allowMockAdapterToReturn(short1);
- holder = FacetHolderAbstract.forTesting(metaModelContext);
-
- setValue(value = new ShortWrapperValueSemanticsProvider(holder));
+ setSemanitcs(value = new ShortValueSemantics());
}
@Test