private Map<String, BeanProperty> getProperties() { if (mProperties == null) { mProperties = BeanIntrospector.getAllProperties(mBeanClass); } return mProperties; }
/** * Returns a Map of all the available properties on a given class including * write-only and indexed properties. * * @return Map<String, BeanProperty> an unmodifiable mapping of property * names (Strings) to BeanProperty objects. * */ public static Map<String, BeanProperty> getAllProperties(Class clazz) { synchronized (cPropertiesCache) { Map<String, BeanProperty> properties; SoftReference<Map<String, BeanProperty>> ref = cPropertiesCache.get(clazz); if (ref != null) { properties = ref.get(); if (properties != null) { return properties; } } properties = createProperties(clazz); cPropertiesCache.put(clazz, new SoftReference<Map<String, BeanProperty>>(properties)); return properties; } }
private static Map<String, BeanProperty> createProperties(Class clazz) { if (clazz == null || clazz.isPrimitive()) { return Collections.emptyMap(); } Map<String, BeanProperty> properties = new HashMap<String, BeanProperty>(); fillInProperties(clazz, properties); // Properties defined in Object are also available to interfaces. if (clazz.isInterface()) { fillInProperties(Object.class, properties); } // Ensure that all implemented interfaces are properly analyzed. Class[] interfaces = clazz.getInterfaces(); for (int i=0; i<interfaces.length; i++) { fillInProperties(interfaces[i], properties); } return Collections.unmodifiableMap(properties); }
(type = method.getReturnType()) == void.class || method.getParameterTypes().length > 0 || (name = extractPropertyName(method, "get")) == null) { continue; (type = method.getReturnType()) != boolean.class || method.getParameterTypes().length > 0 || (name = extractPropertyName(method, "is")) == null) { continue; method.getReturnType() != void.class || (params = method.getParameterTypes()).length != 1 || (name = extractPropertyName(method, "set")) == null) { continue; (type = method.getReturnType()) == void.class || (params = method.getParameterTypes()).length != 1 || (name = extractPropertyName(method, "get")) == null) { continue; method.getReturnType() != void.class || (params = method.getParameterTypes()).length != 2 || (name = extractPropertyName(method, "set")) == null) { continue;
(type = method.getReturnType()) == void.class || method.getParameterTypes().length > 0 || (name = extractPropertyName(method, "get")) == null) { continue; (type = method.getReturnType()) != boolean.class || method.getParameterTypes().length > 0 || (name = extractPropertyName(method, "is")) == null) { continue; method.getReturnType() != void.class || (params = method.getParameterTypes()).length != 1 || (name = extractPropertyName(method, "set")) == null) { continue; (type = method.getReturnType()) == void.class || (params = method.getParameterTypes()).length != 1 || (name = extractPropertyName(method, "get")) == null) { continue; method.getReturnType() != void.class || (params = method.getParameterTypes()).length != 2 || (name = extractPropertyName(method, "set")) == null) { continue;
public static void main(String[] args) throws Exception { System.out.println(getAllProperties(Class.forName(args[0]))); }
private static Map<String, BeanProperty> createProperties(Class clazz) { if (clazz == null || clazz.isPrimitive()) { return Collections.emptyMap(); } Map<String, BeanProperty> properties = new HashMap<String, BeanProperty>(); fillInProperties(clazz, properties); // Properties defined in Object are also available to interfaces. if (clazz.isInterface()) { fillInProperties(Object.class, properties); } // Ensure that all implemented interfaces are properly analyzed. Class[] interfaces = clazz.getInterfaces(); for (int i=0; i<interfaces.length; i++) { fillInProperties(interfaces[i], properties); } return Collections.unmodifiableMap(properties); }
/** * Returns a Map of all the available properties on a given class including * write-only and indexed properties. * * @return Map<String, BeanProperty> an unmodifiable mapping of property * names (Strings) to BeanProperty objects. * */ public static Map<String, BeanProperty> getAllProperties(Class clazz) { synchronized (cPropertiesCache) { Map<String, BeanProperty> properties; SoftReference<Map<String, BeanProperty>> ref = cPropertiesCache.get(clazz); if (ref != null) { properties = ref.get(); if (properties != null) { return properties; } } properties = createProperties(clazz); cPropertiesCache.put(clazz, new SoftReference<Map<String, BeanProperty>>(properties)); return properties; } }
List writeProperties = new ArrayList(); Map map = BeanIntrospector.getAllProperties(beanType);
final Map<String, BeanProperty> properties = BeanIntrospector.getAllProperties(clazz); Map<String, BeanProperty> supportedProperties = properties;
private Map<String, BeanProperty> getProperties() { if (mProperties == null) { mProperties = BeanIntrospector.getAllProperties(mBeanClass); } return mProperties; }
public static void main(String[] args) throws Exception { System.out.println(getAllProperties(Class.forName(args[0]))); }
/** * @return null if unknown */ private static Class propertyType(Class enclosingType, String propertyName) { Map<String, BeanProperty> properties = BeanIntrospector.getAllProperties(enclosingType); int dotIndex = propertyName.indexOf('.'); if (dotIndex < 0) { BeanProperty bp = properties.get(propertyName); return bp == null ? null : bp.getType(); } else { String parentName = propertyName.substring(0, dotIndex); BeanProperty bp = properties.get(parentName); if (bp == null) { return null; } return propertyType(bp.getType(), propertyName.substring(dotIndex + 1)); } }
/** * @return null if unknown */ private static Class propertyType(Class enclosingType, String propertyName) { Map<String, BeanProperty> properties = BeanIntrospector.getAllProperties(enclosingType); int dotIndex = propertyName.indexOf('.'); if (dotIndex < 0) { BeanProperty bp = properties.get(propertyName); return bp == null ? null : bp.getType(); } else { String parentName = propertyName.substring(0, dotIndex); BeanProperty bp = properties.get(parentName); if (bp == null) { return null; } return propertyType(bp.getType(), propertyName.substring(dotIndex + 1)); } }
List writeProperties = new ArrayList(); Map map = BeanIntrospector.getAllProperties(beanType);
Map allProperties = BeanIntrospector.getAllProperties(type);
Map allProperties = BeanIntrospector.getAllProperties(type);
final Map<String, BeanProperty> properties = BeanIntrospector.getAllProperties(clazz); Map<String, BeanProperty> supportedProperties = properties;
} else { Map<String, BeanProperty> props = BeanIntrospector.getAllProperties(instanceVarClass); BeanProperty prop = props.get(info.getPropertyName()); propertyClass = prop == null ? null : prop.getType();
} else { Map<String, BeanProperty> props = BeanIntrospector.getAllProperties(instanceVarClass); BeanProperty prop = props.get(info.getPropertyName()); propertyClass = prop == null ? null : prop.getType();