Package org.glassfish.rmic.tools.util
Class ModifierFilter
- java.lang.Object
-
- java.lang.reflect.Modifier
-
- org.glassfish.rmic.tools.util.ModifierFilter
-
public class ModifierFilter extends java.lang.reflect.Modifier
A class whose instances are filters over Modifier bits. Filtering is done by returning boolean values. Classes, methods and fields can be filtered, or filtering can be done directly on modifier bits. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.- See Also:
Modifier
-
-
Field Summary
Fields Modifier and Type Field Description private static int
ACCESS_BITS
static long
ALL_ACCESS
All access modifiers.private long
cannot
private long
must
private long
oneOf
static long
PACKAGE
Package private access.
-
Constructor Summary
Constructors Constructor Description ModifierFilter(long oneOf)
Constructor - Specify a filter.ModifierFilter(long oneOf, long must, long cannot)
Constructor - Specify a filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkClass(ClassDefinition cdef)
Filter a ClassDefinition.boolean
checkMember(MemberDefinition field)
Filter a MemberDefinition.boolean
checkModifier(int modifierBits)
Filter on modifier bits.-
Methods inherited from class java.lang.reflect.Modifier
classModifiers, constructorModifiers, fieldModifiers, interfaceModifiers, isAbstract, isFinal, isInterface, isNative, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isTransient, isVolatile, methodModifiers, parameterModifiers, toString
-
-
-
-
Field Detail
-
PACKAGE
public static final long PACKAGE
Package private access. A "pseudo-" modifier bit that can be used in the constructors of this class to specify package private access. This is needed since there is no Modifier.PACKAGE.- See Also:
- Constant Field Values
-
ALL_ACCESS
public static final long ALL_ACCESS
All access modifiers. A short-hand set of modifier bits that can be used in the constructors of this class to specify all access modifiers, Same as PRIVATE | PROTECTED | PUBLIC | PACKAGE.- See Also:
- Constant Field Values
-
oneOf
private long oneOf
-
must
private long must
-
cannot
private long cannot
-
ACCESS_BITS
private static final int ACCESS_BITS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ModifierFilter
public ModifierFilter(long oneOf)
Constructor - Specify a filter.- Parameters:
oneOf
- If zero, everything passes the filter. If non-zero, at least one of the specified bits must be on in the modifier bits to pass the filter.
-
ModifierFilter
public ModifierFilter(long oneOf, long must, long cannot)
Constructor - Specify a filter. For example, the filter below will only pass synchronized methods that are private or package private access and are not native or static.ModifierFilter( Modifier.PRIVATE | ModifierFilter.PACKAGE, Modifier.SYNCHRONIZED, Modifier.NATIVE | Modifier.STATIC)
Each of the three arguments must either be zero or the or'ed combination of the bits specified in the class Modifier or this class. During filtering, these values are compared against the modifier bits as follows:
- Parameters:
oneOf
- If zero, ignore this argument. If non-zero, at least one of the bits must be on.must
- All bits specified must be on.cannot
- None of the bits specified can be on.
-
-
Method Detail
-
checkModifier
public boolean checkModifier(int modifierBits)
Filter on modifier bits.- Parameters:
modifierBits
- Bits as specified in the Modifier class- Returns:
- Whether the modifierBits pass this filter.
-
checkMember
public boolean checkMember(MemberDefinition field)
Filter a MemberDefinition.- Parameters:
field
- A MemberDefinition- Returns:
- Whether the modifier of the field passes this filter.
- See Also:
org.glassfish.rmic.tools.MemberDefinition
-
checkClass
public boolean checkClass(ClassDefinition cdef)
Filter a ClassDefinition.- Parameters:
cdef
- A ClassDefinition- Returns:
- Whether the modifier of the class passes this filter.
- See Also:
org.glassfish.rmic.tools.ClassDefinition
-
-