Class VariableUtil
- java.lang.Object
-
- cern.accsoft.steering.jmad.domain.var.VariableUtil
-
public final class VariableUtil extends java.lang.Object
This class provides some methods to handle variables which are implemented in enums.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.lang.Enum<T> & MadxVariable>
TfindFromMadxName(java.lang.Class<T> enumClass, java.lang.String madxName, T defaultValue)
finds the variable out of the given enum which corresponds to the given madx-name.static <T extends java.lang.Enum<T> & MadxVariable>
java.util.Set<T>findFromVarType(java.lang.Class<T> enumClass, MadxVarType varType)
finds all the variables which are contained in the given enum which have the given varTypestatic java.lang.String
toString(Variable var)
composes the name and unit of the variable to a string
-
-
-
Method Detail
-
findFromVarType
public static <T extends java.lang.Enum<T> & MadxVariable> java.util.Set<T> findFromVarType(java.lang.Class<T> enumClass, MadxVarType varType)
finds all the variables which are contained in the given enum which have the given varType- Type Parameters:
T
- the enum type from which to get the variables- Parameters:
enumClass
- the class of the enum which to search for variablesvarType
- the type of variables to return- Returns:
- a set of those Variables
-
findFromMadxName
public static <T extends java.lang.Enum<T> & MadxVariable> T findFromMadxName(java.lang.Class<T> enumClass, java.lang.String madxName, T defaultValue)
finds the variable out of the given enum which corresponds to the given madx-name.- Type Parameters:
T
- the enum type from which to find the variables- Parameters:
enumClass
- the class of the enum which to search for the variablemadxName
- the madx name of the variable to finddefaultValue
- the value which is returned, if no variable could be found from the name- Returns:
- the variable if found, or
null
if no variable could be found.
-
toString
public static java.lang.String toString(Variable var)
composes the name and unit of the variable to a string- Parameters:
var
- the variable to convert to a string- Returns:
- the string representation of the variable
-
-