Package org.onosproject.cfg
Class ConfigProperty
- java.lang.Object
-
- org.onosproject.cfg.ConfigProperty
-
public final class ConfigProperty extends Object
Component configuration property.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfigProperty.Type
Representation of the type of property value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
asBoolean()
Returns the property value as a boolean.byte
asByte()
Returns the property value as a byte.double
asDouble()
Returns the property value as a double.float
asFloat()
Returns the property value as a float.int
asInteger()
Returns the property value as an integer.long
asLong()
Returns the property value as a long.String
asString()
Returns the property value as a string.String
defaultValue()
Returns the property default value as a string.static ConfigProperty
defineProperty(String name, ConfigProperty.Type type, String defaultValue, String description)
Creates a new configuration property with its default value.String
description()
Returns the property description.boolean
equals(Object obj)
Equality is considered only on the basis of property name.int
hashCode()
boolean
isSet()
Indicates whether the property is set or whether it assumes its default value.String
name()
Returns the property name.static ConfigProperty
resetProperty(ConfigProperty property)
Creates a new configuration property as a copy of an existing one, but without a specific value, thus making it take its default value.static ConfigProperty
setProperty(ConfigProperty property, String newValue)
Creates a new configuration property as a copy of an existing one, but with a new value.String
toString()
ConfigProperty.Type
type()
Returns the property type.String
value()
Returns the property value as a string.
-
-
-
Method Detail
-
defineProperty
public static ConfigProperty defineProperty(String name, ConfigProperty.Type type, String defaultValue, String description)
Creates a new configuration property with its default value.- Parameters:
name
- property nametype
- value typedefaultValue
- default value as a stringdescription
- property description- Returns:
- newly defined property
-
setProperty
public static ConfigProperty setProperty(ConfigProperty property, String newValue)
Creates a new configuration property as a copy of an existing one, but with a new value.- Parameters:
property
- property to be changednewValue
- new value as a string- Returns:
- newly updated property
-
resetProperty
public static ConfigProperty resetProperty(ConfigProperty property)
Creates a new configuration property as a copy of an existing one, but without a specific value, thus making it take its default value.- Parameters:
property
- property to be reset- Returns:
- newly reset property
-
name
public String name()
Returns the property name.- Returns:
- property name
-
type
public ConfigProperty.Type type()
Returns the property type.- Returns:
- property type
-
description
public String description()
Returns the property description.- Returns:
- string value
-
defaultValue
public String defaultValue()
Returns the property default value as a string.- Returns:
- string default value
-
value
public String value()
Returns the property value as a string.- Returns:
- string value
-
isSet
public boolean isSet()
Indicates whether the property is set or whether it assumes its default value.- Returns:
- true if the property is set
-
asString
public String asString()
Returns the property value as a string.- Returns:
- string value
-
asByte
public byte asByte()
Returns the property value as a byte.- Returns:
- byte value
-
asInteger
public int asInteger()
Returns the property value as an integer.- Returns:
- integer value
-
asLong
public long asLong()
Returns the property value as a long.- Returns:
- long value
-
asFloat
public float asFloat()
Returns the property value as a float.- Returns:
- float value
-
asDouble
public double asDouble()
Returns the property value as a double.- Returns:
- double value
-
asBoolean
public boolean asBoolean()
Returns the property value as a boolean.- Returns:
- string value
-
equals
public boolean equals(Object obj)
Equality is considered only on the basis of property name.
-
-