Top Description Inners Fields Constructors Methods
net.sf.ehcache.search.attribute

public Class JavaBeanAttributeExtractor

extends Object
implements AttributeExtractor
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.search.attribute.AttributeExtractor, java.io.Serializable
Imports
java.lang.reflect.InvocationTargetException, .Method, net.sf.ehcache.Element

Extracts a search attribute determining the value as a javabean property on either the key or the value. If the property exists on both the key and the value an exception is thrown
Author
teck

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
JavaBeanAttributeExtractor.MethodRef

A cached method lookup.

Field Summary

Modifier and TypeField and Description
private final String
private transient volatile JavaBeanAttributeExtractor.MethodRef
private transient volatile JavaBeanAttributeExtractor.MethodRef
private static final Object

Constructor Summary

AccessConstructor and Description
public
JavaBeanAttributeExtractor(String
the bean property name to extract
beanProperty
)

Constructor

Method Summary

Modifier and TypeMethod and Description
public Object
attributeFor(Element
the cache element to inspect
element
,
String
the name of the requested attribute
attributeName
)

Implements net.sf.ehcache.search.attribute.AttributeExtractor.attributeFor.

Extract the attribute value.
private JavaBeanAttributeExtractor.MethodRef
private Object
getValue(Method method, Object key)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beanPropertyback to summary
private final String beanProperty
lastKeyMethodback to summary
private transient volatile JavaBeanAttributeExtractor.MethodRef lastKeyMethod
lastValueMethodback to summary
private transient volatile JavaBeanAttributeExtractor.MethodRef lastValueMethod
NO_VALUEback to summary
private static final Object NO_VALUE

Constructor Detail

JavaBeanAttributeExtractorback to summary
public JavaBeanAttributeExtractor(String beanProperty)

Constructor

Parameters
beanProperty:String

the bean property name to extract

Method Detail

attributeForback to summary
public Object attributeFor(Element element, String attributeName) throws AttributeExtractorException

Implements net.sf.ehcache.search.attribute.AttributeExtractor.attributeFor.

Doc from net.sf.ehcache.search.attribute.AttributeExtractor.attributeFor.

Extract the attribute value. The instance returned from this method must be one of:

  • java.lang.Boolean
  • java.lang.Byte
  • java.lang.Character
  • java.lang.Double
  • java.lang.Float
  • java.lang.Integer
  • java.lang.Long
  • java.lang.Short
  • java.lang.String
  • java.util.Date
  • java.sql.Date
  • java.lang.Enum

Note

null is a legal return here as well indicating that this attribute will not be available for the given element

Parameters
element:Element

the cache element to inspect

attributeName:String

the name of the requested attribute

Returns:Object

the attribute value

Exceptions
AttributeExtractorException:
if the attribute cannot be found or extracted
findMethodback to summary
private JavaBeanAttributeExtractor.MethodRef findMethod(Object obj)
getValueback to summary
private Object getValue(Method method, Object key)
net.sf.ehcache.search.attribute back to summary

private Class JavaBeanAttributeExtractor.MethodRef

extends Object
Class Inheritance
  • java.lang.Object
  • net.sf.ehcache.search.attribute.JavaBeanAttributeExtractor.MethodRef

A cached method lookup. Method is null to indicate the method is not present/accessible

Field Summary

Modifier and TypeField and Description
private final Method
private final Class<T>

Constructor Summary

AccessConstructor and Description
pack-priv
MethodRef(Class<T> target, Method method)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodback to summary
private final Method method
targetClassback to summary
private final Class<T> targetClass

Constructor Detail

MethodRefback to summary
pack-priv MethodRef(Class<T> target, Method method)