Class OneToManyHandler

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

public class OneToManyHandler extends Object implements RelationshipHandler
Handles ONE_TO_MANY and MANY_TO_MANY relationships.
  • Constructor Details

    • OneToManyHandler

      public OneToManyHandler()
  • 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-many or many-to-many relationship field. This method updates the inverse relationship collection 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-many or many-to-many relationship field. This method removes the entity from the inverse relationship collection.
      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