Package org.ametys.core.model.type
Class AbstractDoubleElementType
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.model.type.AbstractModelItemType
-
- org.ametys.core.model.type.AbstractElementType<Double>
-
- org.ametys.core.model.type.AbstractDoubleElementType
-
- All Implemented Interfaces:
ElementType<Double>
,ModelItemType
,LogEnabled
,PluginAware
,Component
,Serviceable
- Direct Known Subclasses:
DoubleRepositoryElementType
,DoubleXMLElementType
public abstract class AbstractDoubleElementType extends AbstractElementType<Double>
Abstract class for double element types
-
-
Field Summary
-
Fields inherited from class org.ametys.core.model.type.AbstractElementType
_jsonUtils
-
-
Constructor Summary
Constructors Constructor Description AbstractDoubleElementType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Stream<Triple<DataChangeType,DataChangeTypeDetail,String>>
_compareSingleValues(Double value1, Double value2)
Compares the given single values and retrieves the changes as a stream ofTriple
s.Double
convertValue(Object value)
Try to convert the given value.Object
fromJSONForClient(Object json)
Convert the given client side JSON object to the types valueboolean
isCompatible(Object value)
Checks if the value is compatible with the element typeboolean
isSimple()
Determines if this type is simple or not.-
Methods inherited from class org.ametys.core.model.type.AbstractElementType
_compareMultipleValues, _getValueAttributes, _isValueFromXMLMultiple, _singleValueFromXML, _singleValueToJSON, _singleValueToSAX, _useJSONForEdition, _valueToSAX, _valueToSAX, _valueToSAXForEdition, castValue, compareValues, getManagedClass, getManagedClassArray, parseConfiguration, service, toString, valueFromXML, valueToJSONForClient, valueToSAX, valueToSAXForEdition
-
Methods inherited from class org.ametys.core.model.type.AbstractModelItemType
_getContextAttributes, getId, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.runtime.model.type.ModelItemType
getId, valueToSAX
-
Methods inherited from interface org.ametys.runtime.plugin.component.PluginAware
setPluginInfo
-
-
-
-
Constructor Detail
-
AbstractDoubleElementType
public AbstractDoubleElementType()
-
-
Method Detail
-
convertValue
public Double convertValue(Object value) throws BadItemTypeException
Description copied from class:AbstractElementType
Try to convert the given value.- Overrides:
convertValue
in classAbstractElementType<Double>
- Parameters:
value
- the value to convert- Returns:
- the converted value or null if it's not possible.
- Throws:
BadItemTypeException
-
fromJSONForClient
public Object fromJSONForClient(Object json)
Description copied from interface:ElementType
Convert the given client side JSON object to the types value- Parameters:
json
- the JSON object to convert- Returns:
- the typed value corresponding to the JSON object
-
_compareSingleValues
protected Stream<Triple<DataChangeType,DataChangeTypeDetail,String>> _compareSingleValues(Double value1, Double value2) throws IOException
Description copied from class:AbstractElementType
Compares the given single values and retrieves the changes as a stream ofTriple
s. TheTriple
contains:- the general type of the change (added, modified or removed) as a
DataChangeType
, - some details about this change if possible (after or before for a date, more or less for a number, ...) as a
DataChangeTypeDetail
- The data concerned by this change if not the element itself (or an empty String)
- Overrides:
_compareSingleValues
in classAbstractElementType<Double>
- Parameters:
value1
- the 1st single valuevalue2
- the 2nd single value- Returns:
- the changes between the two given single values as a stream of
Triple
. Retrieves an empty stream if there is no change - Throws:
IOException
- if an error occurs while comparing values using the I/O API
- the general type of the change (added, modified or removed) as a
-
isCompatible
public boolean isCompatible(Object value)
Description copied from interface:ElementType
Checks if the value is compatible with the element type- Specified by:
isCompatible
in interfaceElementType<Double>
- Overrides:
isCompatible
in classAbstractElementType<Double>
- Parameters:
value
- the value to check- Returns:
true
if the value matches the current type,false
otherwise
-
isSimple
public boolean isSimple()
Description copied from interface:ElementType
Determines if this type is simple or not. A simple element type is a type of elements that can be edited in a grid- Returns:
true
if the type is simple,false
otherwise
-
-