Class PropertyExtractors.ObjectPropertyExtractor
- All Implemented Interfaces:
PropertyExtractor
- Direct Known Subclasses:
PropertyExtractors.ListPropertyExtractor
,PropertyExtractors.MapPropertyExtractor
- Enclosing class:
- PropertyExtractors
This extractor serves as the universal fallback for property access, implementing comprehensive JavaBean property access patterns. It tries multiple approaches to access object properties, providing maximum compatibility with different coding styles.
Property Access Order:
is{Property}()
- Boolean property getters (e.g.,isActive()
)get{Property}()
- Standard getter methods (e.g.,getName()
)get(String)
- Map-style property access with property name as parameter- Fields - Public fields with matching names (searches inheritance hierarchy)
{property}()
- No-argument methods with exact property name
Examples:
Compatibility: This extractor can handle any object type, making it the
universal fallback. It always returns true
from canExtract(BeanConverter, Object, String)
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canExtract
(BeanConverter converter, Object o, String name) Determines if this extractor can handle property access for the given object and property name.extract
(BeanConverter converter, Object o, String name) Extracts the specified property value from the given object.
-
Constructor Details
-
ObjectPropertyExtractor
public ObjectPropertyExtractor()
-
-
Method Details
-
canExtract
Description copied from interface:PropertyExtractor
Determines if this extractor can handle property access for the given object and property name.This method should perform a quick check to determine compatibility without doing expensive operations. It's called frequently during property navigation.
- Specified by:
canExtract
in interfacePropertyExtractor
- Parameters:
converter
- The bean converter instance (for recursive operations if needed)o
- The object to extract the property fromname
- The property name to extract- Returns:
true
if this extractor can handle the property access,false
otherwise
-
extract
Description copied from interface:PropertyExtractor
Extracts the specified property value from the given object.This method is only called after
PropertyExtractor.canExtract(BeanConverter, Object, String)
returnstrue
. It should perform the actual property extraction and return the property value.- Specified by:
extract
in interfacePropertyExtractor
- Parameters:
converter
- The bean converter instance (for recursive operations if needed)o
- The object to extract the property fromname
- The property name to extract- Returns:
- The property value
-