= ValueSemanticsProvider
:Notice: 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.

Provides a mechanism for providing a set of value semantics.

This interface is used by xref:refguide:applib:index/annotation/Value.adoc[Value] to allow these semantics to be provided through a single point. Alternatively, xref:refguide:applib:index/annotation/Value.adoc[Value] supports this information being provided via the configuration files.

Whatever the class that implements this interface, it must also expose either a `public` no-arg constructor, or (for implementations that also are `Facet` s) a `public` constructor that accepts a `FacetHolder` , and `IsisConfiguration` and a `ValueSemanticsProviderContext` . This constructor is then used by the framework to instantiate the object reflectively.

== API

[source,java]
.ValueSemanticsProvider.java
----
interface ValueSemanticsProvider<T> {
  Class<T> getCorrespondingClass()
  ValueType getSchemaValueType()     // <.>
  ValueDecomposition decompose(T value)     // <.>
  T compose(ValueDecomposition decomposition)     // <.>
  OrderRelation<T, ?> getOrderRelation()     // <.>
  Converter<T, ?> getConverter()     // <.>
  Renderer<T> getRenderer()     // <.>
  Parser<T> getParser()     // <.>
  DefaultsProvider<T> getDefaultsProvider()     // <.>
  IdStringifier<T> getIdStringifier()     // <.>
  ValueSemanticsProvider<X> castTo(Class<X> cls)
  boolean isEnumType()
  boolean isNumberType()
  boolean isTemporalType()
  boolean isCompositeType()
}
----

<.> xref:#getSchemaValueType_[getSchemaValueType()]
+
--
Values might appear within _CommandDto_ , _InteractionDto_ and _ChangesDto_ , where a mapping onto one of _ValueType_ (s) as provided by the XML schema is required.
--
<.> xref:#decompose_T[decompose(T)]
+
--
Converts a value object into either a _ValueWithTypeDto_ or _TypedTupleDto_ .
--
<.> xref:#compose_ValueDecomposition[compose(ValueDecomposition)]
+
--
Converts either a _ValueWithTypeDto_ or a _TypedTupleDto_ to an instance of the object.
--
<.> xref:#getOrderRelation_[getOrderRelation()]
+
--
The xref:refguide:applib:index/value/semantics/OrderRelation.adoc[OrderRelation] , if any.
--
<.> xref:#getConverter_[getConverter()]
+
--
The xref:refguide:applib:index/value/semantics/Converter.adoc[Converter] , if any.
--
<.> xref:#getRenderer_[getRenderer()]
+
--
The xref:refguide:applib:index/value/semantics/Renderer.adoc[Renderer] , if any.
--
<.> xref:#getParser_[getParser()]
+
--
The xref:refguide:applib:index/value/semantics/Parser.adoc[Parser] , if any.
--
<.> xref:#getDefaultsProvider_[getDefaultsProvider()]
+
--
The xref:refguide:applib:index/value/semantics/DefaultsProvider.adoc[DefaultsProvider] , if any.
--
<.> xref:#getIdStringifier_[getIdStringifier()]
+
--
The xref:refguide:applib:index/services/bookmark/IdStringifier.adoc[IdStringifier] , if any.
--

== Members

[#getSchemaValueType_]
=== getSchemaValueType()

Values might appear within _CommandDto_ , _InteractionDto_ and _ChangesDto_ , where a mapping onto one of _ValueType_ (s) as provided by the XML schema is required.

[#decompose_T]
=== decompose(T)

Converts a value object into either a _ValueWithTypeDto_ or _TypedTupleDto_ .

[#compose_ValueDecomposition]
=== compose(ValueDecomposition)

Converts either a _ValueWithTypeDto_ or a _TypedTupleDto_ to an instance of the object.

[#getOrderRelation_]
=== getOrderRelation()

The xref:refguide:applib:index/value/semantics/OrderRelation.adoc[OrderRelation] , if any.

[#getConverter_]
=== getConverter()

The xref:refguide:applib:index/value/semantics/Converter.adoc[Converter] , if any.

[#getRenderer_]
=== getRenderer()

The xref:refguide:applib:index/value/semantics/Renderer.adoc[Renderer] , if any.

[#getParser_]
=== getParser()

The xref:refguide:applib:index/value/semantics/Parser.adoc[Parser] , if any.

[#getDefaultsProvider_]
=== getDefaultsProvider()

The xref:refguide:applib:index/value/semantics/DefaultsProvider.adoc[DefaultsProvider] , if any.

If not `null` , implies that the value has (or may have) a default.

[#getIdStringifier_]
=== getIdStringifier()

The xref:refguide:applib:index/services/bookmark/IdStringifier.adoc[IdStringifier] , if any.
