/**
* Copyright (C) 2001-2004 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.objectweb.speedo.generation.generator.lib;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.context.Context;
import org.objectweb.asm.Constants;
import org.objectweb.asm.Type;
import org.objectweb.jorm.generator.lib.CommonHelper;
import org.objectweb.jorm.lib.JormPathHelper;
import org.objectweb.jorm.metainfo.api.Class;
import org.objectweb.jorm.metainfo.api.ClassProject;
import org.objectweb.jorm.metainfo.api.ClassRef;
import org.objectweb.jorm.metainfo.api.GenClassRef;
import org.objectweb.jorm.metainfo.api.Mapping;
import org.objectweb.jorm.metainfo.api.NameDef;
import org.objectweb.jorm.metainfo.api.Reference;
import org.objectweb.jorm.metainfo.api.TypedElement;
import org.objectweb.jorm.type.api.PType;
import org.objectweb.speedo.api.SpeedoException;
import org.objectweb.speedo.api.SpeedoProperties;
import org.objectweb.speedo.api.UserFieldMapping;
import org.objectweb.speedo.genclass.SupportedGenClass;
import org.objectweb.speedo.generation.api.SpeedoCompilerParameter;
import org.objectweb.speedo.generation.lib.NamingRules;
import org.objectweb.speedo.lib.Personality;
import org.objectweb.speedo.metadata.SpeedoArray;
import org.objectweb.speedo.metadata.SpeedoClass;
import org.objectweb.speedo.metadata.SpeedoCollection;
import org.objectweb.speedo.metadata.SpeedoExtension;
import org.objectweb.speedo.metadata.SpeedoFetchGroup;
import org.objectweb.speedo.metadata.SpeedoField;
import org.objectweb.speedo.metadata.SpeedoMap;
import org.objectweb.speedo.metadata.SpeedoNullValue;
import org.objectweb.speedo.metadata.SpeedoVersion;
import org.objectweb.speedo.mim.api.FetchPlanItf;
import org.objectweb.util.monolog.api.BasicLevel;
/**
*
* @author S.Chassande-Barrioz
*/
public abstract class AbstractSpeedoGenerator
extends AbstractVelocityGenerator
implements SupportedGenClass {
protected static CommonHelper jormTools = new CommonHelper();
public AbstractSpeedoGenerator(Personality p) {
super(p);
}
public Map getContextAsMap(SpeedoClass moClass) throws SpeedoException {
int nbField = moClass.computeFieldNumbers();
Map ctx = new HashMap();
//creation of the Velocity context
ctx.put("helper", this);
ctx.put("isNotAbstract", new Boolean(!moClass.isAbstract));
ctx.put("isAbstract", new Boolean(moClass.isAbstract));
ctx.put("withLog", new Boolean(!moClass.isAbstract));
ctx.put("package", moClass.moPackage.name);
ctx.put("mapper", scp.mapperName);
ctx.put("projectName", scp.projectName);
ctx.put("isSerializable", new Boolean(moClass.isSerializable));
ctx.put("detachable", new Boolean(moClass.isDetachable));
//class name
ctx.put("baseClassName", moClass.name);
ctx.put("classNameMapping", NamingRules.mappingName(moClass.name));
ctx.put("classNameFields", NamingRules.fieldsName(moClass.name));
ctx.put("classNameHome", NamingRules.homeName(moClass.name));
ctx.put("classNameKey", NamingRules.keyName(moClass.name));
ctx.put("classNameAccessor", NamingRules.accessorName(moClass.name));
//inheritance
ctx.put("hasSuperclass", Boolean.valueOf(moClass.getSuperClassName() != null));
ctx.put("superClassName", moClass.getSuperClassName());
ctx.put("hasSubClasses", Boolean.valueOf(
!moClass.jormclass.getSubClasses().isEmpty()));
//Identity type
if (moClass.identity.isDataStore()) {
ctx.put("isContainerId", Boolean.TRUE);
ctx.put("isContainerIdValue", "true");
} else {
ctx.put("isContainerId", Boolean.FALSE);
ctx.put("isContainerIdValue", "false");
}
String gcpnamehints = scp.nmf.getNamingManager(moClass).getGCPNameHints(
moClass, getClassNameDef(moClass.jormclass));
ctx.put("gcPNameHints", gcpnamehints);
//version strategy
if(moClass.version != null){
ctx.put("versioningStrategy", new Byte(moClass.version.strategy));
ctx.put("isDatetime", (moClass.version.strategy == SpeedoVersion.DATE_TIME)?Boolean.TRUE:Boolean.FALSE);
ctx.put("isVersioned", Boolean.TRUE);
ctx.put("versionString", "Speedo" + SpeedoVersion.toString(moClass.version.strategy));
}
else{
ctx.put("versioningStrategy", new Byte(SpeedoVersion.NO_VERSION));
ctx.put("isVersioned", Boolean.FALSE);
}
// persistent fields
List fields = new ArrayList(moClass.fields.size());
ctx.put("fields", fields);
List referenceFields = new ArrayList(moClass.fields.size());
ctx.put("referenceFields", referenceFields);
List primitiveFields = new ArrayList(moClass.fields.size());
ctx.put("primitiveFields", primitiveFields);
List fieldsToSerialize = new ArrayList(moClass.fields.size());
ctx.put("fieldsToSerialize", fieldsToSerialize);
StringBuffer maxLongVals = new StringBuffer("new long[]{");
String sep = "";
int ndlong = (moClass.computeFieldNumbers() / 64) + 1;
for (int i = 0; i < ndlong; i++) {
maxLongVals.append(sep);
maxLongVals.append("0xffffffffffffffffL");
sep = ", ";
}
maxLongVals.append("}");
ctx.put("serializedFieldsId", maxLongVals);
ctx.put("declLong", "long[]");
ctx.put("useofLong", "fields");
boolean hasRef = false;
ctx.put("needSpeedoGenClassListener", new Boolean(false));
for (Iterator it = moClass.fields.values().iterator(); it.hasNext();) {
SpeedoField sp = (SpeedoField) it.next();
Field f = new Field();
fields.add(f);
if ((sp.visibility & Constants.ACC_TRANSIENT) == 0
&& (sp.visibility & Constants.ACC_STATIC) == 0) {
fieldsToSerialize.add(f);
}
fillFieldInfo(f, sp, nbField, ctx);
hasRef = hasRef || !f.isClassical;
if (f.isReference) {
referenceFields.add(f);
} else {
primitiveFields.add(f);
}
}
// add the fetchgroups defined for this class into the context
List fetchGroups = new ArrayList(moClass.fetchGroups.size());
boolean defaultRedefined = false;
boolean valuesRedefined = false;
ctx.put("fetchGroups", fetchGroups);
for (Iterator it = moClass.fetchGroups.values().iterator(); it.hasNext();) {
SpeedoFetchGroup sfg = (SpeedoFetchGroup) it.next();
if(sfg.name.equals(FetchPlanItf.DEFAULT))
defaultRedefined = true;
else if(sfg.name.equals(FetchPlanItf.VALUES))
valuesRedefined = true;
FetchGroup fg = new FetchGroup();
fetchGroups.add(fg);
fillFetchGroupInfo(fg, sfg);
}
ctx.put("defaultRedefined", new Boolean(defaultRedefined));
ctx.put("valuesRedefined", new Boolean(valuesRedefined));
ctx.put("hasRef", new Boolean(hasRef));
return ctx;
}
protected final Context getContext(SpeedoClass jdoClass) throws SpeedoException {
Map m = getContextAsMap(jdoClass);
Context vctx = new VelocityContext();
for(Iterator it = m.entrySet().iterator(); it.hasNext();) {
Map.Entry me = (Map.Entry) it.next();
vctx.put((String) me.getKey(), me.getValue());
}
return vctx;
}
public void fillFetchGroupInfo(FetchGroup fg, SpeedoFetchGroup sfg) throws SpeedoException {
fg.name = sfg.name;
fg.postload = sfg.postLoad;
//add the list of Field to load with this fetchgroup
fg.fields = new ArrayList( sfg.getFields().size());
Iterator it = sfg.getFields().values().iterator();
while(it.hasNext()){
SpeedoField sf = (SpeedoField) it.next();
Field f = new Field();
fg.fields.add(f);
fillFieldInfo4FetchGroup(f, sf);
}
//add the names of the nested fetchgroups
fg.nestedFetchGroups = new ArrayList(sfg.getNestedFetchGroups().size());
Iterator itFG = sfg.getNestedFetchGroups().keySet().iterator();
while(itFG.hasNext()){
fg.nestedFetchGroups.add(itFG.next());
}
}
public void fillFieldInfo4FetchGroup(Field f, SpeedoField sf){
f.name = sf.name;
f.depth = sf.depth;
f.fetchGroup = sf.fetchGroup;
if(f.fetchGroup != null)
f.name += SpeedoFetchGroup.FG_SLASH + f.fetchGroup;
if(f.depth > 0)
f.name += SpeedoFetchGroup.FG_AT + f.depth;
}
public void fillFieldInfo(Field f,
SpeedoField sp,
int nbField,
Map ctx) throws SpeedoException {
SpeedoClass moClass = sp.moClass;
f.name = sp.name;
TypedElement te = moClass.jormclass.getTypedElement(f.name);
f.type = sp.type();
f.jvmType = sp.type;
f.nameUpperFirst = Character.toUpperCase(f.name.charAt(0))
+ f.name.substring(1);
f.number = sp.number;
f.getter = NamingRules.getterName(sp.moClass, sp.name);
f.setter = NamingRules.setterName(sp.moClass, sp.name);
f.isClassical = isClassicalType(sp.type());
f.modifier = sp.modifier();
f.isKey = sp.primaryKey;
f.jormmeth = jormTools.upperFL(te.getName());
f.jormfield = te.getName();
f.isNotauthorizedToBeNull = (sp.nullValue == SpeedoNullValue.EXCEPTION);
f.declaration = sp.publicSignature();
f.defaultFetchGroup = sp.defaultFetchGroup;
String cacheName = sp.getExtensionValueByKey(SpeedoProperties.USER_CACHE);
if (cacheName != null) {
f.userCacheNames = Collections.singleton(cacheName);
} else {
f.userCacheNames = Collections.EMPTY_SET;
}
// looks for identity type of the field and tests if it is an array
Type fieldType = Type.getReturnType(sp.type);
if (!f.isClassical && fieldType.getSort() == Type.OBJECT) {
SpeedoClass jdoclass = scp.smi.getSpeedoClass(
fieldType.getClassName(),
sp.moClass.moPackage.xmlDescriptor);
if (jdoclass != null) {
f.isContainerId = jdoclass.identity.isDataStore();
} else {
f.isContainerId = true;
}
f.isArray = false;
} else {
f.isArray = sp.jdoTuple instanceof SpeedoArray;
}
f.jormMeth = jormTools.upperFL(f.name);
//Field Id
f.jormFieldIdLongPos = sp.number / 64;
f.jormFieldId = 1L << (sp.number % 64);
f.jormFielIdDecl = "new long[]{";
String sep = "";
for (int i = 0; i <= (nbField / 64); i++) {
f.jormFielIdDecl += sep + (i == f.jormFieldIdLongPos
? f.jormFieldId + "L" : "0L");
sep = ", ";
}
f.jormFielIdDecl += "}";
f.isReference = jormTools.isReference(te);
if (f.isReference) { //reference field
fillReferenceInfo(f, sp, te, ctx, fieldType);
} else { //primitive field
f.jormType = te.getType().getJavaName();
f.memoryType = sp.type();
f.jormcast = sp.type();
f.toMemory = "val";
if (te.getType().getTypeCode() == PType.TYPECODE_SERIALIZED) {
f.toMemory = "(" + f.memoryType + ")" + f.toMemory;
}
f.toStorage = f.name;
fillUserFieldMappingInfo(f, sp);
}
}
public void fillReferenceInfo(Field f,
SpeedoField sp,
TypedElement te,
Map ctx,
Type asmType) throws SpeedoException {
f.jormType = "Object";
f.isMultiValued = jormTools.isGenClassRef(te);
f.depth = sp.depth;
//Jorm Cast
if (f.isMultiValued) {
if (sp.jdoTuple instanceof SpeedoCollection) {
f.jormcast = "java.util.Collection";
} else if (sp.jdoTuple instanceof SpeedoMap) {
f.jormcast = "java.util.Map";
f.isMap = true;
} else if (sp.jdoTuple instanceof SpeedoArray) {
f.jormcast = te.getType().getJormName() + "[]";
} else {
f.jormcast = "Object";
}
String[] s = getCollectionClass(asmType, scp.personality);
f.memoryType = s[0];
f.gcproxy = s[1];
f.gcJDKImpl = s[2];
GenClassRef gcr = (GenClassRef) te;
if (gcr.isClassRef()) {
f.accessorClassName = NamingRules.fieldsName(gcr.getClassRef().getMOClass().getFQName());
}
} else {
f.jormcast = te.getType().getJormName();
f.memoryType = te.getType().getJormName();
f.accessorClassName = NamingRules.fieldsName(f.memoryType);
}
f.linkedField = getLinkedField((Reference) te);
//Cascade delete
f.isCascadeDelete = sp.isCascadeDelete;
fillRelationInfo(f, sp, te, ctx, asmType);
}
public void fillRelationInfo(Field f,
SpeedoField sp,
TypedElement te,
Map ctx,
Type asmType) throws SpeedoException {
if (sp.relationType == SpeedoField.NO_BI_RELATION) {
return;
}
SpeedoClass jdoClass = sp.moClass;
f.reverse = sp.reverseField;
f.reverseGetter = NamingRules.getterName(null, sp.reverseField);
f.reverseSetter = NamingRules.setterName(null, sp.reverseField);
f.coherentSetter = NamingRules.coherentSetterName(sp.moClass, sp.name);
SpeedoClass otherClass = null;
switch (sp.relationType) {
case SpeedoField.ONE_ONE_BI_RELATION:
f.is11Relation = true;
otherClass = jdoClass.moPackage.xmlDescriptor.getSpeedoClass(sp.type(), true);
break;
case SpeedoField.ONE_MANY_BI_RELATION:
f.is1MRelation = true;
if (sp.jdoTuple instanceof SpeedoCollection) {
f.elemType = (String) ((SpeedoCollection) sp.jdoTuple).elementType;
} else if (sp.jdoTuple instanceof SpeedoMap) {
f.elemType = (String) ((SpeedoMap) sp.jdoTuple).valueType;
f.keyField = NamingRules.getterName(null,
sp.getExtensionValueByKey(SpeedoProperties.KEY_FIELD))
+ "()";
} else {
throw new SpeedoException(
"Unmanaged relation with this multivalued field: "
+ sp.jdoTuple);
}
if (f.elemType.indexOf('.') == -1) {
f.elemType = jdoClass.moPackage.name + '.' + f.elemType;
}
otherClass = jdoClass.moPackage.xmlDescriptor.getSpeedoClass(f.elemType, true);
ctx.put("needSpeedoGenClassListener", new Boolean(true));
break;
case SpeedoField.MANY_ONE_BI_RELATION:
f.isM1Relation = true;
// speedoClass corresponding to sp.type()
otherClass = jdoClass.moPackage.xmlDescriptor.getSpeedoClass(sp.type(), true);
f.reverseField = otherClass.getField(f.reverse);
// number of the reverse field
f.reverseNumber = f.reverseField.number;
if (f.reverseField.jdoTuple instanceof SpeedoMap) {
f.reverseIsMap = true;
String reverseKeyFieldName = f.reverseField.getExtensionValueByKey(SpeedoProperties.KEY_FIELD);
f.reverseKField = jdoClass.getField(reverseKeyFieldName);
f.reverseKeyField = NamingRules.getterName(null,reverseKeyFieldName) + "()";
}
break;
case SpeedoField.MANY_MANY_BI_RELATION:
f.isMMRelation = true;
f.reverseIsMap = sp.jdoTuple instanceof SpeedoMap;
f.elemType = (String) ((SpeedoCollection) sp.jdoTuple).elementType;
if (f.elemType.indexOf('.') == -1) {
f.elemType = jdoClass.moPackage.name + '.' + f.elemType;
}
// speedoClass corresponding to f.elemType
otherClass = jdoClass.moPackage.xmlDescriptor.getSpeedoClass(f.elemType, true);
// number of the reverse field
ctx.put("needSpeedoGenClassListener", new Boolean(true));
break;
}
f.reverseField = otherClass.getField(f.reverse);
f.reverseNumber = f.reverseField.number;
}
public void fillUserFieldMappingInfo(Field f, SpeedoField sp)
throws SpeedoException {
SpeedoExtension se =
sp.getExtensionByKey(SpeedoProperties.FIELD_CONVERTER);
if (se == null) {
return;
}
f.userFieldMapping = se.value;
UserFieldMapping ufm = null;
try {
ufm = (UserFieldMapping) java.lang.Class.forName(se.value)
.newInstance();
} catch (Exception e) {
throw new SpeedoException(
"Impossible to instanciate the UserFieldMapping class '"
+ se.value + "' for the field '" + sp.name
+ "' of the class '" + sp.moClass.getFQName() + "':", e);
}
if (ufm.getStorageType().isPrimitive()) {
f.toMemory = "new "
+ getJavaLangType(ufm.getStorageType())
+ "(" + f.toMemory + ")";
}
if (ufm.getMemoryType().isPrimitive()) {
f.toStorage = "new "
+ getJavaLangType(ufm.getMemoryType())
+ "(" + f.toStorage + ")";
}
f.toMemory = f.name + "UFM.toMemory(" + f.toMemory + ")";
f.toStorage = f.name + "UFM.toStorage(" + f.toStorage + ")";
if (ufm.getStorageType().isPrimitive()) {
f.toStorage = "(("
+ getJavaLangType(ufm.getStorageType())
+ ") " + f.toStorage + ")."
+ getValueGetter(ufm.getStorageType()) + "()";
} else {
f.toStorage = "("
+ ufm.getStorageType().getName()
+ ") " + f.toStorage;
}
if (ufm.getMemoryType().isPrimitive()) {
f.toMemory = "(("
+ getJavaLangType(ufm.getMemoryType())
+ ") " + f.toMemory + ")."
+ getValueGetter(ufm.getMemoryType()) + "()";
} else {
f.toMemory = "("
+ ufm.getMemoryType().getName()
+ ") " + f.toMemory;
}
}
private String getLinkedField(Reference r) {
String res = null;
if (r instanceof GenClassRef) {
res = JormPathHelper.getPath((GenClassRef) r, false);
} else if (r instanceof ClassRef) {
res = JormPathHelper.getPath((ClassRef) r);
}
return res;
}
protected String getValueGetter(java.lang.Class c) {
return c.getName() + "Value";
}
public final java.lang.Class[][] PRIMITIVE_TYPES = {
{Boolean.TYPE, Boolean.class},
{Byte.TYPE, Byte.class},
{Character.TYPE, Character.class},
{Short.TYPE, Short.class},
{Integer.TYPE, Integer.class},
{Long.TYPE, Long.class},
{Float.TYPE, Float.class},
{Double.TYPE, Double.class}
};
protected String getJavaLangType(java.lang.Class c) {
for (int i = 0; i < PRIMITIVE_TYPES.length; i++) {
if (c == PRIMITIVE_TYPES[i][0]) {
return PRIMITIVE_TYPES[i][1].getName();
}
}
return null;
}
protected String[] getCollectionClass(Type fieldtype, Personality pers) {
String[] res = new String[3];
res[0] = fieldtype.getClassName();
for (int i = 0; i < GC_IMPL.length && res[1] == null; i++) {
if (GC_IMPL[i][0].equals(res[0])) {
res[1] = pers.getGenClassName(GC_IMPL[i][1]);
res[2] = GC_IMPL[i][2];
}
}
if (res[1] == null) {
logger.log(BasicLevel.ERROR, "Type " + res[0]
+ " is not supported for a persistent field");
}
return res;
}
public String getPNameGetter(PType type) {
switch (type.getTypeCode()) {
case PType.TYPECODE_CHAR:
return "pngetCharField";
case PType.TYPECODE_OBJCHAR:
return "pngetOcharField";
case PType.TYPECODE_BYTE:
return "pngetByteField";
case PType.TYPECODE_OBJBYTE:
return "pngetObyteField";
case PType.TYPECODE_SHORT:
return "pngetShortField";
case PType.TYPECODE_OBJSHORT:
return "pngetOshortField";
case PType.TYPECODE_INT:
return "pngetIntField";
case PType.TYPECODE_OBJINT:
return "pngetOintField";
case PType.TYPECODE_LONG:
return "pngetLongField";
case PType.TYPECODE_OBJLONG:
return "pngetOlongField";
case PType.TYPECODE_STRING:
return "pngetStringField";
case PType.TYPECODE_DATE:
return "pngetDateField";
case PType.TYPECODE_CHARARRAY:
return "pngetCharArrayField";
case PType.TYPECODE_BYTEARRAY:
return "pngetByteArrayField";
default :
return null;
}
}
protected Mapping getMapping(Class clazz) throws SpeedoException {
return getMapping(clazz, scp);
}
public static Mapping getMapping(Class clazz, SpeedoCompilerParameter scp) throws SpeedoException {
ClassProject cp = clazz.getClassProject(scp.projectName);
if (cp == null) {
throw new SpeedoException("No classproject found for the class "
+ clazz.getFQName() + " and the project " + scp.projectName);
}
int idx = scp.mapperName.indexOf('.');
Mapping m = cp.getMapping(idx == -1
? scp.mapperName
: scp.mapperName.substring(0, idx));
if (m == null) {
throw new SpeedoException("No mapping found for the class "
+ clazz.getFQName() + ", the project " + scp.projectName
+ " and the mapper " + scp.mapperName);
}
return m;
}
protected NameDef getClassNameDef(Class clazz) throws SpeedoException {
return getClassNameDef(clazz, scp);
}
public static NameDef getClassNameDef(Class clazz,
SpeedoCompilerParameter scp) throws SpeedoException {
return getMapping(clazz, scp).getClassMapping()
.getIdentifierMapping().getNameDef();
}
protected Map computeUserCaches(SpeedoClass sc) {
Map userCaches = new HashMap();
computeUserCaches(sc, userCaches, true);
for (Iterator iter = userCaches.values().iterator(); iter.hasNext();) {
List element = (List) iter.next();
Collections.sort(element, new Comparator() {
public int compare(Object o1, Object o2) {
return ((SpeedoField) o1).name.compareTo(((SpeedoField) o2).name);
}
});
}
return userCaches;
}
protected void computeUserCaches(SpeedoClass sc, Map userCaches, boolean addNew) {
for(Iterator it = sc.fields.values().iterator(); it.hasNext();) {
SpeedoField sf = (SpeedoField) it.next();
String cacheName = sf.getExtensionValueByKey(SpeedoProperties.USER_CACHE);
if (cacheName == null) {
continue;
}
List sfs = (List) userCaches.get(cacheName);
if (sfs == null) {
if (!addNew) {
continue;
}
sfs = new ArrayList();
userCaches.put(cacheName, sfs);
}
sfs.add(sf);
}
if (sc.getSuperClassName() != null) {
computeUserCaches(sc.getSuper(), userCaches, true);
}
}
public class Field {
protected String name;
public String nameUpperFirst;
public long number;
public String getter;
public String setter;
public String coherentSetter;
public String reverse;
public int reverseNumber;
public SpeedoField reverseField;
public String reverseGetter;
public String reverseSetter;
public String modifier;
public boolean isClassical;
public boolean isContainerId;
public boolean isArray;
public String declaration;
public boolean isKey;
public String jormMeth;
public int jormFieldIdLongPos;
public long jormFieldId;
public String jormFielIdDecl;
public String jormType;
public String linkedField;
public String memoryType;
public String elemType;
public boolean isMultiValued = false;
public boolean isReference = false;
public boolean is11Relation = false;
public boolean is1MRelation = false;
public boolean isM1Relation = false;
public boolean isMMRelation = false;
public boolean isMap;
public boolean reverseIsMap;
public String reverseKeyField;
public SpeedoField reverseKField;
public String keyField;
public String toMemory = null;
public String toStorage = null;
public String userFieldMapping = null;
public boolean isCascadeDelete = false;
public int depth;
public String fetchGroup;
public boolean defaultFetchGroup;
protected String jormfield;
protected String jormcast;
protected String jormmeth;
protected String type;
protected boolean isNotauthorizedToBeNull = false;
/**
* The name of the SpeedoGenClassPO class to use
*/
public String gcproxy;
public String gcJDKImpl;
public String accessorClassName;
/**
* The name of the user cache which the index contains this field
*/
public Collection userCacheNames;
public String jvmType;
public String getNameUpperFirst() {
return nameUpperFirst;
}
public void setNameUpperFirst(String nameUpperFirst) {
this.nameUpperFirst = nameUpperFirst;
}
public boolean getIsReference() {
return isReference;
}
public int getJormFieldIdLongPos() {
return jormFieldIdLongPos;
}
public String getGcproxy() {
return gcproxy;
}
public String getGcJDKImpl() {
return gcJDKImpl;
}
public String getName() {
return name;
}
public long getNumber() {
return number;
}
public String getGetter() {
return getter;
}
public String getSetter() {
return setter;
}
public String getModifier() {
return modifier;
}
public boolean isClassical() {
return isClassical;
}
public boolean isContainerId() {
return isContainerId;
}
public boolean isArray() {
return isArray;
}
public boolean getIsRelation() {
return is11Relation || is1MRelation || isM1Relation || isMMRelation;
}
public boolean getIs11Relation() {
return is11Relation;
}
public boolean getIs1MRelation() {
return is1MRelation;
}
public boolean getIsM1Relation() {
return isM1Relation;
}
public boolean getIsMMRelation() {
return isMMRelation;
}
public boolean getIsxMRelation() {
return is1MRelation || isMMRelation;
}
public boolean getIsMap() {
return isMap;
}
public boolean getReverseIsMap() {
return reverseIsMap;
}
public boolean getDefaultFetchGroup(){
return defaultFetchGroup;
}
public String getReverseKeyField() {
return reverseKeyField;
}
public String getReverse() {
return reverse;
}
public boolean getIsCascadeDelete() {
return isCascadeDelete;
}
public int getReverseNumber() {
return reverseNumber;
}
public String getReverseGetter() {
return reverseGetter;
}
public String getReverseSetter() {
return reverseSetter;
}
public String getCoherentSetter() {
return coherentSetter;
}
public String getDeclaration() {
return declaration;
}
public boolean isKey() {
return isKey;
}
public String getJormMeth() {
return jormMeth;
}
public long getJormFieldId() {
return jormFieldId;
}
public String getJormType() {
return jormType;
}
public String getLinkedField() {
return linkedField;
}
public String getMemoryType() {
return memoryType;
}
public String getElemType() {
return elemType;
}
public boolean getIsMultiValued() {
return isMultiValued;
}
public String getJormFielIdDecl() {
return jormFielIdDecl;
}
public String getToMemory() {
return toMemory;
}
public String getToStorage() {
return toStorage;
}
public String getUserFieldMapping() {
return userFieldMapping;
}
public String getJormfield() {
return jormfield;
}
public String getJormcast() {
return jormcast;
}
public String getJormmeth() {
return jormmeth;
}
public String getType() {
return type;
}
public boolean getIsNotauthorizedToBeNull() {
return isNotauthorizedToBeNull;
}
public String getKeyField() {
return keyField;
}
public int getDepth() {
return depth;
}
public String getFetchGroup() {
return fetchGroup;
}
public String getAccessorClassName() {
return accessorClassName;
}
public Collection getUserCacheNames() {
return userCacheNames;
}
}
public class FetchGroup{
public String name;
public boolean postload;
/**
* The list of names of the nested fetchgroups
*/
public List nestedFetchGroups;
public List fields;
public List getFields() {
return fields;
}
public String getName() {
return name;
}
public List getNestedFetchGroups() {
return nestedFetchGroups;
}
public boolean isPostload() {
return postload;
}
}
}