Class AbstractBuilder<T>

    • Field Detail

      • serialVersionUID

        🡇     🗕  🗗  🗖
        protected static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         protected static final long serialVersionUID = 1L;
        
      • descriptor

        🡅  🡇     🗕  🗗  🗖
        public final AbstractDescriptor descriptor
        The descriptor used by this builder. It provides the names, expected types, and ordering for each named assignment accepted by this builder.

        👉 For TypeBuilder, these names correspond to fields in a CDP data type. For CommandBuilder, they correspond to input parameters for a CDP command.
        Code:
        Exact Field Declaration Expression:
         public final AbstractDescriptor descriptor;
        
    • Method Detail

      • build

        🡅  🡇     🗕  🗗  🗖
        public abstract T build()
        Convert 'this' Builder-Instance into an actual Object-Instance
        Returns:
        An instance of T
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         BaseType<?> bt)
        Assign a CDP Class (extends BaseType<>) to a Builder Input
        Assigns: The value passed by parameter 'bt', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'BaseType'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, bt, CDPTypes.CDP_TYPE);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         BaseType<?>[] btArr)
        Assign an Array of BaseType (any CDP Class) to a Builder Input
        Assigns: The value passed by parameter 'btArr', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'BaseType[]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, btArr, CDPTypes.CDP_TYPE_ARRAY_1D);
        
      • acceptInt

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<TacceptInt​(java.lang.String name,
                                            int i)
        Assign an 'int' Primitive to a Named Builder-Input
        Assigns: The value passed by parameter 'i', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'int'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, i, CDPTypes.PRIMITIVE_INT);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         java.lang.Integer i)
        Assign a java.lang.Integer to a Named Builder-Input
        Assigns: The value passed by parameter 'i', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'Integer'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, i, CDPTypes.BOXED_INTEGER);
        
      • acceptBool

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<TacceptBool​(java.lang.String name,
                                             boolean b)
        Assign a 'boolean' primitive to a Named Builder-Input
        Assigns: The value passed by parameter 'b', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'boolean'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, b, CDPTypes.PRIMITIVE_BOOLEAN);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         java.lang.Boolean b)
        Assign a java.lang.Boolean to a Named Builder-Input
        Assigns: The value passed by parameter 'b', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'Boolean'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, b, CDPTypes.BOXED_BOOLEAN);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         java.lang.String s)
        Assign a String to a Named Builder-Input
        Assigns: The value passed by parameter 's', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'String'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, s, CDPTypes.STRING);
        
      • acceptNumber

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<TacceptNumber​(java.lang.String name,
                                               java.lang.Number n)
        Assign a java.lang.Number to a Named Builder-Input
        Assigns: The value passed by parameter 'n', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'Number'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, n, CDPTypes.NUMBER);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         int[] arr1D)
        Assign an int[]-Array to a Named Builder-Input
        Assigns: The value passed by parameter 'arr1D', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'int[]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, arr1D, CDPTypes.INT_ARRAY_1D);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         boolean[] arr1D)
        Assign a boolean[]-Array to a Named Builder-Input
        Assigns: The value passed by parameter 'arr1D', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'boolean[]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, arr1D, CDPTypes.BOOLEAN_ARRAY_1D);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         java.lang.String[] arr1D)
        Assign a String[]-Array to a Named Builder-Input
        Assigns: The value passed by parameter 'arr1D', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'String[]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, arr1D, CDPTypes.STRING_ARRAY_1D);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         java.lang.Number[] arr1D)
        Assign a Number[]-Array to a Named Builder-Input
        Assigns: The value passed by parameter 'arr1D', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'Number[]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, arr1D, CDPTypes.NUMBER_ARRAY_1D);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         int[][] arr2D)
        Assign a Two Dimensional int[][]-Array to a Named Builder-Input
        Assigns: The value passed by parameter 'arr2D', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'int[][]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, arr2D, CDPTypes.INT_ARRAY_2D);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         boolean[][] arr2D)
        Assign a Two Dimensional boolean[][]-Array to a Named Builder-Input
        Assigns: The value passed by parameter 'arr2D', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'boolean[][]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, arr2D, CDPTypes.BOOLEAN_ARRAY_2D);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         java.lang.String[][] arr2D)
        Assign a Two Dimensional String[][]-Array to a Named Builder-Input
        Assigns: The value passed by parameter 'arr2D', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'String[][]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, arr2D, CDPTypes.STRING_ARRAY_2D);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         java.lang.Number[][] arr2D)
        Assign a Two Dimensional java.lang.Number[][]-Array to a Named Builder-Input
        Assigns: The value passed by parameter 'arr2D', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'Number[][]'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, arr2D, CDPTypes.NUMBER_ARRAY_2D);
        
      • accept

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Taccept​(java.lang.String name,
                                         JsonObject jo)
        Assign a Raw JsonObject to a Named Builder-Input
        Assigns: The value passed by parameter 'jo', to the Named Builder-Input specified by parameter 'name'.
        Throws: A TypeAssignmentException if the specified Named Builder-Input isn't of type 'JsonObject'
          An AssignmentNameException if 'name' is not the name of any input expected by this builder.
        Returns: The current instance, 'this', for convenience (invocation chaining)
        Code:
        Exact Method Body:
         return accept(name, jo, CDPTypes.RAW_JSON_VALUE);
        
      • acceptNull

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<TacceptNull​(java.lang.String name)
        Explicitly assigns null to a Named Builder-Input.

        🤷 If there is ever a need to ensure that an object property found in a JsonObject that is being transmitted over a web socket (and towards a browser) has an actual Json-Null intentionally assigned to it, then invoking this method should be utilized. 🧠 This method guarantees that the internal isPresent boolean list is assigned TRUE, despite the fact that its value is still null.
        Parameters:
        name - The name of the Builder-Input to which null shall be assigned.
        Returns:
        'this' instance for invocation chaining
        Throws:
        AssignmentNameException - if 'name' is not listed by this builder's descriptor.
        See Also:
        AbstractDescriptor.names
        Code:
        Exact Method Body:
         final int index = this.descriptor.names.indexOf(name);
        
         if (index < 0) throw new AssignmentNameException(name, this.descriptor);
        
         assignments[index]  = null;
         assigned[index]     = true;
        
         return this;
        
      • clear

        🡅  🡇     🗕  🗗  🗖
        public AbstractBuilder<Tclear​(java.lang.String name)
        Clears any value which may or may not have been assigned to a Named Builder-Input.
        Parameters:
        name - The name of the Builder-Input that the programmer would like cleared.
        Returns:
        'this' instance for invocation chaining
        Throws:
        AssignmentNameException - if 'name' is not listed by this builder's descriptor.
        See Also:
        AbstractDescriptor.names
        Code:
        Exact Method Body:
         final int index = this.descriptor.names.indexOf(name);
        
         if (index < 0) throw new AssignmentNameException(name, this.descriptor);
        
         assignments[index]  = null;
         assigned[index]     = false;
        
         return this;
        
      • toString

        🡅  🡇     🗕  🗗  🗖
        public final java.lang.String toString()
        Generate an insightful String representation of 'this' instance
        👉 This method is declared final, meaning that it may not be modified by the concrete subclasses of this abstract parent.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A Java String
        Code:
        Exact Method Body:
         return CDPToString.toString(this);
        
      • equals

        🡅  🡇     🗕  🗗  🗖
        public final boolean equals​(java.lang.Object o)
        Check whether 'this' instance is equal to input parameter 'o'
        👉 This method is declared final, meaning that it may not be modified by the concrete subclasses of this abstract parent.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - Any Java Object. Only another builder instance of the exact same runtime class, with the same descriptor and current assignment values, will return TRUE.
        Returns:
        TRUE if and only if 'this' is equal to 'o'.
        Code:
        Exact Method Body:
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
        
         final AbstractBuilder<?> that = (AbstractBuilder<?>) o;
        
         return
                 this.descriptor.equals(that.descriptor)
             &&  java.util.Arrays.equals(this.assignments, that.assignments)
             &&  java.util.Arrays.equals(this.assigned, that.assigned);
        
      • hashCode

        🡅  🡇     🗕  🗗  🗖
        public final int hashCode()
        Generate a hashcode integer which may be used for placing this object into a hashtable data structure.
        👉 This method is declared final, meaning that it may not be modified by the concrete subclasses of this abstract parent.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A (hopefully unique) integer value
        Code:
        Exact Method Body:
         int result = this.descriptor.hashCode();
         result = 31 * result + java.util.Arrays.hashCode(this.assignments);
         return result;
        
      • clone

        🡅     🗕  🗗  🗖
        public abstract AbstractBuilder<Tclone()
        Clone the current instance
        Overrides:
        clone in class java.lang.Object
        Returns:
        An identical copy of 'this'.

        🔍 The concept known as a "Deep Clone" means that the internals of a type are also copied to the new instance. What is returned by this method is a "Partial Deep Clone" of 'this' instance.

        🧠 Since the internal 'descriptor' instance is a read only, singleton instance, cloning it wouldn't have any real significance. Thus, the internal 'descriptor' isn't cloned into the new instance; its reference is merely copied instead.

        🎯 However, the two internal value-assignment arrays are cloned, resulting in a separate instance which has its own, independent assignments.