Package com.treescrub.spedran.data
Class Variable
- java.lang.Object
-
- com.treescrub.spedran.data.Resource
-
- com.treescrub.spedran.data.IdentifiableResource
-
- com.treescrub.spedran.data.IdentifiableNamedResource
-
- com.treescrub.spedran.data.Variable
-
public class Variable extends IdentifiableNamedResource
A moderator defined variable for which a value can be set on aRun.
This class is immutable and thread-safe.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>getCategory()Gets the category ID that this variable applies to.Optional<String>getDefaultValue()Gets the default value ID for this variable.VariableScopegetScope()Gets theVariableScopewhere this variable is usable.Map<String,VariableValue>getValues()Gets aMapto map variable value IDs to aVariableValue.booleanisMandatory()Gets whether theUsersubmitting a run is required to set a value for this variable.booleanisObsoleting()Gets whether this variable having different values prevents runs from being obsoleted.booleanisSubcategory()Gets whether this variable is handled as a subcategory.booleanisUserDefined()Gets whether theUsersubmitting a run can enter custom values for this variable.StringtoString()-
Methods inherited from class com.treescrub.spedran.data.IdentifiableNamedResource
getName
-
Methods inherited from class com.treescrub.spedran.data.IdentifiableResource
equals, getId, hashCode
-
-
-
-
Method Detail
-
getCategory
public Optional<String> getCategory()
Gets the category ID that this variable applies to.- Returns:
- an
Optionalwith the category ID - See Also:
Spedran.getCategory(String)
-
getScope
public VariableScope getScope()
Gets theVariableScopewhere this variable is usable.- Returns:
- a
VariableScopeof this variable
-
isMandatory
public boolean isMandatory()
Gets whether theUsersubmitting a run is required to set a value for this variable.- Returns:
trueif this variable is required,falseotherwise
-
isUserDefined
public boolean isUserDefined()
Gets whether theUsersubmitting a run can enter custom values for this variable.- Returns:
trueif this variable can have custom values,falseotherwise
-
isObsoleting
public boolean isObsoleting()
Gets whether this variable having different values prevents runs from being obsoleted.- Returns:
trueif runs will be obsolete even if they have different values for this variable,falseotherwise
-
getValues
public Map<String,VariableValue> getValues()
Gets aMapto map variable value IDs to aVariableValue.- Returns:
- an unmodifiable
Mapwith keys being variable value IDs, and values beingVariableValue
-
getDefaultValue
public Optional<String> getDefaultValue()
Gets the default value ID for this variable.- Returns:
- the default value ID to use
-
isSubcategory
public boolean isSubcategory()
Gets whether this variable is handled as a subcategory.- Returns:
trueif this variable is a subcategory,falseotherwise
-
-