Interface ElementType<T>

    • Method Detail

      • castValue

        T castValue​(Object value)
             throws BadItemTypeException
        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 String 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

        Object fromJSONForClient​(Object json)
        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
      • valueToJSONForClient

        Object valueToJSONForClient​(Object value,
                                    DataContext context)
        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
        Returns:
        The value as JSON
      • compareValues

        Stream<Triple<DataChangeType,​DataChangeTypeDetail,​String>> compareValues​(Object value1,
                                                                                             Object value2)
                                                                                      throws IOException
        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
        Throws:
        IOException - if an error occurs while comparing values using the I/O API
      • 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

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

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