Skip to main content
summaryrefslogtreecommitdiffstats
blob: c88ba88cd1070350bd222d84d03793893120cdfe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.jst.ws.internal.common;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
import org.eclipse.jst.ws.internal.WSPluginMessages;

/**
* This is a kind of {@link Filter} that accepts all objects,
* and is a suitable base class for new <code>Filters</code>.
*/
public class AnyFilter implements Filter
{

  /**
  * Constructs a new <code>AnyFilter</code>.
  */
  public AnyFilter ()
  {
  }

  /**
  * Returns the locale-specific name of this filter.
  * @return The locale-specific name of this filter.
  */
  public String getName ()
  {
    return WSPluginMessages.ANY_FILTER_NAME;
  }

  /**
  * Returns the locale-specific description of this filter.
  * @return The locale-specific description of this filter.
  */
  public String getDescription ()
  {
    return WSPluginMessages.ANY_FILTER_DESC;
  }

  /**
  * Returns an {@link org.eclipse.core.runtime.IStatus}
  * describing the <code>Filter</code>'s assessment of
  * the given <code>object</code>.
  * See {@link Filter#statusOf} for general comments.
  * The default implementation of <code>AnyFilter</code>
  * returns a status with severity <code>IStatus.OK</code>.
  * Subclasses may override.
  * @param object The object to filter.
  * @return An {@link org.eclipse.core.runtime.IStatus}.
  */
  public IStatus statusOf ( Object object )
  {
    return new Status(IStatus.OK,WebServicePlugin.ID,0,"",null);
  }

  /**
  * Returns true if and only if {@link #statusOf} returns
  * an {@link org.eclipse.core.runtime.IStatus} with a
  * severity of less than <code>IStatus.ERROR</code>.
  * Subclasses may override to provide a higher-performance
  * implementation.
  * @param object The object to filter.
  * @return True if and only if {@link #statusOf} returns
  * an {@link org.eclipse.core.runtime.IStatus} with a
  * severity of less than <code>IStatus.ERROR</code>.
  */
  public boolean accepts ( Object object )
  {
    return !statusOf(object).matches(IStatus.ERROR);
  }
}

Back to the top