Methods Summary |
---|
void | check()Examine the field to decide what actions are required
//@olsen: improved control flow
//@olsen: dropped code computing persistence information;
// used JDO meta data instead
String sig = theField.signature().asString();
fieldTypeInfo = FieldTypeInfo.determineFieldType(sig, env);
final String className = ca.className();
final String userClass = ca.userClassName();
final String fieldName = theField.name().asString();
final String fullFieldName = userFieldName();
//@olsen: added shortcut
final JDOMetaData jdoMetaData = env.getJDOMetaData();
//@olsen: use JDO meta data to decide whether a field is persistent
//@olsen: subst: fieldShouldBeTransient -> !fieldShouldBePersistent
final boolean fieldShouldBePersistent
= jdoMetaData.isPersistentField(className, fieldName);
//@olsen: added println() for debugging
if (false) {
System.out.println("FieldAction.check(): field "//NOI18N
+ className + "/" + fieldName//NOI18N
+ " should be persistent = "//NOI18N
+ fieldShouldBePersistent);
}
//@olsen: initialized property from JDO meta data
fieldIsPrimaryKey
= jdoMetaData.isPrimaryKeyField(className, fieldName);
//@olsen: added println() for debugging
if (false) {
System.out.println("FieldAction.check(): field "//NOI18N
+ className + "/" + fieldName//NOI18N
+ " is primary key = "//NOI18N
+ fieldIsPrimaryKey);
}
//@olsen: initialized property from JDO meta data
fieldIsMutableSCO
= jdoMetaData.isMutableSecondClassObjectType(typeName());
//@olsen: added println() for debugging
if (false) {
System.out.println("FieldAction.check(): field "//NOI18N
+ className + "/" + fieldName//NOI18N
+ " is mutable SCO = "//NOI18N
+ fieldIsMutableSCO);
}
nFieldArrayDims = 0;
while (sig.charAt(nFieldArrayDims) == '[")
nFieldArrayDims++;
// If the base type is a class type, compute the class name
if (sig.charAt(nFieldArrayDims) == 'L")
fieldClassName = sig.substring(nFieldArrayDims+1, sig.length()-1);
// check for transient field
if (!fieldShouldBePersistent) {
// done with transient field
return;
}
//@olsen: dropped code ...
// check for static field
affirm(!theField.isStatic(),
("The field " + fullFieldName//NOI18N
+ " is a static field which cannot be made persistent."));//NOI18N
// check for final field
affirm(!theField.isFinal(),
("The field " + fullFieldName +//NOI18N
" is a final field which cannot be made persistent."));//NOI18N
// check for target type
affirm((fieldClassName == null
|| jdoMetaData.isSecondClassObjectType(fieldClassName)
|| jdoMetaData.isPersistenceCapableClass(fieldClassName)),
("The field " + fullFieldName//NOI18N
+ " cannot be made persistent because of a non-primitive, "//NOI18N
+ " non-sco, or non-pc target type " + fieldClassName));//NOI18N
fieldIsPersistent = true;
|
java.lang.String | createMethod()Return the name of the static method on class Field which
will create a Field of the appropriate type.
return fieldTypeInfo.fieldCreateMethod;
|
java.lang.String | createMethodSig()Return the type signature of the static method on class Field which
will create a Field of the appropriate type.
return fieldTypeInfo.fieldCreateMethodSig;
|
java.lang.String | fieldClassName()For references fields, return the base type class name if a class
or interface, else null.
return fieldClassName;
|
java.lang.String | fieldName()Return the name of the field
return theField.name().asString();
|
java.lang.String | getMethod()Return the name of the static method on class GenericObject which
will get the field value.
return fieldTypeInfo.fieldGetMethod;
|
int | getMethodReturn()Return the return type of the get method.
return fieldTypeInfo.fieldGetReturnType;
|
java.lang.String | getMethodSig()Return the type signature of the static method on class GenericObject
which will get the field value.
return fieldTypeInfo.fieldGetMethodSig;
|
boolean | isMutableSCO()Is this persistent field's value is a second class object?
return fieldIsMutableSCO;
|
boolean | isPersistent()Is this field one which is stored persistently? This can only
be true for non-static, non-final fields.
return fieldIsPersistent;
|
boolean | isPrimaryKey()Is this persistent field primary key?
return fieldIsPrimaryKey;
|
boolean | isSynthetic()Is the field a synthetic field?
This is a java 1.1'ism for nested classes
return theField.attributes().findAttribute("Synthetic") != null;//NOI18N
|
int | nDims()For array fields, return the number of dimensions in the array type
else 0.
return nFieldArrayDims;
|
java.lang.String | setMethod()Return the name of the static method on class GenericObject which
will set the field value.
return fieldTypeInfo.fieldSetMethod;
|
int | setMethodArg()Return the type of arg expected by the set method.
return fieldTypeInfo.fieldSetArgType;
|
java.lang.String | setMethodSig()Return the type signature of the static method on class GenericObject
which will set the field value.
return fieldTypeInfo.fieldSetMethodSig;
|
java.lang.String | typeDescriptor()Get the VM type descriptor field string for the field type
return theField.signature().asString();
|
java.lang.String | typeName()Get the VM type name field string for the field type
This is the same as the type descriptor except when it is
a non-array class - in this case, the leading 'L' and trailing
';' need to be removed.
String typeDesc = typeDescriptor();
if (typeDesc.charAt(0) == 'L")
return typeDesc.substring(1, typeDesc.length() - 1);
return typeDesc;
|
java.lang.String | userFieldName()Return a user consumable field name
return ca.userClassName() + "." + theField.name().asString();//NOI18N
|
private java.lang.String | userSig(java.lang.String vmSig)Return a user consumable signature
// Stub: just return vm sig for now
return Descriptor.userFieldSig(vmSig);
|