Package org.castor.cpa.jpa.natures
Class JPAFieldNature
java.lang.Object
org.castor.core.nature.BaseNature
org.castor.cpa.jpa.natures.JPAFieldNature
- All Implemented Interfaces:
Nature
A
BaseNature
extension, that gives access to information derived from
field bound JPA annotations.- Since:
- 1.3
- Author:
- Peter Schmidt, Martin Kandler
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJPAFieldNature
(PropertyHolder holder) Instantiate aJPAFieldNature
to access the givenPropertyHolder
. -
Method Summary
Modifier and TypeMethodDescriptionfinal javax.persistence.FetchType
javax.persistence.CascadeType[]
final String
Returns the 'columnDefinition' value of the @Column annotation.final Boolean
final Integer
final String
Returns the name of the @Column annotation.final Boolean
final Integer
final Integer
final String
final Boolean
final Boolean
Get the underlyingFieldInfo
(thePropertyHolder
).Get theGeneratedValue.generator()
javax.persistence.GenerationType
Get theGeneratedValue.strategy()
final String
getId()
Returns the fully qualified name of the Nature.final String
final Boolean
final String
final Boolean
final String
final String
final Boolean
final Boolean
javax.persistence.JoinColumn[]
javax.persistence.JoinColumn[]
Class<?>
Class<?>
javax.persistence.TemporalType
final boolean
final boolean
isId()
boolean
isLob()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
final boolean
final void
setBasicFetch
(javax.persistence.FetchType fetch) final void
setBasicOptional
(boolean optional) void
setCascadeTypes
(javax.persistence.CascadeType[] cascadeTypes) final void
setColumnDefinition
(String columnDefinition) Sets the 'columnDefinition' value of the @Column annotation.final void
setColumnInsertable
(boolean insertable) final void
setColumnLength
(int length) final void
setColumnName
(String name) Set the name value of the @Column annotation.final void
setColumnNullable
(boolean nullable) final void
setColumnPrecision
(int precision) final void
setColumnScale
(int scale) final void
setColumnTable
(String table) final void
setColumnUnique
(boolean unique) final void
setColumnUpdatable
(boolean updatable) void
setGeneratedValueGenerator
(String generator) Set theGeneratedValue.generator()
void
setGeneratedValueStrategy
(javax.persistence.GenerationType strategy) Set theGeneratedValue.strategy()
final void
setId
(boolean isId) final void
setJoinColumnColumnDefinition
(String columnDefinition) final void
setJoinColumnInsertable
(boolean insertable) final void
setJoinColumnName
(String name) final void
setJoinColumnNullable
(boolean nullable) final void
setJoinColumnReferencedColumnName
(String referencedColumnName) final void
setJoinColumnTable
(String table) final void
setJoinColumnUnique
(boolean unique) final void
setJoinColumnUpdatable
(boolean updatable) void
setJoinTableCatalog
(String catalog) void
setJoinTableInverseJoinColumns
(javax.persistence.JoinColumn[] inverseJoinColumns) void
setJoinTableJoinColumns
(javax.persistence.JoinColumn[] joinColumns) void
setJoinTableName
(String tablename) void
setJoinTableSchema
(String schema) void
setLob
(boolean isLob) void
setManyToMany
(boolean hasManyToMany) void
setManyToManyInverseCopy
(boolean copySettingsInverse) void
setManyToOne
(boolean hasManyToOne) void
setOneToMany
(boolean hasOneToMany) void
setOneToOne
(boolean hasOneToOne) void
setRelationCollectionType
(Class<?> collectionType) void
setRelationLazyFetch
(boolean lazyFetch) void
setRelationMappedBy
(String mappedBy) void
setRelationOptional
(boolean optional) void
setRelationTargetEntity
(Class<?> targetEntity) void
setStringEnumType
(boolean isStringEnumType) void
setTemporalType
(javax.persistence.TemporalType temporalType) final void
setTransient
(boolean isTransient) Methods inherited from class org.castor.core.nature.BaseNature
getBooleanPropertyDefaultFalse, getHolder, getProperty, getPropertyAsList, getPropertyAsMap, setProperty
-
Field Details
-
TEMPORAL_TYPE
Property Key forTemporal
- See Also:
-
LOB
Property Key forLob
- See Also:
-
STRING_ENUM_TYPE
Property Key forEnumerated
- See Also:
-
CASCADE_TYPES
Property Key forCascadeType
array of a relation.- See Also:
-
-
Constructor Details
-
JPAFieldNature
Instantiate aJPAFieldNature
to access the givenPropertyHolder
.- Parameters:
holder
- The underlyingPropertyHolder
(obviously aFieldInfo
).- See Also:
-
-
Method Details
-
getId
Returns the fully qualified name of the Nature.- Returns:
- qualified name of the nature.
- See Also:
-
getFieldInfo
Get the underlyingFieldInfo
(thePropertyHolder
).- Returns:
- the underlying
FieldInfo
. If thePropertyHolder
was not of typeFieldInfo
, null is returned.
-
setBasicFetch
public final void setBasicFetch(javax.persistence.FetchType fetch) - Parameters:
fetch
- The value ofBasic.fetch()
- See Also:
-
BASIC_FETCH
-
getBasicFetch
public final javax.persistence.FetchType getBasicFetch()- Returns:
- The value of
Basic.fetch()
- See Also:
-
BASIC_FETCH
-
setBasicOptional
public final void setBasicOptional(boolean optional) - Parameters:
optional
- The value ofBasic.optional()
- See Also:
-
BASIC_OPTIONAL
-
isBasicOptional
public final boolean isBasicOptional()- Returns:
- True if
Basic.optional()
was set to true on the field. - See Also:
-
BASIC_OPTIONAL
-
setColumnName
Set the name value of the @Column annotation.- Parameters:
name
- The value ofColumn.name()
- See Also:
-
COLUMN_NAME
-
getColumnName
Returns the name of the @Column annotation.- Returns:
- The value of
Column.name()
- See Also:
-
COLUMN_NAME
-
setColumnDefinition
Sets the 'columnDefinition' value of the @Column annotation.- Parameters:
columnDefinition
- The value ofColumn.columnDefinition()
- See Also:
-
COLUMN_DEFINITION
-
getColumnDefinition
Returns the 'columnDefinition' value of the @Column annotation.- Returns:
- The value of
Column.columnDefinition()
- See Also:
-
COLUMN_DEFINITION
-
setColumnLength
public final void setColumnLength(int length) - Parameters:
length
- The value ofColumn.length()
- See Also:
-
COLUMN_LENGTH
-
getColumnLength
- Returns:
- The value of
Column.length()
- See Also:
-
COLUMN_LENGTH
-
setColumnInsertable
public final void setColumnInsertable(boolean insertable) - Parameters:
insertable
- The value ofColumn.insertable()
- See Also:
-
COLUMN_INSERTABLE
-
getColumnInsertable
- Returns:
- The value of
Column.insertable()
- See Also:
-
COLUMN_INSERTABLE
-
setColumnNullable
public final void setColumnNullable(boolean nullable) - Parameters:
nullable
- The value ofColumn.nullable()
- See Also:
-
COLUMN_NULLABLE
-
getColumnNullable
- Returns:
- The value of
Column.nullable()
- See Also:
-
COLUMN_NULLABLE
-
setColumnPrecision
public final void setColumnPrecision(int precision) - Parameters:
precision
- The value ofColumn.precision()
- See Also:
-
COLUMN_PRECISION
-
getColumnPrecision
- Returns:
- The value of
Column.precision()
- See Also:
-
COLUMN_PRECISION
-
setColumnScale
public final void setColumnScale(int scale) - Parameters:
scale
- The value ofColumn.scale()
- See Also:
-
COLUMN_SCALE
-
getColumnScale
- Returns:
- The value of
Column.scale()
- See Also:
-
COLUMN_SCALE
-
setColumnTable
- Parameters:
table
- The value ofColumn.table()
- See Also:
-
COLUMN_TABLE
-
getColumnTable
- Returns:
- The value of
Column.table()
- See Also:
-
COLUMN_TABLE
-
setColumnUnique
public final void setColumnUnique(boolean unique) - Parameters:
unique
- The value ofColumn.unique()
- See Also:
-
COLUMN_UNIQUE
-
getColumnUnique
- Returns:
- The value of
Column.unique()
- See Also:
-
COLUMN_UNIQUE
-
setColumnUpdatable
public final void setColumnUpdatable(boolean updatable) - Parameters:
updatable
- The value ofColumn.updatable()
- See Also:
-
COLUMN_UPDATABLE
-
getColumnUpdatable
- Returns:
- The value of
Column.updatable()
- See Also:
-
COLUMN_UPDATABLE
-
setId
public final void setId(boolean isId) - Parameters:
isId
- IfId
was found on that property.- See Also:
-
ID
-
isId
public final boolean isId()- Returns:
- true if
Id
was set on the property, else false. - See Also:
-
ID
-
setTransient
public final void setTransient(boolean isTransient) - Parameters:
isTransient
- ifTransient
was found on that property.- See Also:
-
TRANSIENT
-
isTransient
public final boolean isTransient()- Returns:
- true if
Transient
was set on the property, else false - See Also:
-
TRANSIENT
-
setJoinTableName
- Parameters:
tablename
- The value ofJoinTable.name()
- See Also:
-
JOINTABLE_NAME
-
getJoinTableName
- Returns:
- The value of
JoinTable.name()
- See Also:
-
JOINTABLE_NAME
-
setJoinTableCatalog
- Parameters:
catalog
- The value ofJoinTable.catalog()
- See Also:
-
JOINTABLE_CATALOG
-
getJoinTableCatalog
- Returns:
- The value of
JoinTable.catalog()
- See Also:
-
JOINTABLE_CATALOG
-
setJoinTableSchema
- Parameters:
schema
- The value ofJoinTable.schema()
- See Also:
-
JOINTABLE_SCHEMA
-
getJoinTableSchema
- Returns:
- The value of
JoinTable.schema()
- See Also:
-
#TABLE_SCHEMA
-
setJoinTableJoinColumns
public void setJoinTableJoinColumns(javax.persistence.JoinColumn[] joinColumns) - Parameters:
joinColumns
- The value ofJoinTable.joinColumns()
- See Also:
-
JOINTABLE_JOINCOLUMNS
-
getJoinTableJoinColumns
public javax.persistence.JoinColumn[] getJoinTableJoinColumns()- Returns:
- The value of
JoinTable.joinColumns()
- See Also:
-
JOINTABLE_JOINCOLUMNS
-
setJoinTableInverseJoinColumns
public void setJoinTableInverseJoinColumns(javax.persistence.JoinColumn[] inverseJoinColumns) - Parameters:
inverseJoinColumns
- The value ofJoinTable.inverseJoinColumns()
- See Also:
-
JOINTABLE_INVERSE_JOINCOLUMNS
-
getJoinTableInverseJoinColumns
public javax.persistence.JoinColumn[] getJoinTableInverseJoinColumns()- Returns:
- The value of
JoinTable.inverseJoinColumns()
- See Also:
-
JOINTABLE_INVERSE_JOINCOLUMNS
-
setJoinColumnName
- Parameters:
name
- The value ofJoinColumn.name()
.- See Also:
-
JOINCOLUMN_NAME
-
getJoinColumnName
- Returns:
- The value of
JoinColumn.name()
. - See Also:
-
JOINCOLUMN_NAME
-
setJoinColumnReferencedColumnName
- Parameters:
referencedColumnName
- The value ofJoinColumn.referencedColumnName()
.- See Also:
-
JOINCOLUMN_REFERENCEDCOLUMNNAME
-
getJoinColumnReferencedColumnName
- Returns:
- The value of
JoinColumn.referencedColumnName()
. - See Also:
-
JOINCOLUMN_REFERENCEDCOLUMNNAME
-
setJoinColumnUnique
public final void setJoinColumnUnique(boolean unique) - Parameters:
unique
- The value ofJoinColumn.unique()
.- See Also:
-
JOINCOLUMN_UNIQUE
-
getJoinColumnUnique
- Returns:
- The value of
JoinColumn.unique()
. - See Also:
-
JOINCOLUMN_UNIQUE
-
setJoinColumnNullable
public final void setJoinColumnNullable(boolean nullable) - Parameters:
nullable
- The value ofJoinColumn.nullable()
.- See Also:
-
JOINCOLUMN_NULLABLE
-
getJoinColumnNullable
- Returns:
- The value of
JoinColumn.nullable()
. - See Also:
-
JOINCOLUMN_NULLABLE
-
setJoinColumnInsertable
public final void setJoinColumnInsertable(boolean insertable) - Parameters:
insertable
- The value ofJoinColumn.insertable()
.- See Also:
-
JOINCOLUMN_INSERTABLE
-
getJoinColumnInsertable
- Returns:
- The value of
JoinColumn.insertable()
. - See Also:
-
JOINCOLUMN_INSERTABLE
-
setJoinColumnUpdatable
public final void setJoinColumnUpdatable(boolean updatable) - Parameters:
updatable
- The value ofJoinColumn.updatable()
.- See Also:
-
JOINCOLUMN_UPDATABLE
-
getJoinColumnUpdatable
- Returns:
- The value of
JoinColumn.updatable()
. - See Also:
-
JOINCOLUMN_UPDATABLE
-
setJoinColumnColumnDefinition
- Parameters:
columnDefinition
- The value ofJoinColumn.columnDefinition()
.- See Also:
-
JOINCOLUMN_COLUMNDEFINITION
-
getJoinColumnColumnDefinition
- Returns:
- The value of
JoinColumn.columnDefinition()
. - See Also:
-
JOINCOLUMN_COLUMNDEFINITION
-
setJoinColumnTable
- Parameters:
table
- The value ofJoinColumn.table()
.- See Also:
-
JOINCOLUMN_TABLE
-
getJoinColumnTable
- Returns:
- The value of
JoinColumn.table()
. - See Also:
-
JOINCOLUMN_TABLE
-
setOneToOne
public void setOneToOne(boolean hasOneToOne) - Parameters:
hasOneToOne
- ifOneToOne
was found on that property.- See Also:
-
ONETOONE
-
isOneToOne
public boolean isOneToOne()- Returns:
- if
OneToOne
was set on the property, else false. - See Also:
-
ONETOONE
-
setManyToOne
public void setManyToOne(boolean hasManyToOne) - Parameters:
hasManyToOne
- ifManyToOne
was found on that property.- See Also:
-
MANYTOONE
-
isManyToOne
public boolean isManyToOne()- Returns:
- if
ManyToOne
was set on the property, else false. - See Also:
-
MANYTOONE
-
setOneToMany
public void setOneToMany(boolean hasOneToMany) - Parameters:
hasOneToMany
- ifOneToMany
was found on that property.- See Also:
-
ONETOMANY
-
isOneToMany
public boolean isOneToMany()- Returns:
- if
OneToMany
was set on the property, else false. - See Also:
-
ONETOMANY
-
setManyToMany
public void setManyToMany(boolean hasManyToMany) - Parameters:
hasManyToMany
- ifManyToMany
was found on that property.- See Also:
-
MANYTOMANY
-
isManyToMany
public boolean isManyToMany()- Returns:
- if
ManyToOne
was set on the property, else false. - See Also:
-
MANYTOMANY
-
setManyToManyInverseCopy
public void setManyToManyInverseCopy(boolean copySettingsInverse) - Parameters:
copySettingsInverse
- set this to true if a ManyToMany related field shall copy allJoinTable
relevant information from the other side of the relation (inverting theJoinColumn
settings).- See Also:
-
MANYTOMANY_INVERSECOPY
-
isManyToManyInverseCopy
public boolean isManyToManyInverseCopy()- Returns:
- if this is true a ManyToMany related field shall copy all
JoinTable
relevant information from the other side of the relation (inverting theJoinColumn
settings). - See Also:
-
MANYTOMANY_INVERSECOPY
-
setRelationTargetEntity
- Parameters:
targetEntity
- The value ofOneToOne.targetEntity()
,OneToMany.targetEntity()
,ManyToOne.targetEntity()
,ManyToMany.targetEntity()
, depending to the relation type.- See Also:
-
RELATION_TARGETENTITY
-
getRelationTargetEntity
- Returns:
- The value of
OneToOne.targetEntity()
,OneToMany.targetEntity()
,ManyToOne.targetEntity()
,ManyToMany.targetEntity()
, depending on the relation type. Returns null iff no relational annotation was set on the field. - See Also:
-
RELATION_TARGETENTITY
-
setRelationLazyFetch
public void setRelationLazyFetch(boolean lazyFetch) - Parameters:
lazyFetch
- true ifOneToOne.fetch()
,OneToMany.fetch()
,ManyToOne.fetch()
,ManyToMany.fetch()
is set toFetchType.LAZY
, depending on the relation type.- See Also:
-
RELATION_LAZYFETCH
-
isRelationLazyFetch
public boolean isRelationLazyFetch()- Returns:
- true if
OneToOne.fetch()
,OneToMany.fetch()
,ManyToOne.fetch()
,ManyToMany.fetch()
is set toFetchType.LAZY
, depending on the relation type. - See Also:
-
RELATION_LAZYFETCH
-
setRelationMappedBy
- Parameters:
mappedBy
- The content ofOneToMany.mappedBy()
,ManyToMany.mappedBy()
, depending on the relation type.- See Also:
-
RELATION_MAPPEDBY
-
getRelationMappedBy
- Returns:
- The content of
OneToMany.mappedBy()
,ManyToMany.mappedBy()
, depending on the relation type. If no (or an empty) String was set, null is returned! - See Also:
-
RELATION_MAPPEDBY
-
getRelationCollectionType
- Returns:
- The type of Collection being used by
OneToMany
,ManyToMany
, depending on the relation type. Returns null iff none of the above relational annotations was set on the field. - See Also:
-
RELATION_COLLECTIONTYPE
-
setRelationCollectionType
- Parameters:
collectionType
- Set the type of Collection being used byOneToMany
,ManyToMany
, depending on the relation type.- See Also:
-
RELATION_COLLECTIONTYPE
-
setRelationOptional
public void setRelationOptional(boolean optional) - Parameters:
optional
- Set the value ofOneToOne.optional()
,ManyToOne.optional()
, depending on the relation type.- See Also:
-
RELATION_OPTIONAL
-
isRelationOptional
public boolean isRelationOptional()- Returns:
- true if
OneToOne.optional()
,ManyToOne.optional()
was set to true, depending on the relation type. - See Also:
-
RELATION_OPTIONAL
-
setGeneratedValueStrategy
public void setGeneratedValueStrategy(javax.persistence.GenerationType strategy) Set theGeneratedValue.strategy()
- Parameters:
strategy
-- See Also:
-
GENERATEDVALUE_STRATEGY
-
getGeneratedValueStrategy
public javax.persistence.GenerationType getGeneratedValueStrategy()Get theGeneratedValue.strategy()
- Returns:
- strategy
- See Also:
-
GENERATEDVALUE_STRATEGY
-
setGeneratedValueGenerator
Set theGeneratedValue.generator()
- Parameters:
strategy
-- See Also:
-
GENERATEDVALUE_STRATEGY
-
getGeneratedValueGenerator
Get theGeneratedValue.generator()
- Returns:
- strategy
- See Also:
-
GENERATEDVALUE_STRATEGY
-
getTemporalType
public javax.persistence.TemporalType getTemporalType()- Returns:
- The
TemporalType
of field. - See Also:
-
setTemporalType
public void setTemporalType(javax.persistence.TemporalType temporalType) - Parameters:
temporalType
- set theTemporalType
of field.- See Also:
-
isLob
public boolean isLob()- Returns:
- true if
Lob
was set on the property, else false - See Also:
-
setLob
public void setLob(boolean isLob) - Parameters:
isLob
- ifLob
was found on that property.- See Also:
-
isStringEnumType
public boolean isStringEnumType()- Returns:
- true if
Enumerated
with valueEnumType
STRING was set on the property, else false - See Also:
-
setStringEnumType
public void setStringEnumType(boolean isStringEnumType) - Parameters:
isStringEnumType
- ifEnumerated
with valueEnumType
STRING was found on that property.- See Also:
-
getCascadeTypes
public javax.persistence.CascadeType[] getCascadeTypes()- Returns:
- The
CascadeType
array of relation. - See Also:
-
setCascadeTypes
public void setCascadeTypes(javax.persistence.CascadeType[] cascadeTypes) - Parameters:
cascadeTypes
- set theCascadeType
array of relation.- See Also:
-