/** * Get a direct or indirect property (dotted property: prop1.prop2.prop3) on the target object. * @param target the target object from which to get the property. * @param propertyName the name of the property to get. * @return the value of the specified property. * @throws PropertyException if an error happened while trying to get the property. */ public static Object getProperty(Object target, String propertyName) throws PropertyException { String[] propertyNames = propertyName.split("\\."); Object currentTarget = target; for (int i = 0; i < propertyNames.length; i++) { String name = propertyNames[i]; Object result = callGetter(currentTarget, name); if (result == null && i < propertyNames.length -1) { throw new PropertyException("cannot get property '" + propertyName + "' - '" + name + "' is null"); } currentTarget = result; } return currentTarget; }
/** * Get a direct or indirect property (dotted property: prop1.prop2.prop3) on the target object. * @param target the target object from which to get the property. * @param propertyName the name of the property to get. * @return the value of the specified property. * @throws PropertyException if an error happened while trying to get the property. */ public static Object getProperty(Object target, String propertyName) throws PropertyException { String[] propertyNames = propertyName.split("\\."); Object currentTarget = target; for (int i = 0; i < propertyNames.length; i++) { String name = propertyNames[i]; Object result = callGetter(currentTarget, name); if (result == null && i < propertyNames.length -1) throw new PropertyException("cannot get property '" + propertyName + "' - '" + name + "' is null"); currentTarget = result; } return currentTarget; }
/** * Get a direct or indirect property (dotted property: prop1.prop2.prop3) on the target object. * @param target the target object from which to get the property. * @param propertyName the name of the property to get. * @return the value of the specified property. * @throws PropertyException if an error happened while trying to get the property. */ public static Object getProperty(Object target, String propertyName) throws PropertyException { String[] propertyNames = propertyName.split("\\."); Object currentTarget = target; for (int i = 0; i < propertyNames.length; i++) { String name = propertyNames[i]; Object result = callGetter(currentTarget, name); if (result == null && i < propertyNames.length -1) throw new PropertyException("cannot get property '" + propertyName + "' - '" + name + "' is null"); currentTarget = result; } return currentTarget; }
/** * Get a direct or indirect property (dotted property: prop1.prop2.prop3) on the target object. * @param target the target object from which to get the property. * @param propertyName the name of the property to get. * @return the value of the specified property. * @throws PropertyException if an error happened while trying to get the property. */ public static Object getProperty(Object target, String propertyName) throws PropertyException { String[] propertyNames = propertyName.split("\\."); Object currentTarget = target; for (int i = 0; i < propertyNames.length; i++) { String name = propertyNames[i]; Object result = callGetter(currentTarget, name); if (result == null && i < propertyNames.length -1) { throw new PropertyException("cannot get property '" + propertyName + "' - '" + name + "' is null"); } currentTarget = result; } return currentTarget; }
while (i < propertyNames.length -1) { String name = propertyNames[i]; Object result = callGetter(currentTarget, name); if (result == null) {
while (i < propertyNames.length -1) { String name = propertyNames[i]; Object result = callGetter(currentTarget, name); if (result == null) {
while (i < propertyNames.length -1) { String name = propertyNames[i]; Object result = callGetter(currentTarget, name); if (result == null) {
while (i < propertyNames.length -1) { String name = propertyNames[i]; Object result = callGetter(currentTarget, name); if (result == null) {