@Entity public class DbConfigurationParam extends SuperEntity<String>
checkConsistency(ConversionService)
to check that parameter is consistent state.Constructor and Description |
---|
DbConfigurationParam(String code,
String description,
String categoryCode,
String currentValue,
DataTypeEnum dataType)
Creates new configuration parameter.
|
DbConfigurationParam(String code,
String description,
String categoryCode,
String currentValue,
String defaultValue,
DataTypeEnum dataType,
boolean mandatory,
String validationRegEx)
Creates new configuration parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
checkConsistency(org.springframework.core.convert.ConversionService conversionService)
Checks consistency:
if mandatory=true then current or default value must be defined
if validationRegEx is defined then current value and default value are validated
if current and default values can be converted to the target data type
|
boolean |
equals(Object obj)
Two entities are equal if their ID is equal.
|
String |
getCategoryCode() |
String |
getCode() |
String |
getCurrentValue() |
Object |
getCurrentValueAsObject()
Gets current value converted to the object of appropriate type (integer, boolean etc).
|
DataTypeEnum |
getDataType() |
String |
getDefaultValue() |
Object |
getDefaultValueAsObject()
Gets default value converted to the object of appropriate type (integer, boolean etc).
|
String |
getDescription()
Gets parameter description.
|
String |
getId()
Get unique ID of the entity.
|
String |
getValidationRegEx() |
String |
getValue()
Gets value (current or default or even nothing).
|
boolean |
isMandatory() |
void |
setCategoryCode(String categoryCode)
Sets unique code for specific configuration scope, e.g.
|
void |
setCurrentValue(String currentValue)
Sets current (valid) value.
|
void |
setCurrentValueAsObject(Object currentValue)
Sets current value from object of appropriate type directly, it will be converted to string
to be stored in repository.
|
void |
setDataType(DataTypeEnum dataType)
Sets data type of current and default value.
|
void |
setDefaultValue(String defaultValue)
Sets default value if there is no value defined.
|
void |
setDefaultValueAsObject(Object defaultValue)
Sets default value from object of appropriate type directly, it will be converted to string
to be stored in repository.
|
void |
setId(String s)
Sets unique identifier of the entity.
|
void |
setMandatory(boolean mandatory)
Sets if this configuration parameter is mandatory.
|
void |
setValidationRegEx(String validationRegEx)
Sets regular expression for checking if current value is valid.
|
String |
toHumanString()
Returns human readable entity identification with start and end round brackets.
|
String |
toString() |
hashCode, isNew
public DbConfigurationParam(String code, String description, String categoryCode, @Nullable String currentValue, @Nullable String defaultValue, DataTypeEnum dataType, boolean mandatory, @Nullable String validationRegEx)
code
- Unique code of one configuration item, e.g. ohf.asyncThread.processing.count.namedescription
- Description of the parameter (in english).categoryCode
- Unique code for specific configuration scope, e.g. "dataSource" for data source settingscurrentValue
- Current (valid) valuedefaultValue
- Default value if there is no value defineddataType
- Data type of current and default valuemandatory
- Is this configuration item mandatory?
In other worlds must be at least one current or default value defined?validationRegEx
- Regular expression for checking if current value or default value is validpublic DbConfigurationParam(String code, String description, String categoryCode, @Nullable String currentValue, DataTypeEnum dataType)
code
- Unique code of one configuration item, e.g. ohf.asyncThread.processing.count.namedescription
- Description of the parameter (in english).categoryCode
- Unique code for specific configuration scope, e.g. "dataSource" for data source settingscurrentValue
- Current (valid) valuedataType
- Data type of current and default valuepublic String getCode()
public void setId(@Nullable String s)
Identifiable
setId
in interface Identifiable<String>
setId
in class SuperEntity<String>
s
- unique identifier@Nullable public String getId()
SuperEntity
getId
in interface Identifiable<String>
getId
in class SuperEntity<String>
public String getDescription()
public String getCategoryCode()
public void setCategoryCode(String categoryCode)
categoryCode
- The code for specific configuration scope@Nullable public String getValue()
public Object getCurrentValueAsObject()
public void setCurrentValueAsObject(Object currentValue)
currentValue
- the raw object of current value.public Object getDefaultValueAsObject()
public void setDefaultValueAsObject(Object defaultValue)
defaultValue
- the raw object of default value.public void checkConsistency(org.springframework.core.convert.ConversionService conversionService)
conversionService
- Conversion serviceConfigurationException
- when checking consistency failedpublic void setCurrentValue(@Nullable String currentValue)
currentValue
- The current valuepublic void setDefaultValue(@Nullable String defaultValue)
defaultValue
- The default valuepublic DataTypeEnum getDataType()
public void setDataType(DataTypeEnum dataType)
dataType
- The data typepublic boolean isMandatory()
public void setMandatory(boolean mandatory)
mandatory
- true
if configuration parameter is mandatory otherwise false
public void setValidationRegEx(@Nullable String validationRegEx)
validationRegEx
- The regular expressionPatternSyntaxException
- If the expression's syntax is invalidpublic boolean equals(Object obj)
SuperEntity
equals
in class SuperEntity<String>
public String toString()
toString
in class SuperEntity<String>
public String toHumanString()
HumanReadable
toHumanString
in interface HumanReadable
toHumanString
in class SuperEntity<String>
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.