Methods Summary |
---|
public int | getFieldNo(java.lang.String classPath, java.lang.String fieldName)Returns the unique field index of a declared, persistent field of a
class.
final String className = pathToName(classPath);
final PersistenceFieldElement pfe
= model.getPersistenceField(className, fieldName);
if (pfe == null
|| pfe.getPersistenceType() != PersistenceFieldElement.PERSISTENT)
return -1;
return pfe.getFieldNumber();
|
public java.lang.String[] | getManagedFields(java.lang.String classPath)Returns an array of field names of all declared persistent and
transactional fields of a class.
return getPersistentFields(classPath);
|
public java.lang.String | getPersistenceCapableRootClass(java.lang.String classPath)Returns the name of the persistence-capable root class of a class.
//^olsen: exchange dummy implementation once supported by Model
return (isPersistenceCapableClass(classPath) ? classPath : null);
|
private final java.lang.String[] | getPersistentFields(java.lang.String classPath)Returns an array of field names of all declared, persistent fields
of a class.
final String className = pathToName(classPath);
final PersistenceClassElement pce
= model.getPersistenceClass(className);
if (pce == null)
return new String[]{};
// exctract field names into result array
final PersistenceFieldElement[] pfes = pce.getFields();
final int nofFields = (pfes != null ? pfes.length : 0);
final String[] names = new String[nofFields];
for (int i = 0; i < nofFields; i++) {
final PersistenceFieldElement pfe = pfes[i];
names[i] = pfe.getName();
//@olsen: debugging check
if (false) {
if (pfe.getPersistenceType()
!= PersistenceFieldElement.PERSISTENT) {
final String msg
= ("Getting persistent field names: " //NOI18N
+ "Encountered non-persistent field '"//NOI18N
+ names[i] + "' for class " + classPath);//NOI18N
throw new JDOMetaDataFatalError(msg);
//out.println(msg);
//names[i] = null;
}
}
}
return names;
|
public java.lang.String | getSuperClass(java.lang.String classPath)Returns the name of the superclass of a class.
//throw new UnsupportedOperationException ("not implemented yet");
return null;
|
public boolean | isDefaultFetchGroupField(java.lang.String classPath, java.lang.String fieldName)Tests whether a field of a class is known to be part of the
Default Fetch Group. Please note that for a relationship field, this
method always returns false.
final String className = pathToName(classPath);
boolean isdfgField = model.isDefaultFetchGroup(className, fieldName);
if(isdfgField) {
final PersistenceFieldElement pfe
= model.getPersistenceField(className, fieldName);
if (pfe instanceof RelationshipElement) {
// This is a relationship field. Flag it as not belonging
// to dfg.
// Relationship fields are always flaged as not belonging to dfg
// This assures that access to a relationship fields is always
// mediated.
// Please see call to this method from following for more details.
// 1. EJBMetaDataModelImpl#getFieldFlags()
// 2. MethodAnnotater#notePutFieldAnnotation()
// 3. MethodAnnotater#noteGetFieldAnnotation()
isdfgField = false;
}
}
return isdfgField;
|
public boolean | isMutableSecondClassObjectType(java.lang.String classPath)Tests whether a type is known for Mutable Second Class Objects.
final String className = pathToName(classPath);
return model.isMutableSecondClassObject(className);
|
public boolean | isPersistenceCapableClass(java.lang.String classPath)Tests whether a class is known to be persistence-capable.
//^olsen: delegate to Model once supported
if (isTransientClass(classPath))
return false;
final String className = pathToName(classPath);
return model.isPersistent(className);
|
public boolean | isPersistenceCapableRootClass(java.lang.String classPath)Tests whether a class is known as a persistence-capable root class.
//@olsen: 4631388 - do not attempt to support inheritance right now
final String className = pathToName(classPath);
return model.isPersistent(className);
//return (model.isPersistent(className)
// && !model.hasPersistentSuperclass(className));
|
public boolean | isPersistentField(java.lang.String classPath, java.lang.String fieldName)Tests whether a field of a class is known to be persistent.
final String className = pathToName(classPath);
return model.isPersistent(className, fieldName);
|
public boolean | isPrimaryKeyField(java.lang.String classPath, java.lang.String fieldName)Tests whether a field of a class is known to be Primary Key.
final String className = pathToName(classPath);
return model.isKey(className, fieldName);
|
public boolean | isSecondClassObjectType(java.lang.String classPath)Tests whether a type is known for Second Class Objects.
final String className = pathToName(classPath);
return model.isSecondClassObject(className);
|
public boolean | isTransactionalField(java.lang.String classPath, java.lang.String fieldName)Tests whether a field of a class is known to be transactional.
//throw new UnsupportedOperationException ("not implemented yet");
return false;
|
public boolean | isTransientClass(java.lang.String classPath)Tests whether a class is known to be transient.
//^olsen: delegate to Model once supported
if (classPath.startsWith("java/"))//NOI18N
return true;
if (classPath.startsWith("javax/"))//NOI18N
return true;
if (classPath.startsWith("com/sun/jdo/"))//NOI18N
return true;
return false;
|
protected static java.lang.String | nameToPath(java.lang.String className)
if (className != null) {
return className.replace('.", '/");
} else {
return null;
}
|
protected static java.lang.String | pathToName(java.lang.String classPath)
if (classPath != null) {
return classPath.replace('/", '.");
} else {
return null;
}
|