org.sormula.annotation.cascade
Class CascadeAnnotationReader

java.lang.Object
  extended by org.sormula.annotation.cascade.CascadeAnnotationReader
Direct Known Subclasses:
DeleteCascadeAnnotationReader, InsertCascadeAnnotationReader, SaveCascadeAnnotationReader, SelectCascadeAnnotationReader, UpdateCascadeAnnotationReader

public abstract class CascadeAnnotationReader
extends java.lang.Object

Base class for cascade annotation readers.

Since:
1.8 and 2.2
Author:
Jeff Miller

Constructor Summary
CascadeAnnotationReader(java.lang.reflect.Field source)
          Constructs for a field.
 
Method Summary
protected  void checkDefaultTargetClass()
          Initializes target class based upon Field.getGenericType() and Field.getType() when target class is not specified (the default value of Object.class).
 java.lang.reflect.Field getSource()
          Gets the source field supplied in constructor.
 java.lang.Class<?> getTargetClass()
          Gets the class of the field that will be affected by cascade.
protected abstract  void initCascade()
          Initializes when Cascade is annotated on source field.
protected abstract  void initOneToManyCascade()
          Initializes when OneToManyCascade is annotated on source field.
protected abstract  void initOneToOneCascade()
          Initializes when OneToOneCascade is annotated on source field.
protected  void initTargetClass(java.lang.Class<?> targetClass)
          Sets the class type for target field that will be affected by cascade.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CascadeAnnotationReader

public CascadeAnnotationReader(java.lang.reflect.Field source)
Constructs for a field.

Parameters:
source - field with cascade annotation(s)
Method Detail

initOneToManyCascade

protected abstract void initOneToManyCascade()
Initializes when OneToManyCascade is annotated on source field.


initOneToOneCascade

protected abstract void initOneToOneCascade()
Initializes when OneToOneCascade is annotated on source field.


initCascade

protected abstract void initCascade()
Initializes when Cascade is annotated on source field.


initTargetClass

protected void initTargetClass(java.lang.Class<?> targetClass)
Sets the class type for target field that will be affected by cascade. For scalar fields and simple parameterized types, the target type can be determined. Otherwise the type must be specified by OneToManyCascade.targetClass() or Cascade.targetClass().

Parameters:
targetClass - class of target field

checkDefaultTargetClass

protected void checkDefaultTargetClass()
Initializes target class based upon Field.getGenericType() and Field.getType() when target class is not specified (the default value of Object.class). OneToManyCascade.targetClass() and Cascade.targetClass() have a default of Object.class.

Since:
1.9 and 2.3

getSource

public java.lang.reflect.Field getSource()
Gets the source field supplied in constructor.

Returns:
source field with cascade annotation(s)

getTargetClass

public java.lang.Class<?> getTargetClass()
Gets the class of the field that will be affected by cascade.

Returns:
OneToManyCascade.targetClass() or Cascade.targetClass()