@Override
void evaluatePersistentCopy(ClassDescriptor classDescriptor, ObjectDataContainer dataContainer, FieldRecord record, JODBOperationContext context) throws IOException
{
Class originClass = getObject().getClass();
if(record!=null && record._category == FIELD_CATEGORIES.PRIMITIVE){
COMPARE_RESULT compareResult;
if(!PrimitiveJavaTypesUtil.isPrimitiveWrapper(originClass)){
compareResult = COMPARE_RESULT.UNKNOWN;
}else{
PRIMITIVES_ENUMERATION fieldTypeEnum = PrimitiveJavaTypesUtil.getEnumeratedType(record._fieldTypeID, context.getBase());
compareResult = PrimitiveJavaTypesUtil.compare(_constraintOrigin, record, fieldTypeEnum);
}
processCompareResult(compareResult);
return;
}
if(dataContainer!=null){
Class persistentObjectClass;
try {
persistentObjectClass = context.getSession().resolveClassForID(dataContainer.getOriginalClassType());
} catch (ClassNotFoundException e) {
//TODO debug output???
throw new JodbIOException(e);
}
if(originClass!=persistentObjectClass){
processCompareResult(COMPARE_RESULT.UNKNOWN);
return;
}
IClassProcessor processor = JODBPluginRegistry.getInstance().getClassProcessor(originClass);
if(_type == CONSTRAINT_TYPE.EQUAL || _type == CONSTRAINT_TYPE.NOT){//equals methods can be better optimized
boolean equal = processor.equals(getTranslatedOrigin(), dataContainer, context, null);
processCompareResult(equal? COMPARE_RESULT.EQUAL : COMPARE_RESULT.SMALLER);
return;
}else{
COMPARE_RESULT compareResult = processor.compare(getTranslatedOrigin(), dataContainer, context, null, originClass);
processCompareResult(compareResult);
return;
}
}