Package io.jonasg.bob

Record Class BuildableField

java.lang.Object
java.lang.Record
io.jonasg.bob.BuildableField
Record Components:
fieldName - the name of the field as declared in the type that will be built
isConstructorArgument - indicates if the field can be set through the constructor
setterMethodName - the name of the setter method to access the field.
type - the type of the field

public record BuildableField(String fieldName, boolean isConstructorArgument, boolean isMandatory, Optional<String> setterMethodName, TypeMirror type) extends Record
Represents a field that is buildable
  • Constructor Details

    • BuildableField

      public BuildableField(String fieldName, boolean isConstructorArgument, boolean isMandatory, Optional<String> setterMethodName, TypeMirror type)
      Creates an instance of a BuildableField record class.
      Parameters:
      fieldName - the value for the fieldName record component
      isConstructorArgument - the value for the isConstructorArgument record component
      isMandatory - the value for the isMandatory record component
      setterMethodName - the value for the setterMethodName record component
      type - the value for the type record component
  • Method Details

    • fromConstructor

      public static BuildableField fromConstructor(String fieldName, TypeMirror type)
    • fromSetter

      public static BuildableField fromSetter(String fieldName, boolean fieldIsMandatory, String setterMethodName, TypeMirror type)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fieldName

      public String fieldName()
      Returns the value of the fieldName record component.
      Returns:
      the value of the fieldName record component
    • isConstructorArgument

      public boolean isConstructorArgument()
      Returns the value of the isConstructorArgument record component.
      Returns:
      the value of the isConstructorArgument record component
    • isMandatory

      public boolean isMandatory()
      Returns the value of the isMandatory record component.
      Returns:
      the value of the isMandatory record component
    • setterMethodName

      public Optional<String> setterMethodName()
      Returns the value of the setterMethodName record component.
      Returns:
      the value of the setterMethodName record component
    • type

      public TypeMirror type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component