Interface ElementType<T>

Type Parameters:
T - Type of the element value
All Superinterfaces:
ModelItemType, PluginAware
All Known Subinterfaces:
ComplexRepositoryElementType<T>, RepositoryElementType<T>, XMLElementType<T>, XSLElementType<T>
All Known Implementing Classes:
AbstractBinaryElementType, AbstractBooleanElementType, AbstractContentElementType, AbstractDateElementType, AbstractDateTimeElementType, AbstractDoubleElementType, AbstractElementType, AbstractFileElementType, AbstractGeocodeElementType, AbstractLongElementType, AbstractMultilingualStringElementType, AbstractReferenceElementType, AbstractRichTextElementType, AbstractStringElementType, AbstractUserElementType, BinaryRepositoryElementType, BooleanRepositoryElementType, BooleanXMLElementType, BooleanXSLElementType, ContentContentElementType, ContentRepositoryElementType, DateRepositoryElementType, DateTimeRepositoryElementType, DateTimeXMLElementType, DateXMLElementType, DoubleRepositoryElementType, DoubleXMLElementType, DoubleXSLElementType, FileContentElementType, FileRepositoryElementType, GeocodeRepositoryElementType, HTMLRichTextContentElementType, HTMLRichTextRepositoryElementType, LongRepositoryElementType, LongXMLElementType, LongXSLElementType, MultilingualStringRepositoryElementType, PasswordRepositoryElementType, PasswordXMLElementType, ReferenceContentElementType, ReferenceRepositoryElementType, RichTextContentElementType, RichTextRepositoryElementType, StringRepositoryElementType, StringXMLElementType, StringXSLElementType, UserRepositoryElementType

public interface ElementType<T> extends ModelItemType
Interface for element types
  • Method Details

    • castValue

      Cast the given value to an object of the corresponding type.
      It may be an untyped String value, or another Object, depending of what the type is actually compatible with.
      Parameters:
      value - the value to cast
      Returns:
      An object of the parameterized type representing the given value. Returns null if value cannot be cast
      Throws:
      BadItemTypeException - if the given value can't be cast to the type
    • toString

      String toString(T value)
      Cast a typed value to a String
      Parameters:
      value - the value to cast
      Returns:
      the String representation of the value
    • fromJSONForClient

      Convert the given client side JSON object to the types value
      Parameters:
      json - the JSON object to convert
      context - the context of the data to retrieve
      Returns:
      the typed value corresponding to the JSON object
    • valueToJSONForClient

      Convert the value into a JSON object to use client side
      Parameters:
      value - the value to convert
      context - The context of the data to convert. Can not be null.
      Returns:
      The value as JSON
    • valueToJSONForEdition

      Convert the value into a JSON object to use in edition mode
      Parameters:
      value - the value to convert
      context - The context of the data to convert. Can not be null.
      Returns:
      The value as JSON
    • parseConfiguration

      Parses the given configuration to get the typed value
      Parameters:
      configuration - the configuration to parse
      Returns:
      The typed value in the configuration
      Throws:
      ConfigurationException - if an error occurs while parsing the configuration
    • valueFromXML

      Object valueFromXML(Element parent, String name, Optional<Object> additionalData)
      Parses the given DOM node to get the typed value
      Parameters:
      parent - the DOM element containing the value
      name - the name of the item to read
      additionalData - additional data needed to get the typed value
      Returns:
      the value
    • compareValues

      Compares the given values and retrieves the changes as a stream of Triples. A Triple 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)
      Parameters:
      value1 - the 1st value
      value2 - the 2nd value
      Returns:
      the changes between the two given values as a stream of Triple. Retrieves an empty stream if there is no change
    • isCompatible

      boolean isCompatible(Object value)
      Checks if the value is compatible with the element type
      Parameters:
      value - the value to check
      Returns:
      true if the value matches the current type, false otherwise
    • isSimple

      boolean isSimple()
      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
    • getManagedClass

      Get the class managed by the implementation
      Returns:
      The class managed (T.class)
    • getManagedClassArray

      Get the class representing an array of managed class by the implementation
      Returns:
      The class managed (T[].class)