code: public static Object getProperty(Object obj, String name) {
  		if (obj == null)
  			throw new NullPointerException("Object cannot be null");
  		if (name == null)
  			throw new NullPointerException("Property name cannot be null");
  
  		Class<?> objClass = obj.getClass();
  
  		// Search in fields
  		for (Field field : objClass.getFields()) {
  			try {
  				if (matchField(field, name))
  					return field.get(obj);
  			} catch (Throwable t) {
  				// Ignore exceptions
  			}
  		}
  
  		// Search in properties
  		name = "get" + name;
  		for (Method method : objClass.getMethods()) {
  			try {
  				if (matchPropertyGetter(method, name))
  					return method.invoke(obj);
  			} catch (Throwable t) {
  				// Ignore exceptions
  			}
  		}
  
  		return null;
  	}
docs: Gets value of object property specified by its name.
  
  @param obj  an object to read property from.
  @param name a name of the property to get.
  @return the property value or null if property doesn't exist or introspection
  failed.