예제 #1
0
 public Class<?> getGetterType(String name) {
   PropertyTokenizer prop = new PropertyTokenizer(name);
   if (prop.hasNext()) {
     MetaClass metaProp = metaClassForProperty(prop);
     return metaProp.getGetterType(prop.getChildren());
   } else {
     return getGetterType(prop); // issue #506. Resolve the type inside a Collection Object
   }
 }
예제 #2
0
 public Class<?> getSetterType(String name) {
   PropertyTokenizer prop = new PropertyTokenizer(name);
   if (prop.hasNext()) {
     MetaClass metaProp = metaClassForProperty(prop.getName());
     return metaProp.getSetterType(prop.getChildren());
   } else {
     return reflector.getSetterType(prop.getName());
   }
 }
예제 #3
0
 public boolean hasGetter(String name) {
   PropertyTokenizer prop = new PropertyTokenizer(name);
   if (prop.hasNext()) {
     if (reflector.hasGetter(prop.getName())) {
       MetaClass metaProp = metaClassForProperty(prop);
       return metaProp.hasGetter(prop.getChildren());
     } else {
       return false;
     }
   } else {
     return reflector.hasGetter(prop.getName());
   }
 }
예제 #4
0
 private Class<?> getGetterType(PropertyTokenizer prop) {
   Class<?> type = reflector.getGetterType(prop.getName());
   if (prop.getIndex() != null && Collection.class.isAssignableFrom(type)) {
     Type returnType = getGenericGetterType(prop.getName());
     if (returnType instanceof ParameterizedType) {
       Type[] actualTypeArguments = ((ParameterizedType) returnType).getActualTypeArguments();
       if (actualTypeArguments != null && actualTypeArguments.length == 1) {
         returnType = actualTypeArguments[0];
         if (returnType instanceof Class) {
           type = (Class<?>) returnType;
         } else if (returnType instanceof ParameterizedType) {
           type = (Class<?>) ((ParameterizedType) returnType).getRawType();
         }
       }
     }
   }
   return type;
 }
예제 #5
0
 private StringBuilder buildProperty(String name, StringBuilder builder) {
   PropertyTokenizer prop = new PropertyTokenizer(name);
   if (prop.hasNext()) {
     String propertyName = reflector.findPropertyName(prop.getName());
     if (propertyName != null) {
       builder.append(propertyName);
       builder.append(".");
       MetaClass metaProp = metaClassForProperty(propertyName);
       metaProp.buildProperty(prop.getChildren(), builder);
     }
   } else {
     String propertyName = reflector.findPropertyName(name);
     if (propertyName != null) {
       builder.append(propertyName);
     }
   }
   return builder;
 }