Java Code Examples for org.apache.commons.beanutils.PropertyUtils#isReadable()

The following examples show how to use org.apache.commons.beanutils.PropertyUtils#isReadable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExcelWorkSheetHandler.java    From excelReader with MIT License 6 votes vote down vote up
private String getPropertyValue(Object targetObj, String propertyName) {
  String value = "";
  if (null == targetObj || StringUtils.isBlank(propertyName)) {
    LOG.error("targetObj or propertyName is null, both require to retrieve a value");
    return value;
  }

  try {
    if (PropertyUtils.isReadable(targetObj, propertyName)) {
      Object v = PropertyUtils.getSimpleProperty(targetObj, propertyName);
      if (null != v && StringUtils.isNotBlank(v.toString())) {
        value = v.toString();
      }
    } else {
      LOG.error("Given property (" + propertyName + ") is not readable!");
    }
  } catch (IllegalAccessException iae) {
    LOG.error(iae.getMessage());
  } catch (InvocationTargetException ite) {
    LOG.error(ite.getMessage());
  } catch (NoSuchMethodException nsme) {
    LOG.error(nsme.getMessage());
  }
  return value;
}
 
Example 2
Source File: ObjectUtil.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * concat the specified properties of the given object as a string
 * 
 * @param object the given object
 * @param the specified fields that need to be included in the return string
 * @return the specified properties of the given object as a string
 */
public static String concatPropertyAsString(Object object, List<String> keyFields) {
    StringBuilder propertyAsString = new StringBuilder();
    for (String field : keyFields) {
        if (PropertyUtils.isReadable(object, field)) {
            try {
                propertyAsString.append(PropertyUtils.getProperty(object, field));
            }
            catch (Exception e) {
                LOG.error(e);
            }
        }
    }

    return propertyAsString.toString();
}
 
Example 3
Source File: ObjectUtil.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * build a map of business object with its specified property names and corresponding values
 * 
 * @param businessObject the given business object
 * @param the specified fields that need to be included in the return map
 * @return the map of business object with its property names and values
 */
public static Map<String, Object> buildPropertyMap(Object object, List<String> keyFields) {
    DynaClass dynaClass = WrapDynaClass.createDynaClass(object.getClass());
    DynaProperty[] properties = dynaClass.getDynaProperties();
    Map<String, Object> propertyMap = new LinkedHashMap<String, Object>();

    for (DynaProperty property : properties) {
        String propertyName = property.getName();

        if (PropertyUtils.isReadable(object, propertyName) && keyFields.contains(propertyName)) {
            try {
                Object propertyValue = PropertyUtils.getProperty(object, propertyName);

                if (propertyValue != null && !StringUtils.isEmpty(propertyValue.toString())) {
                    propertyMap.put(propertyName, propertyValue);
                }
            }
            catch (Exception e) {
                LOG.info(e);
            }
        }
    }
    return propertyMap;
}
 
Example 4
Source File: KfsInquirableImpl.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Helper method to build an inquiry url for a result field. Special implementation to not build an inquiry link if the value is
 * all dashes.
 * 
 * @param bo the business object instance to build the urls for
 * @param propertyName the property which links to an inquirable
 * @return String url to inquiry
 */
public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
    try {
        if (PropertyUtils.isReadable(businessObject, attributeName)) {
            Object objFieldValue = ObjectUtils.getPropertyValue(businessObject, attributeName);
            String fieldValue = objFieldValue == null ? KFSConstants.EMPTY_STRING : objFieldValue.toString();

            if (StringUtils.containsOnly(fieldValue, KFSConstants.DASH)) {
                return new AnchorHtmlData();
            }
        }

        return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
    } catch ( Exception ex ) {
        LOG.error( "Unable to determine inquiry link for BO Class: " + businessObject.getClass() + " and property " + attributeName );
        LOG.debug( "Unable to determine inquiry link for BO Class: " + businessObject.getClass() + " and property " + attributeName, ex );
        return new AnchorHtmlData();
    }
}
 
Example 5
Source File: ObjectUtil.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * determine if the source object has a field with null as its value
 * 
 * @param sourceObject the source object
 */
