Class StackFilter

java.lang.Object
org.simpleframework.xml.filter.StackFilter
All Implemented Interfaces:
Filter
Direct Known Subclasses:
PlatformFilter

public class StackFilter extends Object implements Filter
The StackFilter object provides a filter that can be given a collection of filters which can be used to resolve a replacement. The order of the resolution used for this filter is last in first used. This order allows the highest priority filter to be added last within the stack.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Stack<Filter>
    This is used to store the filters that are used.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the StackFilter object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    push(Filter filter)
    This pushes the the provided Filter on to the top of the stack.
    Replaces the text provided with the value resolved from the stacked filters.

    Methods inherited from class java.lang.Object

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

    • stack

      private Stack<Filter> stack
      This is used to store the filters that are used.
  • Constructor Details

    • StackFilter

      public StackFilter()
      Constructor for the StackFilter object. This will create an empty filter that initially resolves null for all replacements requested. As filters are pushed into the stack the replace method can resolve replacements.
  • Method Details

    • push

      public void push(Filter filter)
      This pushes the the provided Filter on to the top of the stack. The last filter pushed on to the stack has the highes priority in the resolution of a replacement value.
      Parameters:
      filter - this is a filter to be pushed on to the stack
    • replace

      public String replace(String text)
      Replaces the text provided with the value resolved from the stacked filters. This attempts to resolve a replacement from the top down. So the last Filter pushed on to the stack will be the first filter queried for a replacement.
      Specified by:
      replace in interface Filter
      Parameters:
      text - this is the text value to be replaced
      Returns:
      this will return the replacement text resolved