java.lang.Object
nl.datasteel.crudcraft.codegen.writer.relationship.OneToOneHandler
All Implemented Interfaces:
RelationshipHandler

public class OneToOneHandler extends Object implements RelationshipHandler
Handles ONE_TO_ONE relationships.
  • 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 interface RelationshipHandler
      Parameters:
      modelDescriptor - the model descriptor
      fieldDescriptor - the field descriptor
      fix - the method spec builder to add fix logic to
      entityType - 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 interface RelationshipHandler
      Parameters:
      modelDescriptor - the model descriptor
      fieldDescriptor - the field descriptor
      clear - the method spec builder to add clear logic to
      entityType - the class name of the entity type