"bad field definition, must not have field index declaration \""
+ elts[fieldDefIndex]);
}
final ClassInfo fieldClass = classForName(fieldClassName);
final ClassInfo declaringClass = classForName(declaringClassName);
FieldInfo fieldInfo;
try {
// FIXMELUC ______known field
fieldInfo = new FieldInfo(declaringClass, fieldName,// NOPMD
fieldClass, staticField, transientField);
} catch (ClassInfoException exception) {
throw new ConversionException("bad field definition \""
+ elts[fieldDefIndex], exception);
}
conversionDefEntry.addToFieldList(fieldInfo);
}
} else {
/*
* replacement definition
*/
if (listSize < 3 || listSize > 5) {// NOPMD
throw new ConversionException("3 thru 5 elements expected for "
+ listSize + " get");
} else {
final int toIdentifier = computeIdentifier(elts[2]);
if (listSize == 3) {
conversionDefEntry = new ConversionDefEntry(originalClass,
oldIdentifier, ClassInfo.NULL, toIdentifier,
ClassInfo.NULL, ClassInfo.NULL);
} else {
final ClassInfo converterClass;
final ClassInfo staticConverterClass;
if (listSize == 5) {
final String[] converterClassDef = elts[4].split(":");
if (converterClassDef.length == 1) {
converterClass = classForName(converterClassDef[0]);
staticConverterClass = ClassInfo.NULL;
} else if (converterClassDef.length == 2
&& "static".equals(converterClassDef[0])) {
staticConverterClass = classForName(converterClassDef[1]);
converterClass = ClassInfo.NULL;
} else {
throw new ConversionException(
"bad conversion class declaration \""
+ elts[4] + "\"");
}
} else {
converterClass = ClassInfo.NULL;
staticConverterClass = ClassInfo.NULL;
}
try {
fieldDefParser.parse(elts[3]);
} catch (ConversionException exception) {
throw new ConversionException(
"bad replacemet class/field definition \""
+ elts[3] + "\"", exception);
}
final String replacementClassName = fieldDefParser
.getClassName();
if (replacementClassName == null) {
throw new ConversionException(
"bad replacement class/field definition \""
+ elts[3] + "\"");
}
final String replacementFieldName = fieldDefParser
.getFieldName();
final int replacementFieldIndex = fieldDefParser
.getFieldIndex();
final String replacementFieldClassName = normalizeClassName(fieldDefParser
.getFieldClassName());
final String replacementFieldDeclaringClassName = fieldDefParser
.getFieldDeclaringClassName();
final Boolean replacementStaticField = fieldDefParser
.getStaticField();
final Boolean replacementTransientField = fieldDefParser
.getTransientField();
final ClassInfo replacementFieldDeclaringClass;
final ClassInfo replacementClass = classForName(replacementClassName);
if (replacementFieldDeclaringClassName == null) {
replacementFieldDeclaringClass = replacementClass;
} else {
replacementFieldDeclaringClass = classForName(replacementFieldDeclaringClassName);
}
if (originalFieldName == null) {
conversionDefEntry = new ConversionDefEntry(
originalClass, oldIdentifier, replacementClass,
toIdentifier, converterClass,
staticConverterClass);
} else {
final ClassInfo originalFieldDeclaringClass;
if (originalFieldDeclaringClassName == null) {
originalFieldDeclaringClass = originalClass;
} else {
originalFieldDeclaringClass = classForName(originalFieldDeclaringClassName);
}
final ClassInfo originalFieldType;
if (originalFieldClassName == null) {
originalFieldType = ClassInfo.NULL;
} else {
originalFieldType = classForName(originalFieldClassName);
}
final FieldInfo originalFieldInfo;
try {
originalFieldInfo = new FieldInfo(
originalFieldDeclaringClass,
originalFieldName, originalFieldType,
originalStaticField, originalTransientField);
} catch (ClassInfoException exception) {
throw new ConversionException(
"bad replacement class \"" + elts[1] + "\"",
exception);
}
try {
final FieldInfo replacementFieldInfo;
if (replacementFieldName == null) {
replacementFieldInfo = null;
} else {
final ClassInfo replacementFieldType;
if (replacementFieldClassName == null) {
throw new ConversionException(
"bad replacement class/field type must be defined \""
+ elts[3] + "\"");
} else {
replacementFieldType = classForName(replacementFieldClassName);
}
replacementFieldInfo = new FieldInfo(
replacementFieldDeclaringClass,
replacementFieldName,
replacementFieldType,
replacementStaticField,
replacementTransientField);