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 builtisConstructorArgument- indicates if the field can be set through the constructorsetterMethodName- 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 Summary
ConstructorsConstructorDescriptionBuildableField(String fieldName, boolean isConstructorArgument, boolean isMandatory, Optional<String> setterMethodName, TypeMirror type) Creates an instance of aBuildableFieldrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of thefieldNamerecord component.static BuildableFieldfromConstructor(String fieldName, TypeMirror type) static BuildableFieldfromSetter(String fieldName, boolean fieldIsMandatory, String setterMethodName, TypeMirror type) final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisConstructorArgumentrecord component.booleanReturns the value of theisMandatoryrecord component.Returns the value of thesetterMethodNamerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
BuildableField
public BuildableField(String fieldName, boolean isConstructorArgument, boolean isMandatory, Optional<String> setterMethodName, TypeMirror type) Creates an instance of aBuildableFieldrecord class.- Parameters:
fieldName- the value for thefieldNamerecord componentisConstructorArgument- the value for theisConstructorArgumentrecord componentisMandatory- the value for theisMandatoryrecord componentsetterMethodName- the value for thesetterMethodNamerecord componenttype- the value for thetyperecord component
-
-
Method Details
-
fromConstructor
-
fromSetter
public static BuildableField fromSetter(String fieldName, boolean fieldIsMandatory, String setterMethodName, TypeMirror type) -
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
fieldName
Returns the value of thefieldNamerecord component.- Returns:
- the value of the
fieldNamerecord component
-
isConstructorArgument
public boolean isConstructorArgument()Returns the value of theisConstructorArgumentrecord component.- Returns:
- the value of the
isConstructorArgumentrecord component
-
isMandatory
public boolean isMandatory()Returns the value of theisMandatoryrecord component.- Returns:
- the value of the
isMandatoryrecord component
-
setterMethodName
Returns the value of thesetterMethodNamerecord component.- Returns:
- the value of the
setterMethodNamerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-