TypeDescriptor pt = TypeDescriptor.getFor(value.getClass());
if (type.compareTo(pt) != 0) {
if (pt.isArray() && type.compareTo(pt.getComponentType()) == 0) {
value = Array.get(value, 0);
} else if (type.isArray() && pt.compareTo(type.getComponentType()) == 0) {
Object array = Array.newInstance(value.getClass(), 1);
Array.set(array, 0, value);
value = array;
} else {
throw new IllegalArgumentException(value + " is not of the expected annotation value type: " + type);