Package org.onosproject.cfg
Class ConfigProperty
- java.lang.Object
-
- org.onosproject.cfg.ConfigProperty
-
public final class ConfigProperty extends java.lang.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.java.lang.String
asString()
Returns the property value as a string.java.lang.String
defaultValue()
Returns the property default value as a string.static ConfigProperty
defineProperty(java.lang.String name, ConfigProperty.Type type, java.lang.String defaultValue, java.lang.String description)
Creates a new configuration property with its default value.java.lang.String
description()
Returns the property description.boolean
equals(java.lang.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.java.lang.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, java.lang.String newValue)
Creates a new configuration property as a copy of an existing one, but with a new value.java.lang.String
toString()
ConfigProperty.Type
type()
Returns the property type.java.lang.String
value()
Returns the property value as a string.
-
-
-
Method Detail
-
defineProperty
public static ConfigProperty defineProperty(java.lang.String name, ConfigProperty.Type type, java.lang.String defaultValue, java.lang.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, java.lang.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 java.lang.String name()
Returns the property name.- Returns:
- property name
-
type
public ConfigProperty.Type type()
Returns the property type.- Returns:
- property type
-
description
public java.lang.String description()
Returns the property description.- Returns:
- string value
-
defaultValue
public java.lang.String defaultValue()
Returns the property default value as a string.- Returns:
- string default value
-
value
public java.lang.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 java.lang.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
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Equality is considered only on the basis of property name.- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-