Enum CompareType
- java.lang.Object
-
- java.lang.Enum<CompareType>
-
- com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.CompareType
-
- All Implemented Interfaces:
Serializable
,Comparable<CompareType>
public enum CompareType extends Enum<CompareType>
Enum of different ways of comparing a pattern.- Author:
- Robert Sandell <robert.sandell@sonyericsson.com>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CompareType
findByDisplayName(String displayName)
Finds a CompareType based on displayName.static CompareType
findByOperator(char operator)
Finds a CompareType based on the operator.String
getDisplayName()
Returns a "human readable" name of the instance.static List<String>
getDisplayNames()
Gets a list of all CompareType's displayNames.char
getOperator()
Returns the operator, the one-char identifier for the CompareType.boolean
matches(String pattern, String str)
Tells if the given string matches the given pattern based on the algorithm of this CompareType instance.String
toString()
static CompareType
valueOf(String name)
Returns the enum constant of this type with the specified name.static CompareType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PLAIN
public static final CompareType PLAIN
Plain equals comparison.
-
ANT
public static final CompareType ANT
ANT style path comparison.
-
REG_EXP
public static final CompareType REG_EXP
Regular expression comparison.
-
-
Method Detail
-
values
public static CompareType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CompareType c : CompareType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CompareType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getDisplayNames
public static List<String> getDisplayNames()
Gets a list of all CompareType's displayNames.- Returns:
- a list of available displaynames.
-
findByDisplayName
public static CompareType findByDisplayName(String displayName)
Finds a CompareType based on displayName.- Parameters:
displayName
- the displayName- Returns:
- the CompareType that matches the displayName or PLAIN if none is found.
-
findByOperator
public static CompareType findByOperator(char operator)
Finds a CompareType based on the operator.- Parameters:
operator
- the operator.- Returns:
- the CompareType that matches the operator or PLAIN if none is found.
-
matches
public boolean matches(String pattern, String str)
Tells if the given string matches the given pattern based on the algorithm of this CompareType instance.- Parameters:
pattern
- the patternstr
- the string- Returns:
- true if the string matches the pattern.
-
getDisplayName
public String getDisplayName()
Returns a "human readable" name of the instance.- Returns:
- the display name
-
getOperator
public char getOperator()
Returns the operator, the one-char identifier for the CompareType.- Returns:
- the operator.
-
toString
public String toString()
- Overrides:
toString
in classEnum<CompareType>
-
-