Enum Class BlockType
- All Implemented Interfaces:
Serializable,Comparable<BlockType>,Constable
This enum is used to represent the type for a code block.
Important to distinguish between different types of blocks for correct instrumentation and report generation.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this block will be instrumented with a counter.booleanReturns whether this block has no opening and closing braces.booleanisMethod()Returns whether this block is a method or constructor method.booleanReturns whether this block is a switch statement or switch expression body.booleanReturns whether this block is a switch case.toString()static BlockTypeReturns the enum constant of this class with the specified name.static BlockType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BLOCK
-
METHOD
-
CONSTRUCTOR
-
STATIC
-
LOOP
-
TRY
-
LAMBDA
-
SWITCH_STMT
-
SWITCH_EXPR
-
COLON_CASE
-
ARROW_CASE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
toString
-
isSwitchBody
public boolean isSwitchBody()Returns whether this block is a switch statement or switch expression body.- Returns:
- true if the type is SWITCH_STMT or SWITCH_EXPR
-
isSwitchCase
public boolean isSwitchCase()Returns whether this block is a switch case.- Returns:
- true if the type is COLON_CASE or ARROW_CASE
-
isMethod
public boolean isMethod()Returns whether this block is a method or constructor method.- Returns:
- true if the type is METHOD or CONSTRUCTOR
-
hasCounter
public boolean hasCounter()Returns whether this block will be instrumented with a counter.- Returns:
- true if it is not a switch statement/expression body
-
hasNoBraces
public boolean hasNoBraces()Returns whether this block has no opening and closing braces.- Returns:
- true if the type is COLON_CASE
-