Groovy Documentation

groovy.org.codenarc.util
[Groovy] Class ModifiersUtil

java.lang.Object
  groovy.org.codenarc.util.ModifiersUtil

class ModifiersUtil

Provide static utility methods for parsing AST member modifiers, e.g. public/protected/private, static, final, etc.

Authors:
Chris Mair


Method Summary
static boolean matchesAnyModifiers(Integer actualModifiers, List expectedModifiersList)

static boolean matchesModifiers(Integer actualModifiers, Integer expectedModifiers)

Return true only if the actualModifiers int value contains all of the bits (enabled) from the expectedModifiers

static int parseModifiers(String modifiersString)

Parse a group of whitespace-delimited modifier names

static List parseModifiersList(String modifiersString)

Parse comma-separated list of modifier groups

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Method Detail

matchesAnyModifiers

static boolean matchesAnyModifiers(Integer actualModifiers, List expectedModifiersList)


matchesModifiers

static boolean matchesModifiers(Integer actualModifiers, Integer expectedModifiers)
Return true only if the actualModifiers int value contains all of the bits (enabled) from the expectedModifiers
Returns:
true only if the actualModifiers contains all of the bits (enabled) from the expectedModifiers
Parameters:
actualModifiers - - the full actual modifiers; an int value of the OR-ed modifiers (values from Opcodes)
expectedModifiers - - the modifiers to check against; an int value of the OR-ed modifiers (values from Opcodes)


parseModifiers

static int parseModifiers(String modifiersString)
Parse a group of whitespace-delimited modifier names
Returns:
the int value of the OR-ed modifiers (values from Opcodes)
Parameters:
modifiersString - - a group of whitespace-delimited modifier names


parseModifiersList

static List parseModifiersList(String modifiersString)
Parse comma-separated list of modifier groups
Returns:
a List of the modifiers, one int value for each group (separated by commas)
Parameters:
modifiersString - - comma-separated list of modifier groups; each group is a list of whitespace-delimited modifier names; e.g. "public, protected static, protected final"


 

Groovy Documentation