public static boolean hasNullValueField(Object sourceObject) {
    DynaClass dynaClass = WrapDynaClass.createDynaClass(sourceObject.getClass());
    DynaProperty[] properties = dynaClass.getDynaProperties();

    for (DynaProperty property : properties) {
        String propertyName = property.getName();

        if (PropertyUtils.isReadable(sourceObject, propertyName)) {
            try {
                Object propertyValue = PropertyUtils.getProperty(sourceObject, propertyName);
                if (propertyValue == null) {
                    return true;
                }
            }
            catch (Exception e) {
                LOG.info(e);
                return false;
            }
        }
    }
    return false;
}
 
Example 6
Source File: ParaObjectUtils.java    From para with Apache License 2.0 6 votes vote down vote up
/**
 * Handles "unknown" or user-defined fields. The Para object is populated with custom fields
 * which are stored within the "properties" field of {@link Sysprop}. Unknown or user-defined properties are
 * those which are not declared inside a Java class, but come from an API request.
 * @param pojo a Para object
 * @param props properties to apply to the object.
 */
private static <P> void setUserDefinedProperties(P pojo, Map<String, Object> props) {
	if (props != null && pojo instanceof Sysprop) {
		for (Map.Entry<String, Object> entry : props.entrySet()) {
			String name = entry.getKey();
			Object value = entry.getValue();
			// handle the case where we have custom user-defined properties
			// which are not defined as Java class fields
			if (!PropertyUtils.isReadable(pojo, name) || isPropertiesFieldOfDifferentType(name, value)) {
				if (value == null) {
					((Sysprop) pojo).removeProperty(name);
				} else {
					((Sysprop) pojo).addProperty(name, value);
				}
			}
		}
	}
}
 
Example 7
Source File: PropertyObject.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
public void copyTo(Object o, boolean ignoreNull, Collection<String> excludes) throws Exception {
	for (Field fld : FieldUtils.getAllFields(this.getClass())) {
		if (!excludes.contains(fld.getName())) {
			if (PropertyUtils.isReadable(this, fld.getName()) && PropertyUtils.isWriteable(o, fld.getName())) {
				Object value = PropertyUtils.getProperty(this, fld.getName());
				if (ignoreNull && (null == value)) {
					continue;
				}
				PropertyUtils.setProperty(o, fld.getName(), value);
			}
		}
	}
}
 
Example 8
Source File: PropertyTools.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> T getOrElse(Object bean, String name, Class<T> cls, T defaultObject) throws Exception {
	if ((null != bean) && PropertyUtils.isReadable(bean, name)) {
		Object o = PropertyUtils.getProperty(bean, name);
		if (null != o) {
			return (T) o;
		}
	}
	return defaultObject;
}
 
Example 9
Source File: MyBeanUtils.java    From jeewx with Apache License 2.0 5 votes vote down vote up
/**
	 * 对象拷贝
	 * 数据对象空值不拷贝到目标对象
	 * 
	 * @param dataObject
	 * @param toObject
	 * @throws NoSuchMethodException
	 * copy
	 */
  public static void copyBeanNotNull2Bean(Object databean,Object tobean)
  {
	  PropertyDescriptor origDescriptors[] =
          PropertyUtils.getPropertyDescriptors(databean);
      for (int i = 0; i < origDescriptors.length; i++) {
          String name = origDescriptors[i].getName();
//          String type = origDescriptors[i].getPropertyType().toString();
          if ("class".equals(name)) {
              continue; // No point in trying to set an object's class
          }
          if (PropertyUtils.isReadable(databean, name) &&
              PropertyUtils.isWriteable(tobean, name)) {
              try {
                  Object value = PropertyUtils.getSimpleProperty(databean, name);
                  if(value!=null){
                	    copyProperty(tobean, name, value);
                  }
              }
              catch (java.lang.IllegalArgumentException ie) {
                  ; // Should not happen
              }
              catch (Exception e) {
                  ; // Should not happen
              }

          }
      }
  }
 
