Methods Summary |
---|
protected abstract oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns.MetadataColumn | getColumn(java.lang.String loggingCtx)INTERNAL:
This is used to return the column for a BasicAccessor. In the case
of a BasicCollectionAccessor or BasicMapAccessor, this method should
return the value column.
See BasicMapAccessor for processing on the key column.
|
public oracle.toplink.essentials.internal.helper.DatabaseField | getDatabaseField(java.lang.String loggingCtx)INTERNAL:
Process column details from an @Column or column element into a
MetadataColumn and return it. This will set correct metadata and log
defaulting messages to the user. It also looks for attribute overrides.
This method will call getColumn() which assumes the subclasses will
return the appropriate MetadataColumn to process based on the context
provided.
// Check if we have an attribute override first, otherwise process for
// a column (ignoring if for a key column on a basic map)
MetadataColumn column;
if (m_descriptor.hasAttributeOverrideFor(getAttributeName())) {
column = m_descriptor.getAttributeOverrideFor(getAttributeName());
} else {
column = getColumn(loggingCtx);
}
// Get the actual database field and apply any defaults.
DatabaseField field = column.getDatabaseField();
// Set the correct field name, defaulting and logging when necessary.
String defaultName = column.getUpperCaseAttributeName();
field.setName(getName(field.getName(), defaultName, loggingCtx));
return field;
|
public java.lang.String | getEnumeratedType()INTERNAL: (Overridden in XMLBasicAccessor)
Enumerated enumerated = getAnnotation(Enumerated.class);
if (enumerated == null) {
return EnumType.ORDINAL.name();
} else {
return enumerated.value().name();
}
|
public java.lang.String | getTemporalType()INTERNAL:
Return the temporal type for this accessor. Assumes there is a @Temporal.
Temporal temporal = getAnnotation(Temporal.class);
return temporal.value().name();
|
public boolean | hasEnumerated()INTERNAL: (Overridden in XMLBasicAccessor)
Return true if this accessor has a @Enumerated.
return isAnnotationPresent(Enumerated.class);
|
public boolean | hasLob()INTERNAL: (Overridden in XMLBasicAccessor)
Return true if this accessor has a @Lob.
return isAnnotationPresent(Lob.class);
|
public boolean | hasTemporal()INTERNAL: (Overridden in XMLBasicAccessor)
Return true if this accessor has a @Temporal.
return isAnnotationPresent(Temporal.class);
|
public boolean | isEnumerated()INTERNAL:
Return true if this represents an enum type mapping. Will return true
if the accessor's reference class is an enum or if a @Enumerated exists.
return hasEnumerated() || MetadataHelper.isValidEnumeratedType(getReferenceClass());
|
public boolean | isLob()INTERNAL:
Return true if this accessor represents a BLOB/CLOB mapping.
return hasLob();
|
public boolean | isSerialized()INTERNAL:
Return true if this accessor represents a serialized mapping.
return MetadataHelper.isValidSerializedType(getReferenceClass());
|
public boolean | isTemporal()INTERNAL: (Overridden in BasicMapAccessor)
Return true if this represents a temporal type mapping. Will return true
if the accessor's reference class is a temporal type or if a @Temporal
exists.
return hasTemporal() || MetadataHelper.isValidTemporalType(getReferenceClass());
|
protected void | processEnumerated(oracle.toplink.essentials.mappings.DatabaseMapping mapping)INTERNAL: (Overridden in BasicAccessor and BasicMapAccessor)
Process an @Enumerated. The method may still be called if no @Enumerated
has been specified but the accessor's reference class is a valid
enumerated type.
// If this accessor is tagged as an enumerated type, validate the
// reference class.
if (hasEnumerated()) {
if (! MetadataHelper.isValidEnumeratedType(getReferenceClass())) {
m_validator.throwInvalidTypeForEnumeratedAttribute(getJavaClass(), mapping.getAttributeName(), getReferenceClass());
}
}
// Create an EnumTypeConverter and set it on the mapping.
setConverter(mapping, new EnumTypeConverter(mapping, getReferenceClass(), getEnumeratedType().equals(EnumType.ORDINAL.name())));
|
protected void | processJPAConverters(oracle.toplink.essentials.mappings.DatabaseMapping mapping)INTERNAL:
Process an @Enumerated, @Lob or @Temporal annotation. Will default
a serialized converter if necessary.
// Check for an enum first since it will fall into a serializable
// mapping otherwise (Enums are serialized)
if (isEnumerated()) {
processEnumerated(mapping);
} else if (isLob()) {
processLob(mapping);
} else if (isTemporal()) {
processTemporal(mapping);
//gf 1637: converter for Temporal returns false for isMutable, needs to be overriden
((AbstractDirectMapping)mapping).setIsMutable(true);
} else if (isSerialized()) {
processSerialized(mapping);
} else if (MetadataHelper.isValidDateType(this.getReferenceClass())){
//gf 1637: override directmapping ismutable
((AbstractDirectMapping)mapping).setIsMutable(true);
}
|
protected void | processLob(oracle.toplink.essentials.mappings.DatabaseMapping mapping)INTERNAL: (Overridden in BasicAccessor)
Process a @Lob or lob sub-element. The lob must be specified to process
and create a lob type mapping.
// Set the field classification type on the mapping based on the
// referenceClass type.
if (MetadataHelper.isValidClobType(getReferenceClass())) {
setFieldClassification(mapping, java.sql.Clob.class);
setConverter(mapping, new TypeConversionConverter(mapping));
} else if (MetadataHelper.isValidBlobType(getReferenceClass())) {
setFieldClassification(mapping, java.sql.Blob.class);
setConverter(mapping, new TypeConversionConverter(mapping));
} else if (Helper.classImplementsInterface(getReferenceClass(), Serializable.class)) {
setFieldClassification(mapping, java.sql.Blob.class);
setConverter(mapping, new SerializedObjectConverter(mapping));
} else {
// The referenceClass is neither a valid BLOB or CLOB attribute.
m_validator.throwInvalidTypeForLOBAttribute(getJavaClass(), mapping.getAttributeName(), getReferenceClass());
}
|
protected void | processMappingConverter(oracle.toplink.essentials.mappings.DatabaseMapping mapping)INTERNAL:
Process a converter for the given mapping. Will look for a converter
name from a @Convert specified on this accessor.
processJPAConverters(mapping);
|
protected void | processSerialized(oracle.toplink.essentials.mappings.DatabaseMapping mapping)INTERNAL:
Process a potential serializable attribute. If the class implements
the Serializable interface then set a SerializedObjectConverter on
the mapping.
if (Helper.classImplementsInterface(getReferenceClass(), Serializable.class)) {
SerializedObjectConverter converter = new SerializedObjectConverter(mapping);
setConverter(mapping, converter);
} else {
m_validator.throwInvalidTypeForSerializedAttribute(getJavaClass(), mapping.getAttributeName(), getReferenceClass());
}
|
protected void | processTemporal(oracle.toplink.essentials.mappings.DatabaseMapping mapping)INTERNAL:
Process a temporal type accessor.
if (hasTemporal()) {
if (MetadataHelper.isValidTemporalType(getReferenceClass())) {
// Set a TypeConversionConverter on the mapping.
setFieldClassification(mapping, MetadataHelper.getFieldClassification(getTemporalType()));
setConverter(mapping, new TypeConversionConverter(mapping));
} else {
m_validator.throwInvalidTypeForTemporalAttribute(getJavaClass(), getAttributeName(), getReferenceClass());
}
} else {
m_validator.throwNoTemporalTypeSpecified(getJavaClass(), getAttributeName());
}
|
public abstract void | setConverter(oracle.toplink.essentials.mappings.DatabaseMapping mapping, oracle.toplink.essentials.mappings.converters.Converter converter)INTERNAL:
|
public abstract void | setFieldClassification(oracle.toplink.essentials.mappings.DatabaseMapping mapping, java.lang.Class classification)INTERNAL:
|