public static <X, Y> PropertyPathExpression<X, Y> getExpression( Class<X> source, String propertyPath) { return getExpression(source, propertyPath, (Class<Y>) null); }
@SuppressWarnings("unchecked") public PropertyPathExpressionValueHolder(X source, String propertyPath) { this(source, (PropertyPathExpression<X, Y>) ExpressionUtils .getExpression(source.getClass(), propertyPath)); }
/** * Constructs a LazyGetterMethod object for the given source object and * field names as a string separated by '.' (dots). Using this constructor * is equal to # * {@link LazyGetterMethod#LazyGetterMethod(java.lang.Object, java.lang.String[]) } * with the second parameter <code>fieldNames.split("\\.")</code>. * * @param source The object on which to invoke the first getter * @param fieldNames The field names which should be used for the getter * determination */ @SuppressWarnings("unchecked") public LazyGetterMethod(Object source, String fieldNames) { this.source = source; this.expression = (PropertyPathExpression<Object, Object>) ExpressionUtils .getExpression(source.getClass(), fieldNames); }
/** * Constructs a LazySetterMethod object for the given source object, field * names as a string separated by '.' (dots) and arguments. Using this * constructor is equal to # * {@link LazySetterMethod#LazySetterMethod(java.lang.Object, java.lang.String[], java.lang.Object[]) } * with the second parameter <code>fieldNames.split("\\.")</code>. * * @param target The object on which to invoke the getter/setter chain * @param fieldNames The field names which should be used for the setter * determination * @param args The arguments used for the setter method */ @SuppressWarnings("unchecked") public LazySetterMethod(Object target, String fieldNames, Object value) { if (target == null) { throw new NullPointerException("target"); } this.target = target; this.value = value; this.expression = (PropertyPathExpression<Object, Object>) ExpressionUtils .getExpression(target.getClass(), fieldNames); }
@SuppressWarnings("unchecked") public static <X, Y> Y getNullSafeValue(X target, String propertyPath, Class<Y> valueClass) { return target == null ? null : getExpression( (Class<X>) target.getClass(), propertyPath, valueClass) .getNullSafeValue(target); }
public static <X, Y> Y getValue(Class<X> source, X target, String propertyPath, Class<Y> valueClass) { return getExpression(source, propertyPath, valueClass).getValue(target); }
public static <X, Y> void setValue(Class<X> source, X target, String propertyPath, Y value) { getExpression(source, propertyPath).setValue(target, value); }
public static <X, Y> PropertyPathExpressionValueHolder<X, Y> getValueHolder( Class<X> source, X target, String propertyPath, Class<Y> valueClass) { return new PropertyPathExpressionValueHolder<X, Y>(target, getExpression(source, propertyPath, valueClass)); }
public static <X, Y> Y getNullSafeValue(Class<X> source, X target, String propertyPath, Class<Y> valueClass) { return getExpression(source, propertyPath, valueClass) .getNullSafeValue(target); }
@SuppressWarnings("unchecked") public static <X, Y> void setValue(X target, String propertyPath, Y value) { getExpression((Class<X>) target.getClass(), propertyPath).setValue( target, value); }
@SuppressWarnings("unchecked") public static <X, Y> Y getValue(X target, String propertyPath, Class<Y> valueClass) { return getExpression((Class<X>) target.getClass(), propertyPath, valueClass).getValue(target); }
attributes[i] = attributeName; if (simpleValueAttributePrefix.isEmpty()) { pathExpressions[i] = (PropertyPathExpression<Object, Object>) com.blazebit.reflection.ExpressionUtils.getExpression(valueClass, attributeName); for (int j = 0; j < valueCount; j++) { parameterNames[j][i] = rootAlias + '_' + parameterPart + '_' + j; pathExpressions[i] = (PropertyPathExpression<Object, Object>) com.blazebit.reflection.ExpressionUtils.getExpression(valueClass, attributeName.substring(simpleValueAttributePrefix.length())); for (int j = 0; j < valueCount; j++) { parameterNames[j][i] = rootAlias + '_' + parameterPart + '_' + j; pathExpressions[i] = (PropertyPathExpression<Object, Object>) com.blazebit.reflection.ExpressionUtils.getExpression(valueClass, attributeName); for (int j = 0; j < valueCount; j++) { parameterNames[j][i] = rootAlias + '_' + parameterPart + '_' + j;