Class CompositeVariant<T>

  • Type Parameters:
    T - Can be of any class supported by Variant, used for direct conversion in getValue, etc.

    @ProviderType
    public final class CompositeVariant<T>
    extends Object
    Represents a value which could be either a list of variants or a single variant. The idea is that this supports a transition from a singular to a multi-value property for easier conversion.
    • Constructor Detail

      • CompositeVariant

        public CompositeVariant​(T initial)
        Create a variant either as a preferred type (set value later with addValue) or with an initial value and the preferred type is assumed by the value provided.
        Parameters:
        initial -
    • Method Detail

      • isArray

        public boolean isArray()
      • getSingularType

        public Class<T> getSingularType()
      • isEmpty

        public boolean isEmpty()
      • addValue

        public final void addValue​(Object val)
      • getValue

        public T getValue()
      • getValueAs

        public <U> U getValueAs​(Class<U> otherType)
      • getValues

        public List<T> getValues()
      • getValuesAs

        public <U> List<U> getValuesAs​(Class<U> otherType)
      • toPropertyValue

        public Object toPropertyValue()