Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.javatest
Class CompositeFilter

    java.lang.Object
      com.sun.javatest.TestFilter
          com.sun.javatest.CompositeFilter

    public class CompositeFilter

extends TestFilter

A filter which uses one or more filters to implement its accept method. This implementation only support immutable composites. The observer messages it sends out are adjusted so that the internal filter that rejected the test is returned, rather than the composite filter itself. This allows observing clients to see which non-composite filter actually rejected the test in question. Composite filters within composite filters should also be transparent to the observer mechanism.

Nested Class Summary

Nested classes/interfaces inherited from class com.sun.javatest.TestFilter
`TestFilter.Fault, TestFilter.Observer`

Constructor Summary
`CompositeFilter(TestFilter[] filters)` Construct an unnamed filter composed of the given filters.
`CompositeFilter(TestFilter[] filters, I18NResourceBundle bundle, java.lang.String prefix)` This is the preferred constructor which creates a filter composed of the given filters, with descriptive string from a resource bundle.

Method Summary
`boolean` | `accepts(TestDescription td)` Determines whether a TestDescription should be accepted or rejected by this filter.
`boolean` | `accepts(TestDescription td, TestFilter.Observer o)` Determines whether a TestDescription should be accepted or rejected by this filter; if rejected, it is reported to the provided observer.
`boolean` | `equals(java.lang.Object tf)` This implementation will compare the filters in the parameter filter to the ones in this instance.
`static boolean` | `equals(TestFilter[] array1, TestFilter[] array2)` Check if two arrays are equal, using set-equality.
`java.lang.String` | `getDescription()` Get a description of this filter, as might be used to give more details about this filter than provided by `TestFilter.getName()`.
`TestFilter[]` | `getFilters()` Return the filters being used internally by this composite.
`java.lang.String` | `getName()` Get the name of this filter, as might be used to choose of of a set of filters.
`java.lang.String` | `getReason()` Get the reason why this filter would reject a test, as might be used in reports.
`int` | `hashCode()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CompositeFilter

    public CompositeFilter(TestFilter[] filters,
                           I18NResourceBundle bundle,
                           java.lang.String prefix)

  This is the preferred constructor which creates a filter composed of the given filters, with descriptive string from a resource bundle. Inside the given resource bundle, the following keys should provided with the supplied prefix:
  - description
  - name
  - reason
  See the `TestFilter` class for a description of these values.

  An empty set of filters is accepted for convienience, but will result allowing all tests passing through for filtering to be accepted.

  Parameters:
    `filters` - The filters that constitute this composite filter. Must never be null.
    `bundle` - The bundle to get the description, name and reason from. Must never be null.
    `prefix` - Prefix with which begins the I18N key for the description, name and reason. Must never be null.
  See Also:
    `TestFilter`

### CompositeFilter

    public CompositeFilter(TestFilter[] filters)

  Construct an unnamed filter composed of the given filters. By using an unnamed filter, any clients querying this object for name, description or rejection reason will get a general-purpose string. This is usually acceptable for composites which are operating at a level where messages will never be user-visible.

  An empty set of filters is accepted for convienience, but will result allowing all tests passing through for filtering to be accepted.

  Parameters:
    `filters` - The filters that constitute this composite filter. Must never be null.
  See Also:
    `CompositeFilter(TestFilter[],I18NResourceBundle,String)`

Method Detail

### getName

    public java.lang.String getName()

  Description copied from class: `TestFilter`
  Get the name of this filter, as might be used to choose of of a set of filters. This string should be localized.

  Specified by:
    `getName` in class `TestFilter`
  Returns:
    the name of this filter

### getDescription

    public java.lang.String getDescription()

  Description copied from class: `TestFilter`
  Get a description of this filter, as might be used to give more details about this filter than provided by `TestFilter.getName()`. This string should be localized.

  Specified by:
    `getDescription` in class `TestFilter`
  Returns:
    a description of this filter

### getReason

    public java.lang.String getReason()

  Description copied from class: `TestFilter`
  Get the reason why this filter would reject a test, as might be used in reports. This string should be localized.

  Specified by:
    `getReason` in class `TestFilter`
  Returns:
    a rejection reason for this filter

### accepts

    public boolean accepts(TestDescription td)
                    throws TestFilter.Fault

  Description copied from class: `TestFilter`
  Determines whether a TestDescription should be accepted or rejected by this filter.

  Specified by:
    `accepts` in class `TestFilter`
  Parameters:
    `td` - the TestDescription to check
  Returns:
    true if td should be included in collection; false otherwise.
  Throws:
    `TestFilter.Fault` - if an error occurs while trying to determine if this test should be accepted or not.

### accepts

    public boolean accepts(TestDescription td,
                           TestFilter.Observer o)
                    throws TestFilter.Fault

  Description copied from class: `TestFilter`
  Determines whether a TestDescription should be accepted or rejected by this filter; if rejected, it is reported to the provided observer.

  Overrides:
    `accepts` in class `TestFilter`
  Parameters:
    `td` - The TestDescription to check.
    `o` - An observer, which will be notified if the test is rejected by this filter.
  Returns:
    true if td should be included in collection; false otherwise.
  Throws:
    `TestFilter.Fault` - if an error occurs while trying to determine if this test should be accepted or not.

### equals

    public boolean equals(java.lang.Object tf)

  This implementation will compare the filters in the parameter filter to the ones in this instance. If the parameter is not a CompositeFilter, this test fails immediately. Recursive checks do not occur - meaning that composites inside composites are not checked. An empty set is equivalent to an empty set. This is a element-wise compare only.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `tf` - The object to be checked for equality with this one
  Returns:
    true if this object equals the argument object
  See Also:
    `Object.equals(Object)`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### getFilters

    public TestFilter[] getFilters()

  Return the filters being used internally by this composite.

  Returns:
    The filters in use. Zero length array if none. Never null. Shallow copy.

### equals

    public static boolean equals(TestFilter[] array1,
                                 TestFilter[] array2)

  Check if two arrays are equal, using set-equality.

  Parameters:
    `array1` - First set of filters; may not be null.
    `array2` - Second set of filters; may not be null.
  Returns:
    true of the two arrays of filters are equivalent.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.