sharedSD.getLocation() + partitionWithoutSDS.get(partitionWithoutSDSIndex).getRelativePath()); } else { Assert.assertEquals(PropertyUtils.getNestedProperty(origPart, projectField), PropertyUtils.getNestedProperty(sharedSD, sdPropertyName)); Assert.assertEquals(PropertyUtils.getNestedProperty(origPart, projectField), PropertyUtils.getNestedProperty(partitionWithoutSDS.get(partitionWithoutSDSIndex), projectField));
@Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1) { if (propertyName != null) { String propertyNameStr = propertyName.stringValue(env); Object target = arg1.getValue(env); try { Object property = PropertyUtils.getNestedProperty(target, propertyNameStr); arg1 = new AviatorRuntimeJavaType(property); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw new IllegalArgumentException( "Fail to get property <" + propertyNameStr + "> from <" + arg1.desc(env) + ">", e); } } switch (this.opType) { case EQ: return arg1.compare(this.value, env) == 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case NEQ: return arg1.compare(this.value, env) != 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case LT: return arg1.compare(this.value, env) < 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case LE: return arg1.compare(this.value, env) <= 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case GE: return arg1.compare(this.value, env) >= 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case GT: return arg1.compare(this.value, env) > 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; default: throw new ExpressionRuntimeException(this.getName() + " is not a relation operator"); } }
public static Object getProperty(Object o, String propertyName) { try { Object myValue = PropertyUtils.getNestedProperty(o, propertyName); return myValue; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (NestedNullException nne){ return null; } return null; } }
public static Object getNestedProperty(Object bean, String name) { try { return org.apache.commons.beanutils.PropertyUtils.getNestedProperty(bean, name); }catch(Exception e) { handleException(e); return null; } }
/** * @param obj * @return String */ public String getRecupLibelleObject(final Object obj) { try { Object objResult = PropertyUtils.getNestedProperty(obj, libelleObject); return objResult.toString(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } return null; }
/** * @see com.google.common.base.Function#apply(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public T apply(F from) { try { return (T)PropertyUtils.getNestedProperty(from, this.propertyName); } catch (NestedNullException exception) { // if any the nested objects is null we return null as value return null; } catch (Exception ex) { throw new UnexpectedException("Error getting the property: '" + this.propertyName + "' of: " + from); } } }
/** * @param <T> The type of the result object * @param from The object where invoke the property * @param propertyName The name of the property to invoke * @return The property value */ @SuppressWarnings("unchecked") public static <T> T getPropertyValue(Object from, String propertyName) { try { return (T)PropertyUtils.getNestedProperty(from, propertyName); } catch (NestedNullException exception) { // if any the nested objects is null we return null as value return null; } catch (Exception ex) { throw new UnexpectedException("Error getting the property: '" + propertyName + "' of: " + from); } }
/** * This method verifies that all of the parent objects of propertyName are non-null. * * @param bo * @param propertyName * @return true if all parents are non-null, otherwise false */ static private boolean isObjectTreeNonNullAllTheWayDown(BusinessObject bo, String propertyName) { String[] propertyParts = propertyName.split("\\."); StringBuffer property = new StringBuffer(); for (int i = 0; i < propertyParts.length - 1; i++) { property.append((0 == property.length()) ? "" : ".").append(propertyParts[i]); try { if (null == PropertyUtils.getNestedProperty(bo, property.toString())) { return false; } } catch (Throwable t) { LOG.debug("Either getter or setter not specified for property \"" + property.toString() + "\"", t); return false; } } return true; }
@Override protected Object invokeReadMethod(PropertyDescriptor pd, Object beanInstance) throws Exception { String rattr = (String) pd.getValue("relation.attribute"); if( rattr!=null ) { String nestedProperty = String.format( "%s.%s", pd.getName(), rattr ); Log.debug( "====> GET JOIN PROPERTY " + nestedProperty); return PropertyUtils.getNestedProperty(beanInstance, nestedProperty); } return super.invokeReadMethod(pd, beanInstance); }
return null; Object value = PropertyUtils.getNestedProperty(infoObject, fieldPath);
propertyName = properties[i]; Class<?> propertyType = PropertyUtils.getPropertyType(value, propertyName); Object propertyValue = PropertyUtils.getNestedProperty(value, propertyName); PropertyEditor editor = registry.findCustomEditor(propertyType, registryPropertyNamePrefix + propertyName); if (editor == null) {
public static Map<String, Object> toMap(Object bean) { if (bean == null) { return Collections.emptyMap(); } try { Map<String, Object> description = new HashMap<String, Object>(); if (bean instanceof DynaBean) { DynaProperty[] descriptors = ((DynaBean) bean).getDynaClass().getDynaProperties(); for (DynaProperty descriptor : descriptors) { String name = descriptor.getName(); description.put(name, BeanUtils.getProperty(bean, name)); } } else { PropertyDescriptor[] descriptors = PropertyUtils.getPropertyDescriptors(bean); for (PropertyDescriptor descriptor : descriptors) { String name = descriptor.getName(); if (PropertyUtils.getReadMethod(descriptor) != null) { description.put(name, PropertyUtils.getNestedProperty(bean, name)); } } } return description; } catch (Exception e) { return Collections.emptyMap(); } }
Object propertyValue = PropertyUtils.getNestedProperty(this.currentObject, StringUtils.escape(this.escapeXml, this.rowIdBase)); rowId.append(propertyValue != null ? propertyValue : "");
Object propertyValue = PropertyUtils.getNestedProperty(this.currentObject, StringUtils.escape(this.escapeXml, this.rowIdBase)); rowId.append(propertyValue != null ? propertyValue : "");
public static Object getNestedProperty(Object object, String fieldName) { if (null == object) { return null; } try { return PropertyUtils.getNestedProperty(object, fieldName); } catch(IllegalAccessException e) { throw new JcrMappingException("Cannot access property " + fieldName, e); } catch(InvocationTargetException e) { throw new JcrMappingException("Cannot access property " + fieldName, e); } catch(NoSuchMethodException e) { throw new JcrMappingException("Cannot access property " + fieldName, e); } }
public static Object getNestedProperty(Object object, String fieldName) { if (null == object) { return null; } try { return PropertyUtils.getNestedProperty(object, fieldName); } catch(IllegalAccessException e) { throw new JcrMappingException("Cannot access property " + fieldName, e); } catch(InvocationTargetException e) { throw new JcrMappingException("Cannot access property " + fieldName, e); } catch(NoSuchMethodException e) { throw new JcrMappingException("Cannot access property " + fieldName, e); } }
propertyValue = PropertyUtils.getNestedProperty(parent.getCurrentObject(), this.property.trim());
Object attributeValue = PropertyUtils.getNestedProperty(object, itemDefinitionName);
@Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1) { if (propertyName != null) { String propertyNameStr = propertyName.stringValue(env); Object target = arg1.getValue(env); try { Object property = PropertyUtils.getNestedProperty(target, propertyNameStr); arg1 = new AviatorRuntimeJavaType(property); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw new IllegalArgumentException( "Fail to get property <" + propertyNameStr + "> from <" + arg1.desc(env) + ">", e); } } switch (this.opType) { case EQ: return arg1.compare(this.value, env) == 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case NEQ: return arg1.compare(this.value, env) != 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case LT: return arg1.compare(this.value, env) < 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case LE: return arg1.compare(this.value, env) <= 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case GE: return arg1.compare(this.value, env) >= 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; case GT: return arg1.compare(this.value, env) > 0 ? AviatorBoolean.TRUE : AviatorBoolean.FALSE; default: throw new ExpressionRuntimeException(this.getName() + " is not a relation operator"); } }
boolean isEmptyValue = false; try { value = PropertyUtils.getNestedProperty(namedObject, validator.getProperty().getPropertyExpression()); if (value == null || String.valueOf(value).trim().length() == 0) { isEmptyValue = true;