| Method from org.apache.openjpa.meta.FieldMetaData Detail: |
public ClassMetaData addEmbeddedMetaData() {
return _val.addEmbeddedMetaData();
}
|
protected void addExtensionKeys(Collection exts) {
getRepository().getMetaDataFactory().addFieldExtensionKeys(exts);
}
|
public void backingMember(Member member) {
if (member == null)
return;
if (Modifier.isTransient(member.getModifiers()))
_transient = true;
_backingMember = new MemberProvider(member);
Class type;
Class[] types;
if (member instanceof Field) {
Field f = (Field) member;
type = f.getType();
types = JavaVersions.getParameterizedTypes(f);
} else {
Method meth = (Method) member;
type = meth.getReturnType();
types = JavaVersions.getParameterizedTypes(meth);
}
setDeclaredType(type);
if (Collection.class.isAssignableFrom(type)
&& _elem.getDeclaredType() == Object.class
&& types.length == 1) {
_elem.setDeclaredType(types[0]);
} else if (Map.class.isAssignableFrom(type)
&& types.length == 2) {
if (_key.getDeclaredType() == Object.class)
_key.setDeclaredType(types[0]);
if (_elem.getDeclaredType() == Object.class)
_elem.setDeclaredType(types[1]);
}
}
Supply the backing member object; this allows us to utilize
parameterized type information if available. |
public int compareTo(Object other) {
if (other == null)
return 1;
return getFullName(true).compareTo(((FieldMetaData) other).
getFullName(true));
}
|
public void copy(FieldMetaData field) {
super.copy(field);
_intermediate = field.usesIntermediate();
_implData = field.usesImplData();
// copy field-level info; use get methods to force resolution of
// lazy data
_proxyClass = field.getProxyType();
_initializer = field.getInitializer();
_transient = field.isTransient();
_nullValue = field.getNullValue();
_manage = field.getManagement();
_explicit = field.isExplicit();
_extName = field.getExternalizer();
_extMethod = DEFAULT_METHOD;
_factName = field.getFactory();
_factMethod = DEFAULT_METHOD;
_extString = field.getExternalValues();
_extValues = Collections.EMPTY_MAP;
_fieldValues = Collections.EMPTY_MAP;
_primKey = field.isPrimaryKey();
_backingMember = field._backingMember;
_enumField = field._enumField;
_lobField = field._lobField;
_serializableField = field._serializableField;
_generated = field._generated;
// embedded fields can't be versions
if (_owner.getEmbeddingMetaData() == null && _version == null)
_version = (field.isVersion()) ? Boolean.TRUE : Boolean.FALSE;
// only copy this data if not already set explicitly in this instance
if (_dfg == 0) {
_dfg = (field.isInDefaultFetchGroup()) ? DFG_TRUE : DFG_FALSE;
if (field.isDefaultFetchGroupExplicit())
_dfg |= DFG_EXPLICIT;
}
if (_fgSet == null && field._fgSet != null)
_fgSet = new HashSet(field._fgSet);
if (_lfg == null)
_lfg = field.getLoadFetchGroup();
if (_lrs == null)
_lrs = (field.isLRS()) ? Boolean.TRUE : Boolean.FALSE;
if (_valStrategy == -1)
_valStrategy = field.getValueStrategy();
if (_upStrategy == -1)
_upStrategy = field.getUpdateStrategy();
if (ClassMetaData.DEFAULT_STRING.equals(_seqName)) {
_seqName = field.getValueSequenceName();
_seqMeta = null;
}
if (ClassMetaData.DEFAULT_STRING.equals(_inverse))
_inverse = field.getInverse();
// copy value metadata
_val.copy(field);
_key.copy(field.getKey());
_elem.copy(field.getElement());
}
Copy state from the given field to this one. Do not copy mapping
information. |
public void copy(ValueMetaData vmd) {
_val.copy (vmd);
}
|
public boolean equals(Object other) {
if (other == this)
return true;
if (!(other instanceof FieldMetaData))
return false;
return getFullName(true).equals(((FieldMetaData) other).
getFullName(true));
}
|
public Member getBackingMember() {
return (_backingMember == null) ? null : _backingMember.getMember();
}
|
public int getCascadeAttach() {
return _val.getCascadeAttach();
}
|
public int getCascadeDelete() {
return _val.getCascadeDelete();
}
|
public int getCascadePersist() {
return _val.getCascadePersist();
}
|
public int getCascadeRefresh() {
return _val.getCascadeRefresh();
}
|
public String[] getComments() {
return (_comments == null) ? EMPTY_COMMENTS : _comments;
}
|
public String[] getCustomFetchGroups() {
if (_fgs == null) {
if (_fgSet == null || _manage != MANAGE_PERSISTENT
|| isPrimaryKey() || isVersion())
_fgs = new String[0];
else
_fgs = (String[]) _fgSet.toArray(new String[_fgSet.size()]);
}
return _fgs;
}
Gets the name of the custom fetch groups those are associated to this
receiver. This does not include the "default" and "all" fetch groups. |
public int getDeclaredIndex() {
return _decIndex;
}
The relative index of this persistent/transactional field. |
public Class getDeclaredType() {
return _val.getDeclaredType();
}
|
public int getDeclaredTypeCode() {
return _val.getDeclaredTypeCode();
}
|
public ClassMetaData getDeclaredTypeMetaData() {
return _val.getDeclaredTypeMetaData();
}
|
public ClassMetaData getDeclaringMetaData() {
if (_dec == null)
return _owner;
if (_decMeta == null)
_decMeta = getRepository().getMetaData(_dec,
_owner.getEnvClassLoader(), true);
return _decMeta;
}
|
public Class getDeclaringType() {
return (_dec == null) ? _owner.getDescribedType() : _dec;
}
|
public ClassMetaData getDefiningMetaData() {
return _owner;
}
The class that defines the metadata for this field. |
public ValueMetaData getElement() {
return _elem;
}
Metadata about the element value. |
public ClassMetaData getEmbeddedMetaData() {
return _val.getEmbeddedMetaData();
}
|
public Object getExternalValue(Object val,
StoreContext ctx) {
Map extValues = getExternalValueMap();
if (extValues != null) {
Object foundVal = extValues.get(val);
if (foundVal == null) {
throw new UserException(_loc.get("bad-externalized-value",
new Object[] { val, extValues.keySet(), this }))
.setFatal(true).setFailedObject(val);
} else {
return foundVal;
}
}
Method externalizer = getExternalizerMethod();
if (externalizer == null)
return val;
// special case for queries: allow the given value to pass through
// as-is if it is already in externalized form
if (val != null && getType().isInstance(val)
&& (!getDeclaredType().isInstance(val)
|| getDeclaredType() == Object.class))
return val;
try {
// either invoke the static toExternal(val[, ctx]) method, or the
// non-static val.toExternal([ctx]) method
if (Modifier.isStatic(externalizer.getModifiers())) {
if (externalizer.getParameterTypes().length == 1)
return externalizer.invoke(null, new Object[]{ val });
return externalizer.invoke(null, new Object[]{ val, ctx });
}
if (val == null)
return null;
if (externalizer.getParameterTypes().length == 0)
return externalizer.invoke(val, (Object[]) null);
return externalizer.invoke(val, new Object[]{ ctx });
} catch (OpenJPAException ke) {
throw ke;
} catch (Exception e) {
throw new MetaDataException(_loc.get("externalizer-err", this,
Exceptions.toString(val), e.toString())).setCause(e);
}
}
Convert the given field value to its external value through the
provided externalizer, or return the value as-is if no externalizer. |
public Map getExternalValueMap() {
parseExternalValues();
return _extValues;
}
Return the mapping of field values to external values. |
public String getExternalValues() {
return _extString;
}
Properties string mapping field values to external values. |
public String getExternalizer() {
return _extName;
}
The name of this field's externalizer, or null if none. |
public Method getExternalizerMethod() {
if (_manage != MANAGE_PERSISTENT)
return null;
if (_extMethod == DEFAULT_METHOD) {
if (_extName != null) {
_extMethod = findMethod(_extName);
if (_extMethod == null)
throw new MetaDataException(_loc.get("bad-externalizer",
this, _extName));
} else
_extMethod = null;
}
return _extMethod;
}
|
public String getFactory() {
return _factName;
}
The name of this field's factory, or null if none. |
public Member getFactoryMethod() {
if (_manage != MANAGE_PERSISTENT)
return null;
if (_factMethod == DEFAULT_METHOD) {
if (getExternalizerMethod() == null)
_factMethod = null;
else {
try {
if (_factName == null)
_factMethod = getDeclaredType().getConstructor
(new Class[]{ getType() });
else
_factMethod = findMethod(_factName);
} catch (OpenJPAException ke) {
throw ke;
} catch (Exception e) {
}
if (!(_factMethod instanceof Constructor)
&& !(_factMethod instanceof Method))
throw new MetaDataException(_loc.get("bad-factory", this));
}
}
return _factMethod;
}
The factory method or constructor. |
public FieldMetaData getFieldMetaData() {
return this;
}
|
public Object getFieldValue(Object val,
StoreContext ctx) {
Map fieldValues = getFieldValueMap();
if (fieldValues != null)
return fieldValues.get(val);
Member factory = getFactoryMethod();
if (factory == null)
return val;
try {
if (val == null && getNullValue() == NULL_DEFAULT)
return AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(getDeclaredType()));
// invoke either the constructor for the field type,
// or the static type.toField(val[, ctx]) method
if (factory instanceof Constructor) {
if (val == null)
return null;
return ((Constructor) factory).newInstance
(new Object[]{ val });
}
Method meth = (Method) factory;
if (meth.getParameterTypes().length == 1)
return meth.invoke(null, new Object[]{ val });
return meth.invoke(null, new Object[]{ val, ctx });
} catch (Exception e) {
// unwrap cause
if (e instanceof InvocationTargetException) {
Throwable t = ((InvocationTargetException) e).
getTargetException();
if (t instanceof Error)
throw (Error) t;
e = (Exception) t;
// allow null values to cause NPEs and illegal arg exceptions
// without error
if (val == null && (e instanceof NullPointerException
|| e instanceof IllegalArgumentException))
return null;
}
if (e instanceof OpenJPAException)
throw (OpenJPAException) e;
if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("factory-err", this,
Exceptions.toString(val), e.toString())).setCause(e);
}
}
Return the result of passing the given external value through the
factory to get the field value. If no factory is present,
the given value is returned as-is. |
public Map getFieldValueMap() {
parseExternalValues();
return _fieldValues;
}
Return the mapping of external values to field values. |
public String getFullName() {
return getFullName(false);
} Deprecated! Use - getFullName(boolean) instead.
The field name, qualified by the owning class. |
public String getFullName(boolean embedOwner) {
if (_fullName == null)
_fullName = getDeclaringType().getName() + "." + _name;
if (embedOwner && _embedFullName == null) {
if (_owner.getEmbeddingMetaData() == null)
_embedFullName = _fullName;
else
_embedFullName = _owner.getEmbeddingMetaData().
getFieldMetaData().getFullName(true) + "." + _fullName;
}
return (embedOwner) ? _embedFullName : _fullName;
}
The field name, qualified by the owning class and optionally the
embedding owner's name (if any). |
public int getIndex() {
return _index;
}
The absolute index of this persistent/transactional field. |
public Object getInitializer() {
return _initializer;
}
The initializer used by the field, or null if none. This
is additional information for initializing the field, such as
a custom Comparator used by a Set or
a TimeZone used by a Calendar . |
public String getInverse() {
if (ClassMetaData.DEFAULT_STRING.equals(_inverse))
_inverse = null;
return _inverse;
}
|
public FieldMetaData[] getInverseMetaDatas() {
if (_inverses == null) {
// can't declare both an inverse owner and a logical inverse
String inv = getInverse();
if (_mappedBy != null && inv != null && !_mappedBy.equals(inv))
throw new MetaDataException(_loc.get("mapped-not-inverse",
this));
// get the metadata for the type on the other side of this relation
ClassMetaData meta = null;
switch (getTypeCode()) {
case JavaTypes.PC:
meta = getTypeMetaData();
break;
case JavaTypes.ARRAY:
case JavaTypes.COLLECTION:
meta = _elem.getTypeMetaData();
break;
}
Collection inverses = null;
if (meta != null) {
// add mapped by and named inverse, if any
FieldMetaData field = getMappedByMetaData();
if (field != null) {
// mapped by field isn't necessarily a pc type, but all
// inverses must be
if (field.getTypeCode() == JavaTypes.PC
|| field.getElement().getTypeCode() == JavaTypes.PC) {
inverses = new ArrayList(3);
inverses.add(field);
}
} else if (inv != null) {
field = meta.getField(inv);
if (field == null)
throw new MetaDataException(_loc.get("no-inverse",
this, inv));
inverses = new ArrayList(3);
inverses.add(field);
}
// scan rel type for fields that name this field as an inverse
FieldMetaData[] fields = meta.getFields();
Class type = getDeclaringMetaData().getDescribedType();
for (int i = 0; i < fields.length; i++) {
// skip fields that aren't compatible with our owning class
switch (fields[i].getTypeCode()) {
case JavaTypes.PC:
if (!type.isAssignableFrom(fields[i].getType()))
continue;
break;
case JavaTypes.COLLECTION:
case JavaTypes.ARRAY:
if (!type.isAssignableFrom(fields[i].
getElement().getType()))
continue;
break;
default:
continue;
}
// if the field declares us as its inverse and we haven't
// already added it (we might have if we also declared it
// as our inverse), add it now
if (_name.equals(fields[i].getMappedBy())
|| _name.equals(fields[i].getInverse())) {
if (inverses == null)
inverses = new ArrayList(3);
if (!inverses.contains(fields[i]))
inverses.add(fields[i]);
}
}
}
MetaDataRepository repos = getRepository();
if (inverses == null)
_inverses = repos.EMPTY_FIELDS;
else
_inverses = (FieldMetaData[]) inverses.toArray
(repos.newFieldMetaDataArray(inverses.size()));
}
return _inverses;
}
Return all inverses of this field. |
public ValueMetaData getKey() {
return _key;
}
Metadata about the key value. |
public int getListingIndex() {
return _listIndex;
}
The index in which this field was listed in the metadata. Defaults to
-1 if this field was not listed in the metadata. |
public String getLoadFetchGroup() {
return _lfg;
}
The fetch group that is to be loaded when this receiver is loaded, or
null if none set. |
public int getManagement() {
return _manage;
}
Return the management level for the field. Will be one of:
Defaults to #MANAGE_PERSISTENT . |
public String getMappedBy() {
return _mappedBy;
}
The field that this field shares a mapping with. |
public FieldMetaData getMappedByMetaData() {
if (_mappedBy != null && _mappedByMeta == null) {
ClassMetaData meta = null;
switch (getTypeCode()) {
case JavaTypes.PC:
meta = getTypeMetaData();
break;
case JavaTypes.ARRAY:
case JavaTypes.COLLECTION:
case JavaTypes.MAP:
meta = _elem.getTypeMetaData();
break;
}
FieldMetaData field = (meta == null) ? null
: meta.getField(_mappedBy);
if (field == null)
throw new MetaDataException(_loc.get("no-mapped-by", this,
_mappedBy));
if (field.getMappedBy() != null)
throw new MetaDataException(_loc.get("circ-mapped-by", this,
_mappedBy));
_mappedByMeta = field;
}
return _mappedByMeta;
}
The field that this field shares a mapping with. |
public String getName() {
return _name;
}
|
public int getNullValue() {
return _nullValue;
}
How the data store should treat null values for this field:
Defaults to #NULL_UNSET . |
public Class getObjectIdFieldType() {
ClassMetaData relmeta = getDeclaredTypeMetaData();
if (relmeta == null)
return getDeclaredType();
switch (relmeta.getIdentityType()) {
case ClassMetaData.ID_DATASTORE:
boolean unwrap = getRepository().getMetaDataFactory().
getDefaults().isDataStoreObjectIdFieldUnwrapped();
return (unwrap) ? long.class : Object.class;
case ClassMetaData.ID_APPLICATION:
if (relmeta.isOpenJPAIdentity())
return relmeta.getPrimaryKeyFields()[0].
getObjectIdFieldType();
return (relmeta.getObjectIdType() == null) ? Object.class
: relmeta.getObjectIdType();
default:
return Object.class;
}
}
For a primary key field, return the type of the corresponding object id
class field. |
public int getObjectIdFieldTypeCode() {
ClassMetaData relmeta = getDeclaredTypeMetaData();
if (relmeta == null)
return getDeclaredTypeCode();
if (relmeta.getIdentityType() == ClassMetaData.ID_DATASTORE) {
boolean unwrap = getRepository().getMetaDataFactory().getDefaults().
isDataStoreObjectIdFieldUnwrapped();
return (unwrap) ? JavaTypes.LONG : JavaTypes.OBJECT;
}
if (relmeta.isOpenJPAIdentity())
return relmeta.getPrimaryKeyFields()[0].getObjectIdFieldTypeCode();
return JavaTypes.OBJECT;
}
For a primary key field, return the type of the corresponding object id
class field. |
public String getOrderDeclaration() {
if (_orderDec == null && _orders != null) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < _orders.length; i++) {
if (i > 0)
buf.append(", ");
buf.append(_orders[i].getName()).append(" ");
buf.append((_orders[i].isAscending()) ? "asc" : "desc");
}
_orderDec = buf.toString();
}
return _orderDec;
}
String declaring the orderings for this field to be applied on load,
or null. The string is of the form:
orderable[ asc|desc][, ...]
The orderable #element is used to denote the value of
the field's elements. |
public Order[] getOrders() {
if (_orders == null) {
if (_orderDec == null)
_orders = getRepository().EMPTY_ORDERS;
else {
String[] decs = Strings.split(_orderDec, ",", 0);
Order[] orders = getRepository().newOrderArray(decs.length);
int spc;
boolean asc;
for (int i = 0; i < decs.length; i++) {
decs[i] = decs[i].trim();
spc = decs[i].indexOf(' ");
if (spc == -1)
asc = true;
else {
asc = decs[i].substring(spc + 1).trim().
toLowerCase().startsWith("asc");
decs[i] = decs[i].substring(0, spc);
}
orders[i] = getRepository().newOrder(this, decs[i], asc);
//set "isUsedInOrderBy" to the field
ClassMetaData elemCls = getElement()
.getDeclaredTypeMetaData();
if (elemCls != null) {
FieldMetaData fmd = elemCls.getDeclaredField(decs[i]);
if (fmd != null)
fmd.setUsedInOrderBy(true);
}
}
_orders = orders;
}
}
return _orders;
}
The orderings for this field to be applied on load, or empty array. |
public int getPrimaryKeyIndex() {
return _pkIndex;
}
The absolute primary key index for this field, or -1 if not a primary
key. The first primary key field has index 0, the second index 1, etc. |
public Class getProxyType() {
return (_proxyClass == null) ? getDeclaredType() : _proxyClass;
}
The type this field was initialized with, and therefore the
type to use for proxies when loading data into this field. |
public MetaDataRepository getRepository() {
return _owner.getRepository();
}
|
public int getResolve() {
return _resMode;
}
Resolve mode for this field. |
public Class getType() {
return _val.getType();
}
|
public int getTypeCode() {
return _val.getTypeCode();
}
|
public ClassMetaData getTypeMetaData() {
return _val.getTypeMetaData();
}
|
public Class getTypeOverride() {
return _val.getTypeOverride ();
}
|
public int getUpdateStrategy() {
if (isVersion())
return UpdateStrategies.RESTRICT;
if (_upStrategy == -1)
_upStrategy = UpdateStrategies.NONE;
return _upStrategy;
}
The strategy to use when updating the field. |
public ValueMetaData getValue() {
return _val;
}
MetaData about the field value. |
public String getValueMappedBy() {
return _val.getValueMappedBy();
}
|
public FieldMetaData getValueMappedByMetaData() {
return _val.getValueMappedByMetaData ();
}
|
public SequenceMetaData getValueSequenceMetaData() {
if (_seqMeta == null && getValueSequenceName() != null)
_seqMeta = getRepository().getSequenceMetaData(_owner,
getValueSequenceName(), true);
return _seqMeta;
}
Metadata for the value sequence. |
public String getValueSequenceName() {
if (ClassMetaData.DEFAULT_STRING.equals(_seqName))
_seqName = null;
return _seqName;
}
The value sequence name, or null for none. |
public int getValueStrategy() {
if (_valStrategy == -1)
_valStrategy = ValueStrategies.NONE;
return _valStrategy;
}
The strategy to use for insert value generation.
One of the constants from ValueStrategies . |
public int hashCode() {
return getFullName(true).hashCode();
}
|
public boolean isDeclaredTypePC() {
return _val.isDeclaredTypePC();
}
|
public boolean isDefaultFetchGroupExplicit() {
return (_dfg & DFG_EXPLICIT) > 0;
}
Whether the default fetch group setting is explicit. |
public boolean isEmbedded() {
return _val.isEmbedded();
}
|
public boolean isEmbeddedPC() {
return _val.isEmbeddedPC();
}
|
public boolean isExplicit() {
return _explicit;
}
Whether this field is explicitly declared in the metadata. |
public boolean isExternalized() {
return getExternalizerMethod() != null
|| getExternalValueMap() != null;
}
Whether the field is externalized. |
public boolean isInDefaultFetchGroup() {
if (_dfg == 0) {
if (_manage != MANAGE_PERSISTENT || isPrimaryKey() || isVersion())
_dfg = DFG_FALSE;
else {
// field left as default; dfg setting depends on type
switch (getTypeCode()) {
case JavaTypes.OBJECT:
if (isSerializable() || isEnum())
_dfg = DFG_TRUE;
else
_dfg = DFG_FALSE;
break;
case JavaTypes.ARRAY:
if (isLobArray())
_dfg = DFG_TRUE;
else
_dfg = DFG_FALSE;
break;
case JavaTypes.COLLECTION:
case JavaTypes.MAP:
case JavaTypes.PC:
case JavaTypes.PC_UNTYPED:
_dfg = DFG_FALSE;
break;
default:
_dfg = DFG_TRUE;
}
}
}
return (_dfg & DFG_TRUE) > 0;
}
Whether this field is in the default fetch group. |
public boolean isInFetchGroup(String fg) {
if (_manage != MANAGE_PERSISTENT || isPrimaryKey() || isVersion())
return false;
if (FetchGroup.NAME_ALL.equals(fg))
return true;
if (FetchGroup.NAME_DEFAULT.equals(fg))
return isInDefaultFetchGroup();
return _fgSet != null && _fgSet.contains(fg);
}
Whether this field is in the given fetch group. |
public boolean isLRS() {
return _lrs == Boolean.TRUE && _manage == MANAGE_PERSISTENT;
}
Whether this field is backed by a large result set. |
public boolean isMapped() {
return _manage == MANAGE_PERSISTENT && _owner.isMapped();
}
Return whether this field is mapped to the datastore. By default,
returns true for all persistent fields whose defining class is mapped. |
public boolean isPrimaryKey() {
return _primKey;
}
Whether this is a primary key field. |
public boolean isSerialized() {
return _val.isSerialized();
}
|
public boolean isStream() {
return _stream == Boolean.TRUE && _manage == MANAGE_PERSISTENT;
}
Whether this field is backed by a stream. |
public boolean isTransient() {
return _transient;
}
Return whether this is a transient field. |
public boolean isTypePC() {
return _val.isTypePC();
}
|
public boolean isUsedInOrderBy() {
return _usedInOrderBy;
}
Check if this field is used by other field as "order by" value. |
public boolean isValueGenerated() {
return _generated;
}
|
public boolean isVersion() {
return _version == Boolean.TRUE;
}
Whether this field holds optimistic version information. |
public Object order(Object val) {
if (val == null)
return null;
Order[] orders = getOrders();
if (orders.length == 0)
return val;
// create a comparator for the elements of the value
Comparator comp;
if (orders.length == 1)
comp = orders[0].getComparator();
else {
List comps = null;
Comparator curComp;
for (int i = 0; i < orders.length; i++) {
curComp = orders[i].getComparator();
if (curComp != null) {
if (comps == null)
comps = new ArrayList(orders.length);
if (i != comps.size())
throw new MetaDataException(_loc.get
("mixed-inmem-ordering", this));
comps.add(curComp);
}
}
if (comps == null)
comp = null;
else
comp = new ComparatorChain(comps);
}
if (comp == null)
return val;
// sort
switch (getTypeCode()) {
case JavaTypes.ARRAY:
List l = JavaTypes.toList(val, _elem.getType(), true);
Collections.sort(l, comp);
return JavaTypes.toArray(l, _elem.getType());
case JavaTypes.COLLECTION:
if (val instanceof List)
Collections.sort((List) val, comp);
return val;
default:
throw new MetaDataException(_loc.get("cant-order", this));
}
}
Order this field value when it is loaded. |
public boolean resolve(int mode) {
if ((_resMode & mode) == mode)
return true;
int cur = _resMode;
_resMode |= mode;
Log log = getRepository().getLog();
if (log.isTraceEnabled())
log.trace(_loc.get("resolve-field", _owner + "@"
+ System.identityHashCode(_owner) + "." + _name));
// we only perform actions for metadata mode
if ((mode & MODE_META) == 0 || (cur & MODE_META) != 0)
return false;
Method externalizer = getExternalizerMethod();
if (externalizer != null)
setType(externalizer.getReturnType());
// only pass on metadata resolve mode so that metadata is always
// resolved before any other resolve modes our subclasses pass along
_val.resolve(MODE_META);
_key.resolve(MODE_META);
_elem.resolve(MODE_META);
MetaDataRepository repos = getRepository();
int validate = repos.getValidate();
if ((validate & MetaDataRepository.VALIDATE_META) != 0
&& (!ImplHelper.isManagedType(repos.getConfiguration(),
_owner.getDescribedType())
|| (validate & MetaDataRepository.VALIDATE_UNENHANCED) == 0)) {
validateLRS();
if ((validate & repos.VALIDATE_RUNTIME) == 0)
validateSupportedType();
validateValue();
validateExtensionKeys();
}
return false;
}
Resolve and validate metadata. Return true if already resolved. |
public void setCascadeAttach(int attach) {
_val.setCascadeAttach(attach);
}
|
public void setCascadeDelete(int delete) {
_val.setCascadeDelete(delete);
}
|
public void setCascadePersist(int persist) {
_val.setCascadePersist(persist);
}
|
public void setCascadeRefresh(int refresh) {
_val.setCascadeRefresh(refresh);
}
|
public void setComments(String[] comments) {
_comments = comments;
}
|
public void setDeclaredIndex(int index) {
_decIndex = index;
}
The relative index of this persistent/transactional field. |
public void setDeclaredType(Class type) {
_val.setDeclaredType(type);
if (type.isArray())
_elem.setDeclaredType(type.getComponentType());
else if (type == Properties.class) {
_key.setDeclaredType(String.class);
_elem.setDeclaredType(String.class);
}
}
|
public void setDeclaredTypeCode(int type) {
_val.setDeclaredTypeCode(type);
}
|
public void setDeclaringType(Class cls) {
_dec = cls;
_decMeta = null;
_fullName = null;
_embedFullName = null;
}
|
public void setDefaultFetchGroupExplicit(boolean explicit) {
if (explicit)
_dfg |= DFG_EXPLICIT;
else
_dfg &= ~DFG_EXPLICIT;
}
Whether the default fetch group setting is explicit. Allow setting
for testing. |
public void setEmbedded(boolean embedded) {
_val.setEmbedded(embedded);
}
|
public void setExplicit(boolean explicit) {
_explicit = explicit;
}
Whether this field is explicitly declared in the metadata. |
public void setExternalValues(String values) {
_extString = values;
_extValues = null;
}
Properties string mapping field values to external values. |
public void setExternalizer(String externalizer) {
_extName = externalizer;
_extMethod = DEFAULT_METHOD;
}
The name of this field's externalizer, or null if none. |
public void setFactory(String factory) {
_factName = factory;
_factMethod = DEFAULT_METHOD;
}
The name of this field's factory, or null if none. |
public void setInDefaultFetchGroup(boolean dfg) {
if (dfg)
_dfg = DFG_TRUE;
else
_dfg = DFG_FALSE;
_dfg |= DFG_EXPLICIT;
}
Whether this field is in the default fetch group. |
public void setInFetchGroup(String fg,
boolean in) {
if (StringUtils.isEmpty(fg))
throw new MetaDataException(_loc.get("empty-fg-name", this));
if (fg.equals(FetchGroup.NAME_ALL))
return;
if (fg.equals(FetchGroup.NAME_DEFAULT)) {
setInDefaultFetchGroup(in);
return;
}
if (_owner.getFetchGroup(fg) == null)
throw new MetaDataException(_loc.get("unknown-fg", fg, this));
if (in && _fgSet == null)
_fgSet = new HashSet();
if ((in && _fgSet.add(fg))
|| (!in && _fgSet != null && _fgSet.remove(fg)))
_fgs = null;
}
Set whether this field is in the given fetch group. |
public void setIndex(int index) {
_index = index;
}
The absolute index of this persistent/transactional field. |
public void setInitializer(Object initializer) {
_initializer = initializer;
}
The initializer used by the field, or null if none. This
is additional information for initializing the field, such as
a custom Comparator used by a Set or
a TimeZone used by a Calendar . |
public void setInverse(String inverse) {
_inverses = null;
_inverse = inverse;
}
|
public void setLRS(boolean lrs) {
_lrs = (lrs) ? Boolean.TRUE : Boolean.FALSE;
}
Whether this field is backed by a large result set. |
public void setListingIndex(int index) {
_listIndex = index;
}
The index in which this field was listed in the metadata. Defaults to
-1 if this field was not listed in the metadata. |
public void setLoadFetchGroup(String lfg) {
if ("".equals(lfg))
lfg = null;
_lfg = lfg;
}
The fetch group that is to be loaded when this receiver is loaded, or
null if none set. |
public void setManagement(int manage) {
if ((_manage == MANAGE_NONE) != (manage == MANAGE_NONE))
_owner.clearFieldCache();
_manage = manage;
}
Return the management level for the field. Will be one of:
Defaults to #MANAGE_PERSISTENT . |
public void setMappedBy(String mapped) {
_mappedBy = mapped;
_mappedByMeta = null;
}
The field that this field shares a mapping with. |
public void setNullValue(int nullValue) {
_nullValue = nullValue;
}
How the data store should treat null values for this field:
Defaults to #NULL_UNSET . |
public void setOrderDeclaration(String dec) {
_orderDec = StringUtils.trimToNull(dec);
_orders = null;
}
String declaring the orderings for this field to be applied on load,
or null. The string is of the form:
orderable[ asc|desc][, ...]
The orderable #element is used to denote the value of
the field's elements. |
public void setOrders(Order[] orders) {
_orderDec = null;
_orders = orders;
}
The orderings for this field to be applied on load. |
public void setPrimaryKey(boolean primKey) {
_primKey = primKey;
}
Whether this is a primary key field. |
public void setPrimaryKeyIndex(int index) {
_pkIndex = index;
}
The absolute primary key index for this field, or -1 if not a primary
key. The first primary key field has index 0, the second index 1, etc. |
public void setProxyType(Class type) {
_proxyClass = type;
}
The type this field was initialized with, and therefore the
type to use for proxies when loading data into this field. |
public void setResolve(int mode) {
_resMode = mode;
}
Resolve mode for this field. |
public void setResolve(int mode,
boolean on) {
if (mode == MODE_NONE)
_resMode = mode;
else if (on)
_resMode |= mode;
else
_resMode &= ~mode;
}
Resolve mode for this field. |
public void setSerialized(boolean serialized) {
_val.setSerialized(serialized);
}
|
public void setStream(boolean stream) {
_stream = (stream) ? Boolean.TRUE : Boolean.FALSE;
}
Whether this field is backed by a stream. |
public void setTransient(boolean trans) {
_transient = trans;
}
Return whether this is a transient field. |
public void setType(Class type) {
_val.setType(type);
if (type.isArray())
_elem.setType(type.getComponentType());
else if (type == Properties.class) {
_key.setType(String.class);
_elem.setType(String.class);
}
}
|
public void setTypeCode(int code) {
_val.setTypeCode(code);
}
|
public void setTypeOverride(Class type) {
_val.setTypeOverride (type);
}
|
public void setUpdateStrategy(int strategy) {
_upStrategy = strategy;
}
|
public void setUsedInOrderBy(boolean isUsed) {
_usedInOrderBy = isUsed;
}
Whether this field is used by other field as "order by" value . |
public void setUsesImplData(Boolean implData) {
_implData = implData;
_owner.clearExtraFieldDataTable();
}
Whether this field uses impl data in conjunction with standard
field data when acting on a OpenJPAStateManager . |
public void setUsesIntermediate(boolean intermediate) {
_intermediate = intermediate;
_owner.clearExtraFieldDataTable();
}
Whether this field uses intermediate data when loading/storing
information through a OpenJPAStateManager . Defaults to true. |
public void setValueGenerated(boolean generated) {
this._generated = generated;
}
|
public void setValueMappedBy(String mapped) {
_val.setValueMappedBy(mapped);
}
|
public void setValueSequenceName(String seqName) {
_seqName = seqName;
_seqMeta = null;
if (seqName != null)
setValueStrategy(ValueStrategies.SEQUENCE);
}
The value sequence name, or null for none. |
public void setValueStrategy(int strategy) {
_valStrategy = strategy;
if (strategy != ValueStrategies.SEQUENCE)
setValueSequenceName(null);
}
The strategy to use for insert value generation.
One of the constants from ValueStrategies . |
public void setVersion(boolean version) {
_version = (version) ? Boolean.TRUE : Boolean.FALSE;
}
Whether this field holds optimistic version information. |
public String toString() {
return getFullName(true);
}
|
public Boolean usesImplData() {
return _implData;
}
Whether this field uses impl data in conjunction with standard
field data when acting on a OpenJPAStateManager .
Defaults to Boolean#TRUE (non-cachable impl data). |
public boolean usesIntermediate() {
return _intermediate;
}
Whether this field uses intermediate data when loading/storing
information through a OpenJPAStateManager . Defaults to true. |