/** * A generic method for performing actions on the <code>object</code>'s hierarchy of * attributes. Allows to customize the bindable marker annotation class. For experts * only. */ static void bind(Object object, IAttributeBinderAction [] attributeBinderActions, Predicate<Field> predicate, Class<? extends Annotation> markerAnnotation) throws InstantiationException, AttributeBindingException { bind(new HashSet<Object>(), new BindingTracker(), 0, object, attributeBinderActions, predicate, markerAnnotation); }
public void performAction(BindingTracker bindingTracker, int level, Object object, Field field, Object value, Predicate<Field> predicate) throws InstantiationException { final String key = BindableUtils.getKey(field); try { // Apply transforms for (IAttributeTransformer transformer : transformers) { value = transformer.transform(value, key, field); } if (bindingTracker.canBind(object, key, level)) { values.put(key, value); } } catch (final Exception e) { throw new AttributeBindingException(key, "Could not get field value " + object.getClass().getName() + "#" + field.getName(), e); } } }
/** * A generic method for performing actions on the <code>object</code>'s hierarchy of * attributes. For experts only. */ public static void bind(Object object, IAttributeBinderAction [] attributeBinderActions, Predicate<Field> predicate) throws InstantiationException, AttributeBindingException { bind(new HashSet<Object>(), new BindingTracker(), 0, object, attributeBinderActions, Predicates.<Field> and(CONSISTENCY_CHECKS, predicate), Bindable.class); }