Exemplo n.º 1
0
 /**
  * Returns a map of all method info setters on the specified class type info.
  *
  * @param classTypeInfo the class type info
  * @return an iterable of the method info setters
  * @throws NullPointerException if the specified class type info is null
  */
 public Map<String, Set<MethodInfo>> getSetterMap(ClassTypeInfo classTypeInfo)
     throws NullPointerException {
   Map<String, Set<MethodInfo>> setterMap = new LinkedHashMap<String, Set<MethodInfo>>();
   for (MethodInfo setter : getSetters(classTypeInfo)) {
     String name = Introspector.decapitalize(setter.getName().substring(3));
     Set<MethodInfo> setters = setterMap.get(name);
     if (setters == null) {
       setters = new LinkedHashSet<MethodInfo>();
       setterMap.put(name, setters);
     }
     setters.add(setter);
   }
   return setterMap;
 }
Exemplo n.º 2
0
 /**
  * Returns a map of all method info getters on the specified class type info.
  *
  * @param classTypeInfo the class type info
  * @return an iterable of the method info getters
  * @throws NullPointerException if the specified class type info is null
  */
 public Map<String, MethodInfo> getGetterMap(ClassTypeInfo classTypeInfo)
     throws NullPointerException {
   if (classTypeInfo == null) {
     throw new NullPointerException();
   }
   Map<String, MethodInfo> getterMap = new LinkedHashMap<String, MethodInfo>();
   for (MethodInfo getter : getGetters(classTypeInfo)) {
     String getterName = getter.getName();
     String name;
     if (getterName.startsWith("get")) {
       name = Introspector.decapitalize(getterName.substring(3));
     } else {
       name = Introspector.decapitalize(getterName.substring(2));
     }
     getterMap.put(name, getter);
   }
   return getterMap;
 }