Class clazz,
SpeedoField sp,
ClassMapping cm,
JormMIMappingBuilder mb)throws SpeedoException, PException {
SpeedoExtension se = sp.getExtensionByKey(SpeedoProperties.FIELD_CONVERTER);
PType ptype = null;
String className = null;
if (se != null) {
try {
UserFieldMapping ufm = (UserFieldMapping)
java.lang.Class.forName(se.value).newInstance();
ptype = getPrimitivePType(ufm.getStorageType().getName());
if (ptype == null) {
className = ufm.getStorageType().getName();
}
} catch (Exception e) {
throw new SpeedoException(
"Impossible to instanciate the UserFieldMapping class '"
+ se.value + "' for the field '" + sp.name
+ "' of the class '" + sc.getFQName() + "':", e);
}
} else {
Type type = Type.getType(sp.type);
ptype = getPrimitivePType(type);
if (ptype == null) {
className = type.getClassName();
}
}
if (ptype == null) {
if (isPersistentClass(className, sc.moPackage.name, manager)) {
//JM of a reference field will be defined later.
return;
} else {
logger.log(BasicLevel.INFO, "The field '" + sc.getFQName()
+ "." + sp.name + " is managed as a Serialized field.");
ptype = PTypeSpace.SERIALIZED;
}
}
logger.log(BasicLevel.DEBUG, "primitive field: " + sp.name + " / javatype: " + ptype.getJavaName());
se = sp.getExtensionByKey(SpeedoProperties.SIZE);
int size = PType.NOSIZE;
if (se != null) {
try {
size = Integer.parseInt(se.value);