Class DynaBeanACRParameter
- java.lang.Object
-
- org.owasp.esapi.reference.accesscontrol.DynaBeanACRParameter
-
- All Implemented Interfaces:
PolicyParameters
public class DynaBeanACRParameter extends java.lang.Object implements PolicyParameters
A DynaBean comes from the apache bean utils. It is basically a convenient way to dynamically assign getters and setters. Essentially, the way we use DynaBean is a HashMap that can be set to read only.- Author:
- Mike H. Fauzy
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.beanutils.LazyDynaMappolicyProperties
-
Constructor Summary
Constructors Constructor Description DynaBeanACRParameter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectget(java.lang.String key)Follows the contract for java.util.Map;java.math.BigDecimalgetBigDecimal(java.lang.String key)Convenience method to avoid common casts.java.math.BigIntegergetBigInteger(java.lang.String key)Convenience method to avoid common casts.booleangetBoolean(java.lang.String key)Convenience method to avoid common casts.bytegetByte(java.lang.String key)Convenience method to avoid common casts.chargetChar(java.lang.String key)Convenience method to avoid common casts.java.util.DategetDate(java.lang.String key)Convenience method to avoid common casts.doublegetDouble(java.lang.String key)Convenience method to avoid common casts.floatgetFloat(java.lang.String key)Convenience method to avoid common casts.intgetInt(java.lang.String key)Convenience method to avoid common casts.longgetLong(java.lang.String key)Convenience method to avoid common casts.java.lang.ObjectgetObject(java.lang.String key)Convenience method to avoid common casts.java.lang.StringgetString(java.lang.String key)Convenience method to avoid common casts.java.lang.StringgetString(java.lang.String key, java.lang.String defaultValue)Convenience method to avoid common casts.java.lang.String[]getStringArray(java.lang.String key)Convenience method to avoid common casts.java.util.DategetTime(java.lang.String key)Convenience method to avoid common casts.voidlock()This makes the map itself read only, but the mutability of objects that this map contains is not affected.voidput(java.lang.String key, java.lang.Object value)This is a convenience method for developers that prefer to think of this as a map instead of being bean-like.voidset(java.lang.String key, java.lang.Object value)This works just like a Map, except it will throw an exception if lock() has been called.java.lang.StringtoString()
-
-
-
Method Detail
-
get
public java.lang.Object get(java.lang.String key)
Description copied from interface:PolicyParametersFollows the contract for java.util.Map;- Specified by:
getin interfacePolicyParameters- Returns:
- The Object referred to by this key, if it exists.
- See Also:
Map
-
getBoolean
public boolean getBoolean(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The true/false value of the specified key. False if not found.
-
getByte
public byte getByte(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The byte value of the specified key.
-
getChar
public char getChar(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The char value of the specified key.
-
getInt
public int getInt(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The int value of the specified key.
-
getLong
public long getLong(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The long value of the specified key.
-
getFloat
public float getFloat(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The float value of the specified key.
-
getDouble
public double getDouble(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The double value of the specified key.
-
getBigDecimal
public java.math.BigDecimal getBigDecimal(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The BigDecimal value of the specified key.
-
getBigInteger
public java.math.BigInteger getBigInteger(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The BigInteger value of the specified key.
-
getDate
public java.util.Date getDate(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The Date value of the specified key.
-
getTime
public java.util.Date getTime(java.lang.String key)
Convenience method to avoid common casts. Note that the time object is the same as a date object- Parameters:
key-- Returns:
- The Date value of the specified key.
-
getString
public java.lang.String getString(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The String value of the specified key. null if the key is not defined.
-
getString
public java.lang.String getString(java.lang.String key, java.lang.String defaultValue)Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The String value of the specified key. If the key is not defined, the default value is returned instead.
-
getStringArray
public java.lang.String[] getStringArray(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The String[] value of the specified key.
-
getObject
public java.lang.Object getObject(java.lang.String key)
Convenience method to avoid common casts.- Parameters:
key-- Returns:
- The value of the specified key, returned generically as an Object.
-
set
public void set(java.lang.String key, java.lang.Object value) throws java.lang.IllegalArgumentExceptionDescription copied from interface:PolicyParametersThis works just like a Map, except it will throw an exception if lock() has been called.- Specified by:
setin interfacePolicyParameters- Throws:
java.lang.IllegalArgumentException- if this DynaBeanACRParameter instance has already been locked.
-
put
public void put(java.lang.String key, java.lang.Object value) throws java.lang.IllegalArgumentExceptionDescription copied from interface:PolicyParametersThis is a convenience method for developers that prefer to think of this as a map instead of being bean-like.- Specified by:
putin interfacePolicyParameters- Throws:
java.lang.IllegalArgumentException- See Also:
PolicyParameters.set(String, Object)
-
lock
public void lock()
This makes the map itself read only, but the mutability of objects that this map contains is not affected. Specifically, properties cannot be added or removed and the reference cannot be changed to a different object, but this does not change whether the values that the object contains can be changed.- Specified by:
lockin interfacePolicyParameters
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-