Esempio n. 1
0
 private Object newInstance(Class clazz) {
   ReflectClass classReflector = reflector().forClass(clazz);
   Object obj = classReflector.newInstance();
   if (obj == null) {
     throw new IllegalArgumentException("No usable constructor for Class " + clazz);
   }
   return obj;
 }
Esempio n. 2
0
 protected void assertNullItem(Object obj) throws Exception {
   ReflectClass claxx = reflector().forObject(obj);
   ReflectField[] fields = claxx.getDeclaredFields();
   for (int i = 0; i < fields.length; ++i) {
     ReflectField field = fields[i];
     if (field.isStatic() || field.isTransient()) {
       continue;
     }
     ReflectClass type = field.getFieldType();
     if (container().classMetadataForReflectClass(type).isValueType()) {
       continue;
     }
     Object value = field.get(obj);
     Assert.isNull(value);
   }
 }