Class FieldDescriptor
java.lang.Object
nl.datasteel.crudcraft.codegen.descriptor.field.FieldDescriptor
Represents a field in a model, encapsulating various field properties.
- 
Constructor SummaryConstructorsConstructorDescriptionFieldDescriptor(Identity identity, DtoOptions dtoOptions, EnumOptions enumOptions, Relationship relationship, Validation validation, SearchOptions searchOptions, Security security) Creates a FieldDescriptor instance its various properties.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturns the identity of the field, which includes its name and type.Returns the list of enum values if the field is an enum.Returns the mappedBy attribute of the relationship.getName()Returns the simple name of the field.String[]Returns roles that are allowed to read this field.Returns the relationship type of the field.String[]Returns the names of additional response DTO variants this field participates in.intReturns the maximum depth for search queries on this field.Returns the list of search operators that can be used with this field.Returns the target type of the relationship.getType()Returns theTypeMirrorof the field.List<com.squareup.javapoet.AnnotationSpec> Returns the validation rules for the field.String[]Returns the roles that are allowed to write to this field.booleanCheck if the field has security settings defined.inthashCode()Computes a hash code for the FieldDescriptor based on its properties.booleaninDto()Returns whether the field is included in the DTO.booleaninRef()Returns whether the field is included in the reference DTO.booleanReturns whether the field is included in the request DTO.booleanReturns whether the field is embedded.booleanReturns whether the field is an enum.booleanReturns whether the field is searchable.booleanReturns whether the field is a target in a CRUD operation.toString()Returns a string representation of the FieldDescriptor.
- 
Constructor Details- 
FieldDescriptorpublic FieldDescriptor(Identity identity, DtoOptions dtoOptions, EnumOptions enumOptions, Relationship relationship, Validation validation, SearchOptions searchOptions, Security security) Creates a FieldDescriptor instance its various properties.- Parameters:
- identity- the core identity of the field, including its name and type
- dtoOptions- options for DTO generation, such as whether to include the field in DTOs
- enumOptions- options for enum fields, such as whether the field is an enum and its possible values
- relationship- the relationship of the field to other entities, such as foreign keys or references
- validation- validation rules for the field, such as constraints or annotations
- searchOptions- search options for the field, defining how it can be used in search queries
- security- security options for the field, defining access control and visibility
 
 
- 
- 
Method Details- 
getNameReturns the simple name of the field.- Returns:
- the simple name of the field
 
- 
getTypeReturns theTypeMirrorof the field.- Returns:
- the TypeMirrorof the field
 
- 
inDtopublic boolean inDto()Returns whether the field is included in the DTO. This is used to determine if the field should be part of a Data Transfer Object.- Returns:
- true if the field is included in the DTO, false otherwise
 
- 
inRequestpublic boolean inRequest()Returns whether the field is included in the request DTO. This is used to determine if the field should be part of a request object.- Returns:
- true if the field is included in the request DTO, false otherwise
 
- 
inRefpublic boolean inRef()Returns whether the field is included in the reference DTO. This is used to determine if the field should be part of a reference response object.- Returns:
- true if the field is included in the reference DTO, false otherwise
 
- 
getResponseDtosReturns the names of additional response DTO variants this field participates in.- Returns:
- array of custom DTO identifiers
 
- 
isEnumStringpublic boolean isEnumString()Returns whether the field is an enum. This is determined by the presence of enum options.- Returns:
- true if the field is an enum, false otherwise
 
- 
getEnumValuesReturns the list of enum values if the field is an enum. This is used to provide options for enum fields in DTOs or forms.- Returns:
- a list of enum values as Strings, or an empty list if the field is not an enum
 
- 
getRelTypeReturns the relationship type of the field. This indicates how the field relates to other entities, such as one-to-one, one-to-many, etc.
- 
getMappedByReturns the mappedBy attribute of the relationship. This is used in bidirectional relationships to indicate which side owns the relationship.- Returns:
- the mappedBy attribute as a String
 
- 
getTargetTypeReturns the target type of the relationship. This is the type of the entity that this field relates to.- Returns:
- the target type as a String
 
- 
isTargetCrudpublic boolean isTargetCrud()Returns whether the field is a target in a CRUD operation. This indicates if the field is part of a relationship that can be created, read, updated, or deleted.- Returns:
- true if the field is a target in CRUD operations, false otherwise
 
- 
isEmbeddedpublic boolean isEmbedded()Returns whether the field is embedded. An embedded field is one that is part of the same entity and does not have a separate table.- Returns:
- true if the field is embedded, false otherwise
 
- 
getValidationsReturns the validation rules for the field. This includes constraints and annotations that apply to the field.- Returns:
- a Validation object containing the field's validation rules
 
- 
isSearchablepublic boolean isSearchable()Returns whether the field is searchable. This indicates if the field can be used in search queries.- Returns:
- true if the field is searchable, false otherwise
 
- 
getSearchOperatorsReturns the list of search operators that can be used with this field. These operators define how the field can be queried in search operations.- Returns:
- a list of SearchOperator objects
 
- 
getSearchDepthpublic int getSearchDepth()Returns the maximum depth for search queries on this field. This is used to limit the depth of nested searches.- Returns:
- the maximum search depth
 
- 
hasFieldSecuritypublic boolean hasFieldSecurity()Check if the field has security settings defined.
- 
getReadRolesReturns roles that are allowed to read this field.- Returns:
- an array of role names that can read this field
 
- 
getWriteRolesReturns the roles that are allowed to write to this field.- Returns:
- an array of role names that can write to this field
 
- 
equalsReturns the identity of the field, which includes its name and type.
- 
hashCodepublic int hashCode()Computes a hash code for the FieldDescriptor based on its properties.
- 
toStringReturns a string representation of the FieldDescriptor.
 
-