Class PropertyBuilder<T>

  • Type Parameters:
    T -

    public class PropertyBuilder<T>
    extends java.lang.Object
    PropertyBuilder for building in memory PropertyState instances.
    • Constructor Detail

      • PropertyBuilder

        public PropertyBuilder​(Type<T> type)
        Create a new instance for building PropertyState instances of the given type.
        Parameters:
        type - type of the PropertyState instances to be built.
        Throws:
        java.lang.IllegalArgumentException - if type.isArray() is true.
    • Method Detail

      • scalar

        public static <T> PropertyBuilder<T> scalar​(Type<T> type)
        Create a new instance for building scalar PropertyState instances of the given type.
        Parameters:
        type - type of the PropertyState instances to be built.
        Returns:
        PropertyBuilder for type
      • array

        public static <T> PropertyBuilder<T> array​(Type<T> type)
        Create a new instance for building array PropertyState instances of the given type.
        Parameters:
        type - type of the PropertyState instances to be built.
        Returns:
        PropertyBuilder for type
      • scalar

        public static <T> PropertyBuilder<T> scalar​(Type<T> type,
                                                    java.lang.String name)
        Create a new instance for building scalar PropertyState instances of the given type. The builder is initialised with the given name. Equivalent to
             MemoryPropertyBuilder.create(type).setName(name);
         
        Parameters:
        type - type of the PropertyState instances to be built.
        name - initial name
        Returns:
        PropertyBuilder for type
      • array

        public static <T> PropertyBuilder<T> array​(Type<T> type,
                                                   java.lang.String name)
        Create a new instance for building array PropertyState instances of the given type. The builder is initialised with the given name. Equivalent to
             MemoryPropertyBuilder.create(type).setName(name).setArray();
         
        Parameters:
        type - type of the PropertyState instances to be built.
        name - initial name
        Returns:
        PropertyBuilder for type
      • copy

        public static <T> PropertyBuilder<T> copy​(Type<T> type,
                                                  PropertyState property)
        Create a new instance for building PropertyState instances of the given type. The builder is initialised with the name and the values of property. Equivalent to
             PropertyBuilder.scalar(type).assignFrom(property);
         
        Parameters:
        type - type of the PropertyState instances to be built.
        property - initial name and values
        Returns:
        PropertyBuilder for type
      • getName

        public java.lang.String getName()
      • getValue

        public T getValue()
      • getValues

        @NotNull
        public @NotNull java.util.List<T> getValues()
      • getValue

        public T getValue​(int index)
      • hasValue

        public boolean hasValue​(java.lang.Object value)
      • count

        public int count()
      • isArray

        public boolean isArray()
      • isEmpty

        public boolean isEmpty()
      • getPropertyState

        @NotNull
        public @NotNull PropertyState getPropertyState()
      • setName

        @NotNull
        public @NotNull PropertyBuilder<T> setName​(java.lang.String name)
      • addValues

        @NotNull
        public @NotNull PropertyBuilder<T> addValues​(java.lang.Iterable<T> values)
      • setValue

        @NotNull
        public @NotNull PropertyBuilder<T> setValue​(T value,
                                                    int index)
      • setValues

        @NotNull
        public @NotNull PropertyBuilder<T> setValues​(java.lang.Iterable<T> values)
      • removeValue

        @NotNull
        public @NotNull PropertyBuilder<T> removeValue​(int index)
      • removeValue

        @NotNull
        public @NotNull PropertyBuilder<T> removeValue​(java.lang.Object value)