org.springframework.binding.support
Class AnnotationAwareBeanPropertyAccessStrategy
java.lang.Object
org.springframework.binding.support.AbstractPropertyAccessStrategy
org.springframework.binding.support.BeanPropertyAccessStrategy
org.springframework.binding.support.AnnotationAwareBeanPropertyAccessStrategy
- All Implemented Interfaces:
- MutablePropertyAccessStrategy, PropertyAccessStrategy
public class AnnotationAwareBeanPropertyAccessStrategy
- extends BeanPropertyAccessStrategy
A JavaBean PropertyAccessStrategy
that exposes JDK 1.5 Annotations for each property
in the form of property level user metadata. In order to remain backward
compatible with 1.4 code, the annotations will be parsed by an installed
AnnotationTranslator
which typically stores the content of each
annotation as key + value pairs in the user metadata. If no translator is
explicitly set, then this implementation will use
ReflectionAnnotationTranslator
by default.
Note that this implementation will scan for annotations on both the getter
and setter methods of the property. If both getter and setter happen to
define the same annotation, then the annotation on the getter will
override the annotation on the setter.
- Since:
- May 8, 2006 1:57:46 PM
- Author:
- andy
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationAwareBeanPropertyAccessStrategy
public AnnotationAwareBeanPropertyAccessStrategy(Object bean)
AnnotationAwareBeanPropertyAccessStrategy
public AnnotationAwareBeanPropertyAccessStrategy(ValueModel domainObjectHolder)
AnnotationAwareBeanPropertyAccessStrategy
protected AnnotationAwareBeanPropertyAccessStrategy(BeanPropertyAccessStrategy parent,
String basePropertyPath)
getAllUserMetadataFor
protected Map<String,Object> getAllUserMetadataFor(String propertyPath)
- Retrieves annotations for the specified property as user metadata.
Uses the intalled
annotation translator
to "parse" annotations to their key + value pair components.
Note that currently annotations are retranslated and the returned map
is rebuilt on every invocation of this method. No caching is attempted
because the current use case of this method is a single call for each
property during FormModel construction. If this use case or usage
pattern should be changed, then we may want to consider caching the
result of this method.
- Overrides:
getAllUserMetadataFor
in class AbstractPropertyAccessStrategy
- Parameters:
propertyPath
-
- Returns:
- all metadata for the specified property in the form of a Map
containing String keys and Object values. This method may return
null
if there is no metadata for the property.
getAnnotationTranslator
public AnnotationTranslator getAnnotationTranslator()
setAnnotationTranslator
public void setAnnotationTranslator(AnnotationTranslator annotationTranslator)
Copyright © 2004-2008 The Spring Framework. All Rights Reserved.