Exemple #1
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());
   }
 }
Exemple #2
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());
   }
 }
Exemple #3
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;
 }
Exemple #4
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;
 }