Class ServletConfiguration

All Implemented Interfaces:
Configuration, EventSource, ImmutableConfiguration, SynchronizerSupport

A configuration wrapper around a ServletConfig. This configuration is read only, adding or removing a property will throw an UnsupportedOperationException.
Since:
1.1
  • Field Details

    • config

      protected javax.servlet.ServletConfig config
      Stores a reference to the wrapped ServletConfig.
  • Constructor Details

    • ServletConfiguration

      public ServletConfiguration(javax.servlet.Servlet servlet)
      Creates a ServletConfiguration using the initialization parameter of the specified servlet.
      Parameters:
      servlet - the servlet
    • ServletConfiguration

      public ServletConfiguration(javax.servlet.ServletConfig config)
      Creates a ServletConfiguration using the servlet initialization parameters.
      Parameters:
      config - the servlet configuration
  • Method Details

    • getKeysInternal

      Description copied from class: AbstractConfiguration
      Actually creates an iterator for iterating over the keys in this configuration. This method is called by getKeys(), it has to be defined by concrete subclasses.
      Specified by:
      getKeysInternal in class AbstractConfiguration
      Returns:
      an Iterator with all property keys in this configuration
    • getPropertyInternal

      Description copied from class: AbstractConfiguration
      Actually obtains the value of the specified property. This method is called by getProperty(). Concrete subclasses must define it to fetch the value of the desired property.
      Specified by:
      getPropertyInternal in class AbstractConfiguration
      Parameters:
      key - the key of the property in question
      Returns:
      the (raw) value of this property
    • addPropertyDirect

      protected void addPropertyDirect(String key, Object obj)
      Adds a property to this configuration. This operation is not supported and will throw an UnsupportedOperationException.
      Specified by:
      addPropertyDirect in class AbstractConfiguration
      Parameters:
      key - the key of the property
      obj - the value to be added
      Throws:
      UnsupportedOperationException - because this operation is not allowed
    • clearPropertyDirect

      protected void clearPropertyDirect(String key)
      Removes the property with the given key. This operation is not supported and will throw an UnsupportedOperationException.
      Specified by:
      clearPropertyDirect in class AbstractConfiguration
      Parameters:
      key - the key of the property to be removed
      Throws:
      UnsupportedOperationException - because this operation is not allowed
    • containsKeyInternal

      protected boolean containsKeyInternal(String key)
      Checks whether the specified key is stored in this configuration.
      Specified by:
      containsKeyInternal in class AbstractConfiguration
      Parameters:
      key - the key
      Returns:
      a flag whether this key exists in this configuration
    • containsValueInternal

      protected boolean containsValueInternal(Object value)
      Tests whether this configuration contains one or more matches to this value. This operation stops at first match but may be more expensive than the containsKey method
      Specified by:
      containsValueInternal in class AbstractConfiguration
      Parameters:
      value - the value in question
      Returns:
      true if and only if some key maps to the value argument in this configuration as determined by the equals method; false otherwise.
      Since:
      2.11.0
    • handleDelimiters

      protected Object handleDelimiters(Object value)
      Takes care of list delimiters in property values. This method checks if delimiter parsing is enabled and the passed in value contains a delimiter character. If this is the case, a split operation is performed.
      Parameters:
      value - the property value to be examined
      Returns:
      the processed value
    • isEmptyInternal

      protected boolean isEmptyInternal()
      Checks if this configuration is empty. This implementation makes use of the getKeys() method (which must be defined by concrete sub classes) to find out whether properties exist.
      Specified by:
      isEmptyInternal in class AbstractConfiguration
      Returns:
      a flag whether this configuration is empty