java.lang.Object
org.litebridge.tracking.FieldAccessorChain
- All Implemented Interfaces:
FieldAccessor
Represents a chain of
FieldAccessor instances, allowing the traversal and manipulation of nested fields
of a data transfer object (DTO).
This class provides mechanisms to navigate nested structures while enabling read/write access to the chained fields.
-
Constructor Summary
ConstructorsConstructorDescriptionFieldAccessorChain(FieldAccessor parent, String fieldPath, ClassFieldAccessorCache classFieldAccessorCache) Constructs a newFieldAccessorChain. -
Method Summary
Modifier and TypeMethodDescriptionadd(FieldAccessor fieldAccessor) Adds a field accessor to the chain.Class<?> dtoClass()Retrieves the parentClassof the DTO containing the field targeted by thisFieldAccessor.booleanReturns the field accessors.Returns the field path.Class<?>[]Returns an array ofClassobjects representing the generic types associated with the field or property represented by thisFieldAccessor.@Nullable ObjectRetrieve the value of a field or property from the provided data transfer object (DTO).inthashCode()booleanisLast(FieldAccessor fieldAccessor) Returnstrueif the given field accessor is the last one in the chain.name()Returns the field path.voidSet the value of a field or property for the provided data transfer object (DTO).subChain()Returns a sub-chain of this field accessor chain.toString()Class<?> type()Returns the declared type for the field represented by thisFieldAccessor.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.litebridge.tracking.FieldAccessor
genericType
-
Constructor Details
-
FieldAccessorChain
public FieldAccessorChain(FieldAccessor parent, String fieldPath, ClassFieldAccessorCache classFieldAccessorCache) Constructs a newFieldAccessorChain.- Parameters:
parent- the parent field accessor.fieldPath- the field path.classFieldAccessorCache- the field accessor cache.
-
-
Method Details
-
fieldPath
Returns the field path.- Returns:
- the field path.
-
fieldAccessors
Returns the field accessors.- Returns:
- the field accessors.
-
subChain
Returns a sub-chain of this field accessor chain.- Returns:
- a sub-chain of this field accessor chain.
-
add
Adds a field accessor to the chain.- Parameters:
fieldAccessor- the field accessor to add.- Returns:
- this field accessor chain.
-
isLast
Returnstrueif the given field accessor is the last one in the chain.- Parameters:
fieldAccessor- the field accessor to check.- Returns:
trueif the given field accessor is the last one in the chain.
-
name
Returns the field path.Alias for
fieldPath().- Specified by:
namein interfaceFieldAccessor- Returns:
- the field path.
-
get
Description copied from interface:FieldAccessorRetrieve the value of a field or property from the provided data transfer object (DTO).- Specified by:
getin interfaceFieldAccessor- Parameters:
dto- the data transfer object from which to retrieve the field or property value. Must not be null and should conform to the structure expected by thisFieldAccessor.- Returns:
- the value of the field or property, or
nullif the field value is null or could not be accessed.
-
set
Description copied from interface:FieldAccessorSet the value of a field or property for the provided data transfer object (DTO).- Specified by:
setin interfaceFieldAccessor- Parameters:
dto- the data transfer object for which the field or property value will be set. Must not be null and should conform to the structure expected by thisFieldAccessor.value- the value to set for the field or property. May be null if the field or property allows null values.
-
type
Description copied from interface:FieldAccessorReturns the declared type for the field represented by thisFieldAccessor.- Specified by:
typein interfaceFieldAccessor- Returns:
- the field type
-
genericTypes
Description copied from interface:FieldAccessorReturns an array ofClassobjects representing the generic types associated with the field or property represented by thisFieldAccessor.- Specified by:
genericTypesin interfaceFieldAccessor- Returns:
- an array of
Classobjects that represent the generic types of the field or property, or an empty array if the field or property does not use generics.
-
dtoClass
Description copied from interface:FieldAccessorRetrieves the parentClassof the DTO containing the field targeted by thisFieldAccessor.- Specified by:
dtoClassin interfaceFieldAccessor- Returns:
- The parent DTO type
-
equals
-
hashCode
public int hashCode() -
toString
-