/** * Convenience method to access metaProperty.name * * @return null or the name of the current property */ @Override public String getPropertyName() { return metaProperty == null ? null : metaProperty.getName(); }
/** * Set the properties. * * @param properties * the MetaProperty[] to set */ public void setProperties(MetaProperty[] properties) { this.properties = new HashMap<String, MetaProperty>(); for (final MetaProperty property : properties) { this.properties.put(property.getName(), property); } }
/** * {@inheritDoc} */ @Override public void moveDown(MetaProperty prop, AccessStrategy access) { path.addProperty(prop.getName()); super.moveDown(prop, access); }
/** * 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} If an associated object is validated, add the association * field or JavaBeans property name and a dot ('.') as a prefix to the * previous rules. uses prop[index] in property path for elements in * to-many-relationships. * * @return the path in dot notation */ public PathImpl getPropertyPath() { PathImpl currentPath = PathImpl.copy(path); if (getMetaProperty() != null) { currentPath.addProperty(getMetaProperty().getName()); } return currentPath; }
/** * If we currently have a property, navigate the context such that the property becomes the bean, in preparation for * another property. * * @param validationContext */ public void moveDownIfNecessary() { MetaProperty mp = validationContext.getMetaProperty(); if (mp != null) { if (mp.getMetaBean() == null) { throw new UnknownPropertyException(String.format("Property %s.%s is not cascaded", mp .getParentMetaBean().getId(), mp.getName())); } validationContext.moveDown(mp, new NullSafePropertyAccess(validationContext.getMetaBean().getBeanClass(), mp.getName())); } }
/** * Create a new PropertyDescriptorImpl instance. * * @param property */ PropertyDescriptorImpl(MetaProperty property) { super(property.getParentMetaBean(), property.getTypeClass(), property.getValidations()); setCascaded(property.getMetaBean() != null || property.getFeature(Features.Property.REF_CASCADE) != null); setPropertyPath(property.getName()); }
final MetaBean mbean = context.getMetaBean(); context.moveDown(prop, PropertyAccess.getInstance(bean.getClass(), prop.getName())); ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
metabean.putProperty(metaProperty.getName(), null);
NodeImpl node = new NodeImpl(prop.getName()); if (beanPath == null) { beanPath = PathImpl.create(null);