/** * {@inheritDoc} * Here, state equates to a given bean reference. */ @Override @SuppressWarnings("unchecked") public boolean collectValidated() { return validatedObjects.put(getBean(), Boolean.TRUE) == null; }
/** * {@inheritDoc} */ @Override public void moveUp(Object bean, MetaBean aMetaBean) { setBean(bean, aMetaBean); // reset context state }
/** * Set the property value, fixed. * @param value */ public void setFixedValue(Object value) { setPropertyValue(value); setFixed(true); }
/** * {@inheritDoc} */ @Override public void moveDown(MetaProperty prop, AccessStrategy access) { setBean(getPropertyValue(access), prop.getMetaBean()); }
/** * {@inheritDoc} */ @Override public void setBean(Object aBean, MetaBean aMetaBean) { bean = aBean; metaBean = aMetaBean; metaProperty = null; unknownValue(); }
/** * factory method - overwrite in subclasses * * @return ValidationContext parameterized with our listener type */ protected ValidationContext<T> createContext() { return new BeanValidationContext<T>(createResults()); }
/** * Get the cached value or access it somehow (via field or method)<br> * <b>you should prefer getPropertyValue(AccessStrategy) instead of this method</b> * * @return the current value of the property accessed by reflection * @throws IllegalArgumentException - error accessing attribute (config error, reflection problem) * @throws IllegalStateException - when no property is currently set in the context (application logic bug) */ @Override public Object getPropertyValue() { if (access == null) { // undefined access strategy return getPropertyValue(PropertyAccess.getInstance(bean.getClass(), metaProperty.getName())); } return getPropertyValue(access); }
/** * {@inheritDoc} */ @Override public void moveDown(MetaProperty prop, AccessStrategy access) { path.addProperty(prop.getName()); super.moveDown(prop, access); }
/** * {@inheritDoc} */ @Override public void moveUp(Object bean, MetaBean metaBean) { NodeImpl leaf = path.getLeafNode(); if (leaf.isInIterable() && leaf.getName() != null) { leaf.setName(null); } else { path.removeLeafNode(); } super.moveUp(bean, metaBean); // call super! }
/** * {@inheritDoc} */ @Override public void setMetaProperty(MetaProperty metaProperty) { this.metaProperty = metaProperty; unknownValue(); }
/** * {@inheritDoc} */ @Override public void setBean(Object bean) { this.bean = bean; unknownValue(); }