Class ReflectionBuilder

java.lang.Object
org.apache.shiro.config.ogdl.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 Details

    • ReflectionBuilder

      public ReflectionBuilder()
    • ReflectionBuilder

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

    • getObjects

      public Map<String,?> getObjects()
    • setObjects

      public void setObjects(Map<String,?> objects)
      Parameters:
      objects -
    • setAlternateObjectSupplier

      public void setAlternateObjectSupplier(Function<String,?> alternateObjectSupplier)
      Plug in another way to get objects into configuration, ex: CDI
      Parameters:
      alternateObjectSupplier - not null (empty lambda ok)
      Since:
      2.0
    • findEventBus

      protected org.apache.shiro.event.EventBus findEventBus(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)
    • destroy

      public void destroy()
    • 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)
    • toCollection

      protected Collection<?> toCollection(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)
    • setInterpolator

      public void setInterpolator(Interpolator interpolator)
      Sets the Interpolator used when evaluating the right side of the expressions.
      Since:
      1.4