Class RepresentationHint<V>

  • Type Parameters:
    V - the value type

    public abstract class RepresentationHint<V>
    extends Object
    A flag for configuration loaders describing how a node should be serialized.

    A loader may not accept every representation hint available, but any understood hints should be exposed as constant fields on the loader class. Any unknown hints will be ignored.

    Since:
    4.0.0
    • Method Detail

      • of

        public static <V> RepresentationHint<V> of​(String identifier,
                                                   Class<V> valueType)
        Create a new basic representation hint.

        The created hint will be inheritable and have no default value set.

        Type Parameters:
        V - value type
        Parameters:
        identifier - hint identifier
        valueType - type of value the hint will hold
        Returns:
        a new hint
        Since:
        4.0.0
      • of

        public static <V> RepresentationHint<V> of​(String identifier,
                                                   TypeToken<V> valueType)
        Create a new basic representation hint.

        The created hint will be inheritable and have no default value set.

        Type Parameters:
        V - value type
        Parameters:
        identifier - hint identifier
        valueType - type of value the hint will hold
        Returns:
        a new hint
        Since:
        4.0.0
      • builder

        public static <V> RepresentationHint.Builder<V> builder()
        Create a builder for a new hint.
        Type Parameters:
        V - value type
        Returns:
        a new builder
        Since:
        4.0.0
      • identifier

        public abstract String identifier()
        An identifier used to represent this hint in error messages.
        Returns:
        the identifier
        Since:
        4.0.0
      • valueType

        public abstract TypeToken<VvalueType()
        The type that values of this type have to have.
        Returns:
        value type
        Since:
        4.0.0
      • defaultValue

        public abstract @Nullable V defaultValue()
        If a value for a representation hint cannot be found by quering a node or any of this parents, the default value will be returned.
        Returns:
        default type
        Since:
        4.0.0
      • inheritable

        public abstract boolean inheritable()
        Get whether or not this hint can draw its value from parent nodes.
        Returns:
        if inheritable
        Since:
        4.0.0