beanInfo = Introspector.getBeanInfo(cls);
PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
Map<Integer, String> order = new HashMap<Integer, String>();
int max = 0;
for (PropertyDescriptor prop : descriptors) {
Field read = prop.getReadMethod().getAnnotation(Field.class);
Field write = prop.getReadMethod().getAnnotation(Field.class);
if (read != null || write != null) {
int fieldNo = read == null ? write.value() : read.value();
if (order.put(fieldNo, prop.getName()) != null) {
throw new IllegalArgumentException(fieldNo + " used more than once in " + cls);
}
if (fieldNo < 0) {
throw new IllegalArgumentException(fieldNo + " should be non negative in " + cls);