try {
String value = this.extFields.get(fieldName);
if (null == value) {
Annotation annotation = field.getAnnotation(CFNotNull.class);
if (annotation != null) {
throw new RemotingCommandException("the custom field <" + fieldName
+ "> is null");
}
continue;
}
field.setAccessible(true);
String type = field.getType().getCanonicalName();
Object valueParsed = null;
if (type.equals(StringName)) {
valueParsed = value;
}
else if (type.equals(IntegerName1) || type.equals(IntegerName2)) {
valueParsed = Integer.parseInt(value);
}
else if (type.equals(LongName1) || type.equals(LongName2)) {
valueParsed = Long.parseLong(value);
}
else if (type.equals(BooleanName1) || type.equals(BooleanName2)) {
valueParsed = Boolean.parseBoolean(value);
}
else if (type.equals(DoubleName1) || type.equals(DoubleName2)) {
valueParsed = Double.parseDouble(value);
}
else {
throw new RemotingCommandException("the custom field <" + fieldName
+ "> type is not supported");
}
field.set(objectHeader, valueParsed);