org.apache.shiro.config
Class ReflectionBuilder

java.lang.Object
  extended by org.apache.shiro.config.ReflectionBuilder

public class ReflectionBuilder
extends Object

Object builder that uses reflection and Apache Commons BeanUtils to build objects given a map of "property values". Typically these come from the Shiro INI configuration and are used to construct or modify the SecurityManager, its dependencies, and web-based security filters.

Recognizes Factory implementations and will call getInstance to satisfy any reference to this bean.

Since:
0.9

Constructor Summary
ReflectionBuilder()
           
ReflectionBuilder(Map<String,?> defaults)
           
 
Method Summary
protected  void applyGlobalProperty(Map objects, String property, String value)
           
protected  void applyProperty(Object object, String propertyPath, Object value)
           
protected  void applyProperty(Object object, String propertyName, String stringValue)
           
protected  void applyProperty(String key, String value, Map objects)
           
protected  void applySingleProperty(Map objects, String name, String property, String value)
           
 Map<String,?> buildObjects(Map<String,String> kvPairs)
           
protected  String checkForNullOrEmptyLiteral(String stringValue)
           
protected  void createNewInstance(Map<String,Object> objects, String name, String value)
           
 Object getBean(String id)
           
<T> T
getBean(String id, Class<T> requiredType)
           
protected  String getId(String referenceToken)
           
 Map<String,?> getObjects()
           
protected  Object getReferencedObject(String id)
           
protected  boolean isIndexedPropertyAssignment(String propertyPath)
           
protected  boolean isReference(String value)
           
protected  boolean isTypedProperty(Object object, String propertyName, Class clazz)
           
protected  Object resolveReference(String reference)
           
protected  Object resolveValue(String stringValue)
           
 void setObjects(Map<String,?> objects)
           
protected  byte[] toBytes(String sValue)
           
protected  List<?> toList(String sValue)
           
protected  Map<?,?> toMap(String sValue)
           
protected  Set<?> toSet(String sValue)
           
protected  String unescapeIfNecessary(String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionBuilder

public ReflectionBuilder()

ReflectionBuilder

public ReflectionBuilder(Map<String,?> defaults)
Method Detail

getObjects

public Map<String,?> getObjects()

setObjects

public void setObjects(Map<String,?> objects)

getBean

public Object getBean(String id)

getBean

public <T> T getBean(String id,
                     Class<T> requiredType)

buildObjects

public Map<String,?> buildObjects(Map<String,String> kvPairs)

createNewInstance

protected void createNewInstance(Map<String,Object> objects,
                                 String name,
                                 String value)

applyProperty

protected void applyProperty(String key,
                             String value,
                             Map objects)

applyGlobalProperty

protected void applyGlobalProperty(Map objects,
                                   String property,
                                   String value)

applySingleProperty

protected void applySingleProperty(Map objects,
                                   String name,
                                   String property,
                                   String value)

isReference

protected boolean isReference(String value)

getId

protected String getId(String referenceToken)

getReferencedObject

protected Object getReferencedObject(String id)

unescapeIfNecessary

protected String unescapeIfNecessary(String value)

resolveReference

protected Object resolveReference(String reference)

isTypedProperty

protected boolean isTypedProperty(Object object,
                                  String propertyName,
                                  Class clazz)

toSet

protected Set<?> toSet(String sValue)

toMap

protected Map<?,?> toMap(String sValue)

toList

protected List<?> toList(String sValue)

toBytes

protected byte[] toBytes(String sValue)

resolveValue

protected Object resolveValue(String stringValue)

checkForNullOrEmptyLiteral

protected String checkForNullOrEmptyLiteral(String stringValue)

applyProperty

protected void applyProperty(Object object,
                             String propertyPath,
                             Object value)

isIndexedPropertyAssignment

protected boolean isIndexedPropertyAssignment(String propertyPath)

applyProperty

protected void applyProperty(Object object,
                             String propertyName,
                             String stringValue)


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.