Class 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.LazyDynaMap policyProperties  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object get​(java.lang.String key)
      Follows the contract for java.util.Map;
      java.math.BigDecimal getBigDecimal​(java.lang.String key)
      Convenience method to avoid common casts.
      java.math.BigInteger getBigInteger​(java.lang.String key)
      Convenience method to avoid common casts.
      boolean getBoolean​(java.lang.String key)
      Convenience method to avoid common casts.
      byte getByte​(java.lang.String key)
      Convenience method to avoid common casts.
      char getChar​(java.lang.String key)
      Convenience method to avoid common casts.
      java.util.Date getDate​(java.lang.String key)
      Convenience method to avoid common casts.
      double getDouble​(java.lang.String key)
      Convenience method to avoid common casts.
      float getFloat​(java.lang.String key)
      Convenience method to avoid common casts.
      int getInt​(java.lang.String key)
      Convenience method to avoid common casts.
      long getLong​(java.lang.String key)
      Convenience method to avoid common casts.
      java.lang.Object getObject​(java.lang.String key)
      Convenience method to avoid common casts.
      java.lang.String getString​(java.lang.String key)
      Convenience method to avoid common casts.
      java.lang.String getString​(java.lang.String key, java.lang.String defaultValue)  
      java.lang.String[] getStringArray​(java.lang.String key)  
      java.util.Date getTime​(java.lang.String key)
      Convenience method to avoid common casts.
      void lock()
      This makes the map itself read only, but the mutability of objects that this map contains is not affected.
      void put​(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.
      void set​(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.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • policyProperties

        protected org.apache.commons.beanutils.LazyDynaMap policyProperties
    • Constructor Detail

      • DynaBeanACRParameter

        public DynaBeanACRParameter()
    • Method Detail

      • get

        public java.lang.Object get​(java.lang.String key)
        Description copied from interface: PolicyParameters
        Follows the contract for java.util.Map;
        Specified by:
        get in interface PolicyParameters
        Returns:
        See Also:
        Map
      • getBoolean

        public boolean getBoolean​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getByte

        public byte getByte​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getChar

        public char getChar​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getInt

        public int getInt​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getLong

        public long getLong​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getFloat

        public float getFloat​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getDouble

        public double getDouble​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getBigDecimal

        public java.math.BigDecimal getBigDecimal​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getBigInteger

        public java.math.BigInteger getBigInteger​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getDate

        public java.util.Date getDate​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • 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:
      • getString

        public java.lang.String getString​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.String defaultValue)
      • getStringArray

        public java.lang.String[] getStringArray​(java.lang.String key)
      • getObject

        public java.lang.Object getObject​(java.lang.String key)
        Convenience method to avoid common casts.
        Parameters:
        key -
        Returns:
      • set

        public void set​(java.lang.String key,
                        java.lang.Object value)
                 throws java.lang.IllegalArgumentException
        Description copied from interface: PolicyParameters
        This works just like a Map, except it will throw an exception if lock() has been called.
        Specified by:
        set in interface PolicyParameters
        Throws:
        java.lang.IllegalArgumentException - if this DynaBeanACRParameter instance has already been locked.
      • 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:
        lock in interface PolicyParameters
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object