Package b4j.core

Class DefaultSearchData

java.lang.Object
b4j.core.DefaultSearchData
All Implemented Interfaces:
SearchData, IConfigurable

public class DefaultSearchData
extends java.lang.Object
implements SearchData
Default implementation of SearchData. This class can read it's parameters and values from a configuration object.
Author:
Ralph Schuster
  • Constructor Summary

    Constructors 
    Constructor Description
    DefaultSearchData()
    Default constructor.
  • Method Summary

    Modifier and Type Method Description
    void add​(java.lang.String parameter, java.lang.String value)
    Adds a value for a specific search parameter.
    void add​(java.lang.String parameter, java.lang.String[] values)
    Adds a search parameter with specified values.
    void add​(java.lang.String parameter, java.util.List<java.lang.String> values)
    Adds a search parameter with specified values.
    void configure​(org.apache.commons.configuration.Configuration config)
    Configures the search data from configuration.
    void dump​(org.slf4j.Logger log)
    Debug information into log.
    java.lang.Iterable<java.lang.String> get​(java.lang.String parameter)
    Returns an iterator of all values for specified parameter key.
    int getParameterCount()
    Returns the number of parameter names.
    java.lang.Iterable<java.lang.String> getParameterNames()
    Returns an iterator of all parameter names.
    boolean hasParameter​(java.lang.String name)
    Returns true if parameter name is set.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • configure

      public void configure​(org.apache.commons.configuration.Configuration config) throws org.apache.commons.configuration.ConfigurationException
      Configures the search data from configuration. All elements of the configuration are taken as search parameters. For XML documents this means: <parameter-name>parameter-value</parameter-name> Multiple values are allowed.
      Specified by:
      configure in interface IConfigurable
      Parameters:
      config - - configuration data
      Throws:
      org.apache.commons.configuration.ConfigurationException - - if configuration fails
    • add

      public void add​(java.lang.String parameter, java.lang.String[] values)
      Adds a search parameter with specified values. Existing values of this parameter must not be overridden.
      Specified by:
      add in interface SearchData
      Parameters:
      parameter - - name of parameter
      values - - array of additional values for parameter
    • add

      public void add​(java.lang.String parameter, java.util.List<java.lang.String> values)
      Adds a search parameter with specified values. Existing values of this parameter must not be overridden.
      Specified by:
      add in interface SearchData
      Parameters:
      parameter - - name of parameter
      values - - list of additional values for parameter
    • add

      public void add​(java.lang.String parameter, java.lang.String value)
      Adds a value for a specific search parameter.
      Specified by:
      add in interface SearchData
      Parameters:
      parameter - - name of parameter
      value - - value to add for parameter
    • getParameterCount

      public int getParameterCount()
      Returns the number of parameter names.
      Specified by:
      getParameterCount in interface SearchData
      Returns:
      number of parameter names.
    • getParameterNames

      public java.lang.Iterable<java.lang.String> getParameterNames()
      Returns an iterator of all parameter names.
      Specified by:
      getParameterNames in interface SearchData
      Returns:
      iterator on parameter names
    • get

      public java.lang.Iterable<java.lang.String> get​(java.lang.String parameter)
      Returns an iterator of all values for specified parameter key. This methods must return null if no such parameter exists.
      Specified by:
      get in interface SearchData
      Parameters:
      parameter - - name of parameter.
      Returns:
      iterator on values of parameter
    • dump

      public void dump​(org.slf4j.Logger log)
      Debug information into log. This method supports debugging functionality.
      Specified by:
      dump in interface SearchData
      Parameters:
      log - - log to dump into.
    • hasParameter

      public boolean hasParameter​(java.lang.String name)
      Returns true if parameter name is set.
      Specified by:
      hasParameter in interface SearchData
      Parameters:
      name - parameter name
      Returns:
      true or false