java.lang.Object
io.github.sugarcubes.cloner.spi.FieldsModel<T>
- Type Parameters:
T- type
Low-level model of a type whose instances are created without constructor and whose state is its fields. Knows how
to allocate an instance and to read and write the fields declared by the type itself; what and how to copy is
decided by the caller.
-
Constructor Summary
ConstructorsConstructorDescriptionFieldsModel(Class<T> type, Reflection reflection, InstanceAllocatorFactory allocators, FieldAdapterFactory adapters) Creates the model of the type. -
Method Summary
-
Constructor Details
-
FieldsModel
public FieldsModel(Class<T> type, Reflection reflection, InstanceAllocatorFactory allocators, FieldAdapterFactory adapters) Creates the model of the type.- Parameters:
type- typereflection- reflection to list fieldsallocators- instance allocator factoryadapters- field adapter factory
-
-
Method Details
-
getType
Returns the type.- Returns:
- type
-
getAllocator
Returns allocator of instances.- Returns:
- allocator or empty if no allocator supports the type (e.g. an abstract class)
-
getFields
Returns instance fields declared by the type itself, without fields of super types.- Returns:
- fields
-
adapter
Creates an adapter which reads and writes the field.- Parameters:
field- one ofgetFields()- Returns:
- field adapter, or empty if the field cannot be accessed
-