public abstract class CascadeAnnotationReader
extends java.lang.Object
Constructor and Description |
---|
CascadeAnnotationReader(java.lang.reflect.Field source)
Constructs for a field.
|
Modifier and Type | Method and Description |
---|---|
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.String |
getForeignKeyReferenceField()
Gets the field name of that contains foreign key reference in target (child) rows.
|
java.lang.String[] |
getForeignKeyValueFields()
Gets the field names of foreign key values in target (child) rows.
|
java.lang.String |
getName()
Gets the name of the cascade as defined by
OneToManyCascade.name() , or
OneToManyCascade.name() , or Cascade.name() . |
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 void |
init(Cascade cascadeAnnotation)
Initializes common values when
Cascade is annotated on source field. |
protected void |
init(OneToManyCascade cascadeAnnotation)
Initializes common values when
OneToManyCascade is annotated on source field. |
protected void |
init(OneToOneCascade cascadeAnnotation)
Initializes common values when
OneToOneCascade is annotated on source field. |
protected abstract void |
initCascade(Cascade cascacdeAnnotation)
Initializes when
Cascade is annotated on source field (or implied
as default when no annotation is used). |
protected abstract void |
initOneToManyCascade(OneToManyCascade cascacdeAnnotation)
Initializes when
OneToManyCascade is annotated on source field (or implied
as default when no annotation is used). |
protected abstract void |
initOneToOneCascade(OneToOneCascade cascacdeAnnotation)
Initializes when
OneToOneCascade is annotated on source field (or implied
as default when no annotation is used). |
protected void |
initTargetClass(java.lang.Class<?> targetClass)
Sets the class type for target field that will be affected by cascade.
|
void |
setForeignKeyReferenceField(java.lang.String foreignKeyReferenceField)
Sets the field name that contains a reference to the foreign key object in target (child) rows.
|
void |
setForeignKeyValueFields(java.lang.String[] foreignKeyValueFields)
Sets the name of fields that contain the foreign key values in target (child) rows.
|
void |
setName(java.lang.String name)
Sets the name of the cascade as defined by
OneToManyCascade.name() , or
OneToManyCascade.name() , or Cascade.name() . |
public CascadeAnnotationReader(java.lang.reflect.Field source)
source
- field with cascade annotation(s) (or default cascade)protected abstract void initOneToManyCascade(OneToManyCascade cascacdeAnnotation)
OneToManyCascade
is annotated on source field (or implied
as default when no annotation is used).cascacdeAnnotation
- annotation to use for cascadeprotected abstract void initOneToOneCascade(OneToOneCascade cascacdeAnnotation)
OneToOneCascade
is annotated on source field (or implied
as default when no annotation is used).cascacdeAnnotation
- annotation to use for cascadeprotected abstract void initCascade(Cascade cascacdeAnnotation)
Cascade
is annotated on source field (or implied
as default when no annotation is used).cascacdeAnnotation
- annotation to use for cascadeprotected void init(OneToManyCascade cascadeAnnotation)
OneToManyCascade
is annotated on source field.cascadeAnnotation
- cascade informationprotected void init(OneToOneCascade cascadeAnnotation)
OneToOneCascade
is annotated on source field.cascadeAnnotation
- cascade informationprotected void init(Cascade cascadeAnnotation)
Cascade
is annotated on source field.cascadeAnnotation
- cascade informationprotected void initTargetClass(java.lang.Class<?> targetClass)
OneToManyCascade.targetClass()
or Cascade.targetClass()
.targetClass
- class of target fieldprotected void checkDefaultTargetClass()
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.public void setName(java.lang.String name)
OneToManyCascade.name()
, or
OneToManyCascade.name()
, or Cascade.name()
. Invoked by init(Cascade)
,
init(OneToManyCascade)
, and init(OneToOneCascade)
.name
- of cascade or empty string if nonepublic java.lang.String getName()
OneToManyCascade.name()
, or
OneToManyCascade.name()
, or Cascade.name()
.public java.lang.reflect.Field getSource()
public java.lang.Class<?> getTargetClass()
OneToManyCascade.targetClass()
or Cascade.targetClass()
public void setForeignKeyValueFields(java.lang.String[] foreignKeyValueFields)
foreignKeyValueFields
- field names from cascade annotation foreignKeyValueFieldsCascade.foreignKeyValueFields()
,
OneToManyCascade.foreignKeyValueFields()
,
OneToOneCascade.foreignKeyValueFields()
public java.lang.String[] getForeignKeyValueFields()
public void setForeignKeyReferenceField(java.lang.String foreignKeyReferenceField)
foreignKeyReferenceField
- field name of foreign key reference from cascade
annotation foreignKeyReferenceFieldCascade.foreignKeyReferenceField()
,
OneToManyCascade.foreignKeyReferenceField()
,
OneToOneCascade.foreignKeyReferenceField()
public java.lang.String getForeignKeyReferenceField()