Example 10
Source File: MyBeanUtils.java    From jeewx with Apache License 2.0 5 votes vote down vote up
/**
	 * 对象拷贝
	 * 数据对象空值不拷贝到目标对象
	 * 
	 * @param dataObject
	 * @param toObject
	 * @throws NoSuchMethodException
	 * copy
	 */
  public static void copyBeanNotNull2Bean(Object databean,Object tobean)
  {
	  PropertyDescriptor origDescriptors[] =
          PropertyUtils.getPropertyDescriptors(databean);
      for (int i = 0; i < origDescriptors.length; i++) {
          String name = origDescriptors[i].getName();
//          String type = origDescriptors[i].getPropertyType().toString();
          if ("class".equals(name)) {
              continue; // No point in trying to set an object's class
          }
          if (PropertyUtils.isReadable(databean, name) &&
              PropertyUtils.isWriteable(tobean, name)) {
              try {
                  Object value = PropertyUtils.getSimpleProperty(databean, name);
                  if(value!=null){
                	    copyProperty(tobean, name, value);
                  }
              }
              catch (java.lang.IllegalArgumentException ie) {
                  ; // Should not happen
              }
              catch (Exception e) {
                  ; // Should not happen
              }

          }
      }
  }
 
Example 11
Source File: ObjectUtil.java    From smart-framework with Apache License 2.0 5 votes vote down vote up
/**
 * 获取成员变量
 */
public static Object getFieldValue(Object obj, String fieldName) {
    Object propertyValue = null;
    try {
        if (PropertyUtils.isReadable(obj, fieldName)) {
            propertyValue = PropertyUtils.getProperty(obj, fieldName);
        }
    } catch (Exception e) {
        logger.error("获取成员变量出错!", e);
        throw new RuntimeException(e);
    }
    return propertyValue;
}
 
Example 12
Source File: ObjectUtil.java    From springdream with Apache License 2.0 5 votes vote down vote up
/**
 * 获取成员变量
 */
