public int compare(Class<?> src,
Class<?> target) {
Asserts.assertNotNull(src, "src parameter can not be null");
Asserts.assertNotNull(target, "target parameter can not be null");
int srcIndex = enabledDecorators.indexOf(src);
int targetIndex = enabledDecorators.indexOf(target);
if (srcIndex == -1 || targetIndex == -1)
{
throw new IllegalArgumentException("One of the compare class of the list : [" + src.getName() + "," + target.getName() + "]" + " is not contained in the enabled decorators list!");
}
if (srcIndex == targetIndex)
return 0;
else if (srcIndex < targetIndex)
return -1;
else
return 1;
}
|