ElementFilter
です。@Deprecated public class DeclarationFilter extends Object
サブクラスは、matches(Declaration)
メソッドを実装することによって、任意のフィルタを簡単に作成できます。
例
コレクションからの public 宣言の選択
クラス宣言の選択 (enum を含む)result = FILTER_PUBLIC.filter(decls);
クラス宣言の選択 (enum を除く)classFilter = DeclarationFilter.getFilter(ClassDeclaration.class); result = classFilter.filter(decls);
「Bob」という名前の宣言の選択enumFilter = DeclarationFilter.getFilter(EnumDeclaration.class); compoundFilter = classFilter.and(enumFilter.not()); result = compoundFilter.filter(decls);
nameFilter = new DeclarationFilter() { public boolean matches(Declaration d) { return d.getSimpleName().equals("Bob"); } }; result = nameFilter.filter(decls);
修飾子と型 | フィールドと説明 |
---|---|
static DeclarationFilter |
FILTER_PACKAGE
非推奨。
package-private (デフォルト) 宣言だけを選択するフィルタ。
|
static DeclarationFilter |
FILTER_PRIVATE
非推奨。
private 宣言だけを選択するフィルタ。
|
static DeclarationFilter |
FILTER_PROTECTED
非推奨。
protected 宣言だけを選択するフィルタ。
|
static DeclarationFilter |
FILTER_PUBLIC
非推奨。
public 宣言だけを選択するフィルタ。
|
static DeclarationFilter |
FILTER_PUBLIC_OR_PROTECTED
非推奨。
public または protected 宣言だけを選択するフィルタ。
|
コンストラクタと説明 |
---|
DeclarationFilter()
非推奨。
すべての宣言を選択する識別フィルタを構築します。
|
修飾子と型 | メソッドと説明 |
---|---|
DeclarationFilter |
and(DeclarationFilter f)
非推奨。
このフィルタと別のフィルタの両方により選択された宣言を選択するフィルタを返します。
|
<D extends Declaration> |
filter(Collection<? extends Declaration> decls, Class<D> resType)
非推奨。
結果を特定の種類の宣言に制限して、このフィルタに一致する宣言を返します。
|
<D extends Declaration> |
filter(Collection<D> decls)
非推奨。
このフィルタに一致する宣言を返します。
|
static DeclarationFilter |
getFilter(Class<? extends Declaration> kind)
非推奨。
特定の種類の宣言を選択するフィルタを返します。
|
static DeclarationFilter |
getFilter(Collection<Modifier> mods)
非推奨。
修飾子のコレクションをすべて含む宣言を選択するフィルタを返します。
|
boolean |
matches(Declaration decl)
非推奨。
このフィルタが特定の宣言に一致するかどうかをテストします。
|
DeclarationFilter |
not()
非推奨。
このフィルタが選択していない宣言を選択するフィルタを返します。
|
DeclarationFilter |
or(DeclarationFilter f)
非推奨。
このフィルタまたは別のフィルタのどちらかにより選択された宣言を選択するフィルタを返します。
|
public static final DeclarationFilter FILTER_PUBLIC
public static final DeclarationFilter FILTER_PROTECTED
public static final DeclarationFilter FILTER_PUBLIC_OR_PROTECTED
public static final DeclarationFilter FILTER_PACKAGE
public static final DeclarationFilter FILTER_PRIVATE
public static DeclarationFilter getFilter(Collection<Modifier> mods)
mods
- 一致する修飾子 (null 以外)public static DeclarationFilter getFilter(Class<? extends Declaration> kind)
kind
- 選択する宣言の種類public DeclarationFilter and(DeclarationFilter f)
f
- このフィルタと合成されるフィルタpublic DeclarationFilter or(DeclarationFilter f)
f
- このフィルタと合成されるフィルタpublic DeclarationFilter not()
public boolean matches(Declaration decl)
decl
- 一致する宣言public <D extends Declaration> Collection<D> filter(Collection<D> decls)
D
- フィルタ処理される宣言の型decls
- フィルタ処理される宣言public <D extends Declaration> Collection<D> filter(Collection<? extends Declaration> decls, Class<D> resType)
D
- 返される宣言の型decls
- フィルタ処理される宣言resType
- D のリフレクトの観点から、返される宣言の型
Copyright © 2004, 2013, Oracle and/or its affiliates. All rights reserved.