public static Object getFieldValue(Object obj, String fieldName) {
    Object propertyValue = null;
    try {
        if (PropertyUtils.isReadable(obj, fieldName)) {
            propertyValue = PropertyUtils.getProperty(obj, fieldName);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return propertyValue;
}
 
Example 13
Source File: ValidationUtils.java    From para with Apache License 2.0 5 votes vote down vote up
/**
 * Validates objects.
 * @param content an object to be validated
 * @param app the current app
 * @return a list of error messages or empty if object is valid
 */
public static String[] validateObject(App app, ParaObject content) {
	if (content == null || app == null) {
		return new String[]{"Object cannot be null."};
	}
	try {
		String type = content.getType();
		boolean isCustomType = (content instanceof Sysprop) && !type.equals(Utils.type(Sysprop.class));
		// Validate custom types and user-defined properties
		if (!app.getValidationConstraints().isEmpty() && isCustomType) {
			Map<String, Map<String, Map<String, ?>>> fieldsMap = app.getValidationConstraints().get(type);
			if (fieldsMap != null && !fieldsMap.isEmpty()) {
				LinkedList<String> errors = new LinkedList<>();
				for (Map.Entry<String, Map<String, Map<String, ?>>> e : fieldsMap.entrySet()) {
					String field = e.getKey();
					Object actualValue = ((Sysprop) content).getProperty(field);
					// overriding core property validation rules is allowed
					if (actualValue == null && PropertyUtils.isReadable(content, field)) {
						actualValue = PropertyUtils.getProperty(content, field);
					}
					Map<String, Map<String, ?>> consMap = e.getValue();
					for (Map.Entry<String, Map<String, ?>> constraint : consMap.entrySet()) {
						buildAndValidateConstraint(constraint, field, actualValue, errors);
					}
				}
				if (!errors.isEmpty()) {
					return errors.toArray(new String[0]);
				}
			}
		}
	} catch (Exception ex) {
		logger.error(null, ex);
	}
	return validateObject(content);
}
 
Example 14
Source File: FieldUtils.java    From rice with Educational Community License v2.0 5 votes vote down vote up
private static boolean isPropertyReadable(Object bean, String name) {
    try {
        return PropertyUtils.isReadable(bean, name);
    } catch (NestedNullException e) {
        return false;
    }
}
 
Example 15
Source File: PropertyObject.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public final Object get(String name) throws Exception {
	return PropertyUtils.isReadable(this, name) ? PropertyUtils.getProperty(this, name) : null;
}
 
Example 16
Source File: ParaObjectUtils.java    From para with Apache License 2.0 4 votes vote down vote up
/**
 * Converts a map of fields/values to a domain object. Only annotated fields are populated. This method forms the
 * basis of an Object/Grid Mapper.
 * <br>
 * Map values that are JSON objects are converted to their corresponding Java types. Nulls and primitive types are
 * preserved.
 *
 * @param <P> the object type
 * @param pojo the object to populate with data
 * @param data the map of fields/values
 * @param filter a filter annotation. fields that have it will be skipped
 * @return the populated object
 */
public static <P extends ParaObject> P setAnnotatedFields(P pojo, Map<String, Object> data,
		Class<? extends Annotation> filter) {
	if (data == null || data.isEmpty()) {
		return null;
	}
	try {
		if (pojo == null) {
			// try to find a declared class in the core package
			pojo = (P) toClass((String) data.get(Config._TYPE)).getConstructor().newInstance();
		}
		List<Field> fields = getAllDeclaredFields(pojo.getClass());
		Map<String, Object> unknownProps = new LinkedHashMap<>(data);
		Map<String, Object> props = new LinkedHashMap<>(data.size());
		for (Field field : fields) {
			String name = field.getName();
			Object value = data.get(name);
			if (field.isAnnotationPresent(Stored.class) && !isIgnoredField(field, filter)) {
				// try to read a default value from the bean if any
				if (value == null && PropertyUtils.isReadable(pojo, name)) {
					value = PropertyUtils.getProperty(pojo, name);
				}
				// handle complex JSON objects deserialized to Maps, Arrays, etc.
				if (!Utils.isBasicType(field.getType()) && value instanceof String) {
					value = parseFlattenedObject(field, value.toString(), props);
				}
				setAnnotatedField(pojo, props, name, value);
			}
			unknownProps.remove(name); // filter known props
			if (isPropertiesFieldOfDifferentType(name, value)) {
				unknownProps.put("properties", value);
			}
		}
		if (!props.isEmpty()) {
			JsonNode dataNode = getJsonMapper().convertValue(props, JsonNode.class);
			getJsonMapper().readerForUpdating(pojo).readValue(dataNode);
		}
		// handle unknown (user-defined) fields
		setUserDefinedProperties(pojo, unknownProps);
	} catch (Exception ex) {
		logger.error(null, ex);
		pojo = null;
	}
	return pojo;
}
 
Example 17
Source File: QueryGenerator.java    From teaching with Apache License 2.0 4 votes vote down vote up
/**
 * 组装Mybatis Plus 查询条件
 * <p>使用此方法 需要有如下几点注意:   
 * <br>1.使用QueryWrapper 而非LambdaQueryWrapper;
 * <br>2.实例化QueryWrapper时不可将实体传入参数   
 * <br>错误示例:如QueryWrapper<JeecgDemo> queryWrapper = new QueryWrapper<JeecgDemo>(jeecgDemo);
 * <br>正确示例:QueryWrapper<JeecgDemo> queryWrapper = new QueryWrapper<JeecgDemo>();
 * <br>3.也可以不使用这个方法直接调用 {@link #initQueryWrapper}直接获取实例
 */
public static void installMplus(QueryWrapper<?> queryWrapper,Object searchObj,Map<String, String[]> parameterMap) {
	
	/*
	 * 注意:权限查询由前端配置数据规则 当一个人有多个所属部门时候 可以在规则配置包含条件 orgCode 包含 #{sys_org_code}
	但是不支持在自定义SQL中写orgCode in #{sys_org_code} 
	当一个人只有一个部门 就直接配置等于条件: orgCode 等于 #{sys_org_code} 或者配置自定义SQL: orgCode = '#{sys_org_code}'
	*/
	
	//区间条件组装 模糊查询 高级查询组装 简单排序 权限查询
	PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(searchObj);
	Map<String,SysPermissionDataRuleModel> ruleMap = getRuleMap();
	
	//权限规则自定义SQL表达式
	for (String c : ruleMap.keySet()) {
		if(oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)){
			queryWrapper.and(i ->i.apply(getSqlRuleValue(ruleMap.get(c).getRuleValue())));
		}
	}
	
	String name, type;
	for (int i = 0; i < origDescriptors.length; i++) {
		//aliasName = origDescriptors[i].getName();  mybatis  不存在实体属性 不用处理别名的情况
		name = origDescriptors[i].getName();
		type = origDescriptors[i].getPropertyType().toString();
		try {
			if (judgedIsUselessField(name)|| !PropertyUtils.isReadable(searchObj, name)) {
				continue;
			}
			
			//数据权限查询
			if(ruleMap.containsKey(name)) {
				addRuleToQueryWrapper(ruleMap.get(name), name, origDescriptors[i].getPropertyType(), queryWrapper);
			}
			
			// 添加 判断是否有区间值
			String endValue = null,beginValue = null;
			if (parameterMap != null && parameterMap.containsKey(name + BEGIN)) {
				beginValue = parameterMap.get(name + BEGIN)[0].trim();
				addQueryByRule(queryWrapper, name, type, beginValue, QueryRuleEnum.GE);
				
			}
			if (parameterMap != null && parameterMap.containsKey(name + END)) {
				endValue = parameterMap.get(name + END)[0].trim();
				addQueryByRule(queryWrapper, name, type, endValue, QueryRuleEnum.LE);
			}
			
			//判断单值  参数带不同标识字符串 走不同的查询
			//TODO 这种前后带逗号的支持分割后模糊查询需要否 使多选字段的查询生效
			Object value = PropertyUtils.getSimpleProperty(searchObj, name);
			if (null != value && value.toString().startsWith(COMMA) && value.toString().endsWith(COMMA)) {
				String multiLikeval = value.toString().replace(",,", COMMA);
				String[] vals = multiLikeval.substring(1, multiLikeval.length()).split(COMMA);
				final String field = oConvertUtils.camelToUnderline(name);
				if(vals.length>1) {
					queryWrapper.and(j -> {
						j = j.like(field,vals[0]);
						for (int k=1;k<vals.length;k++) {
							j = j.or().like(field,vals[k]);
						}
						return j;
					});
				}else {
					queryWrapper.and(j -> j.like(field,vals[0]));
				}
			}else {
				//根据参数值带什么关键字符串判断走什么类型的查询
				QueryRuleEnum rule = convert2Rule(value);
				value = replaceValue(rule,value);
				// add -begin 添加判断为字符串时设为全模糊查询
				//if( (rule==null || QueryRuleEnum.EQ.equals(rule)) && "class java.lang.String".equals(type)) {
					// 可以设置左右模糊或全模糊,因人而异
					//rule = QueryRuleEnum.LIKE;
				//}
				// add -end 添加判断为字符串时设为全模糊查询
				addEasyQuery(queryWrapper, name, rule, value);
			}
			
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}
	}
	// 排序逻辑 处理 
	doMultiFieldsOrder(queryWrapper, parameterMap);
			
	//高级查询
	doSuperQuery(queryWrapper, parameterMap);
	
}
 
Example 18
Source File: ObjectUtils.java    From rice with Educational Community License v2.0 4 votes vote down vote up
/**
 * Recursive; sets all occurences of the property in the object, its nested objects and its object lists with the
 * given value.
 *
 * @param bo
 * @param propertyName
 * @param type
 * @param propertyValue
 * @throws NoSuchMethodException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 */
public static void setObjectPropertyDeep(Object bo, String propertyName, Class type,
        Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    // Base return cases to avoid null pointers & infinite loops
    if (isNull(bo) || !PropertyUtils.isReadable(bo, propertyName) || (propertyValue != null && propertyValue.equals(
            getPropertyValue(bo, propertyName))) || (type != null && !type.equals(easyGetPropertyType(bo,
            propertyName)))) {
        return;
    }

    // Removed this as the two remaining locations which call this are now performing the refresh themselves
    // need to materialize the updateable collections before resetting the property, because it may be used in the retrieval
    //materializeUpdateableCollections(bo);

    // Set the property in the BO
    setObjectProperty(bo, propertyName, type, propertyValue);

    // Now drill down and check nested BOs and BO lists
    PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(bo.getClass());
    for (int i = 0; i < propertyDescriptors.length; i++) {

        PropertyDescriptor propertyDescriptor = propertyDescriptors[i];

        // Business Objects
        if (propertyDescriptor.getPropertyType() != null && (BusinessObject.class).isAssignableFrom(
                propertyDescriptor.getPropertyType()) && PropertyUtils.isReadable(bo,
                propertyDescriptor.getName())) {
            Object nestedBo = getPropertyValue(bo, propertyDescriptor.getName());
            if (nestedBo instanceof BusinessObject) {
                setObjectPropertyDeep(nestedBo, propertyName, type, propertyValue);
            }
        }

        // Lists
        else if (propertyDescriptor.getPropertyType() != null && (List.class).isAssignableFrom(
                propertyDescriptor.getPropertyType()) && getPropertyValue(bo, propertyDescriptor.getName())
                != null) {

            List propertyList = (List) getPropertyValue(bo, propertyDescriptor.getName());
            for (Object listedBo : propertyList) {
                if (listedBo != null && listedBo instanceof BusinessObject) {
                    setObjectPropertyDeep(listedBo, propertyName, type, propertyValue);
                }
            } // end for
        }
    } // end for
}
 
Example 19
Source File: KRADLegacyDataAdapterImpl.java    From rice with Educational Community License v2.0 4 votes vote down vote up
@Override
public void setObjectPropertyDeep(Object bo, String propertyName, Class type,
        Object propertyValue) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    DataObjectWrapper<Object> dataObjectWrapper = dataObjectService.wrap(bo);
    // Base return cases to avoid null pointers & infinite loops
    if (KRADUtils.isNull(bo) || !PropertyUtils.isReadable(bo, propertyName) || (propertyValue != null
            && propertyValue.equals(dataObjectWrapper.getPropertyValueNullSafe(propertyName))) || (type != null
            && !type.equals(KRADUtils.easyGetPropertyType(bo, propertyName)))) {
        return;
    }
    // Set the property in the BO
    KRADUtils.setObjectProperty(bo, propertyName, type, propertyValue);

    // Now drill down and check nested BOs and BO lists
    PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(bo.getClass());
    for (int i = 0; i < propertyDescriptors.length; i++) {

        PropertyDescriptor propertyDescriptor = propertyDescriptors[i];

        // Business Objects
        if (propertyDescriptor.getPropertyType() != null && (BusinessObject.class).isAssignableFrom(
                propertyDescriptor.getPropertyType()) && PropertyUtils.isReadable(bo,
                propertyDescriptor.getName())) {
            Object nestedBo = dataObjectWrapper.getPropertyValueNullSafe(propertyDescriptor.getName());
            if (nestedBo instanceof BusinessObject) {
                setObjectPropertyDeep(nestedBo, propertyName, type, propertyValue);
            }
        }

        // Lists
        else if (propertyDescriptor.getPropertyType() != null && (List.class).isAssignableFrom(
                propertyDescriptor.getPropertyType()) && dataObjectWrapper.getPropertyValueNullSafe(
                propertyDescriptor.getName()) != null) {

            List propertyList = (List) dataObjectWrapper.getPropertyValueNullSafe(propertyDescriptor.getName());
            for (Object listedBo : propertyList) {
                if (listedBo != null && listedBo instanceof BusinessObject) {
                    setObjectPropertyDeep(listedBo, propertyName, type, propertyValue);
                }
            } // end for
        }
    } // end for
}
 
Example 20
Source File: Table.java    From airtable.java with MIT License 2 votes vote down vote up
/**
 * Check if writable property exists.
 *
 * @param bean bean to inspect
 * @param property name of property
 * @return true if writable property exists.
 */
private static boolean propertyExists(Object bean, String property) {
    return PropertyUtils.isReadable(bean, property)
            && PropertyUtils.isWriteable(bean, property);
}