Class OneToOneHandler
java.lang.Object
nl.datasteel.crudcraft.codegen.writer.relationship.OneToOneHandler
- All Implemented Interfaces:
RelationshipHandler
Handles ONE_TO_ONE relationships.
-
Field Summary
Fields inherited from interface nl.datasteel.crudcraft.codegen.writer.relationship.RelationshipHandler
RELATIONSHIP_FIELD_SUFFIX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addClear
(ModelDescriptor modelDescriptor, FieldDescriptor fieldDescriptor, com.squareup.javapoet.MethodSpec.Builder clear, com.squareup.javapoet.ClassName entityType) Adds the clear logic for a one-to-one relationship field.void
addFix
(ModelDescriptor modelDescriptor, FieldDescriptor fieldDescriptor, com.squareup.javapoet.MethodSpec.Builder fix, com.squareup.javapoet.ClassName entityType) Adds the fix logic for a one-to-one relationship field.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nl.datasteel.crudcraft.codegen.writer.relationship.RelationshipHandler
getInverseRelationshipFieldName, getRelationshipFieldName
-
Constructor Details
-
OneToOneHandler
public OneToOneHandler()
-
-
Method Details
-
addFix
public void addFix(ModelDescriptor modelDescriptor, FieldDescriptor fieldDescriptor, com.squareup.javapoet.MethodSpec.Builder fix, com.squareup.javapoet.ClassName entityType) Adds the fix logic for a one-to-one relationship field. This method updates the inverse relationship field of the entity.- Specified by:
addFix
in interfaceRelationshipHandler
- Parameters:
modelDescriptor
- the model descriptorfieldDescriptor
- the field descriptorfix
- the method spec builder to add fix logic toentityType
- the class name of the entity type
-
addClear
public void addClear(ModelDescriptor modelDescriptor, FieldDescriptor fieldDescriptor, com.squareup.javapoet.MethodSpec.Builder clear, com.squareup.javapoet.ClassName entityType) Adds the clear logic for a one-to-one relationship field. This method sets the inverse relationship field of the entity to null.- Specified by:
addClear
in interfaceRelationshipHandler
- Parameters:
modelDescriptor
- the model descriptorfieldDescriptor
- the field descriptorclear
- the method spec builder to add clear logic toentityType
- the class name of the entity type
-