Class StringValue
- java.lang.Object
-
- com.github.robtimus.os.windows.registry.RegistryValue
-
- com.github.robtimus.os.windows.registry.SettableRegistryValue
-
- com.github.robtimus.os.windows.registry.StringValue
-
public final class StringValue extends SettableRegistryValue
A representation of string registry values. Instances of this class are immutable.- Author:
- Rob Spoor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.github.robtimus.os.windows.registry.RegistryValue
RegistryValue.Filter
-
-
Field Summary
-
Fields inherited from class com.github.robtimus.os.windows.registry.RegistryValue
DEFAULT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
static StringValue
expandableOf(String name, String value)
Creates a new string registry value.String
expandedValue()
Returns the registry value's expanded string value.int
hashCode()
boolean
isExpandable()
Returns whether or not this registry value is an expandable string registry value.static StringValue
of(String name, String value)
Creates a new string registry value.String
toString()
String
value()
Returns the registry value's string value.StringValue
withExpandableValue(String value)
Returns a registry value with the same name as this registry value but a different value.StringValue
withName(String name)
Returns a registry value with the same value as this registry value but a different name.StringValue
withValue(String value)
Returns a registry value with the same name as this registry value but a different value.-
Methods inherited from class com.github.robtimus.os.windows.registry.RegistryValue
filter, name
-
-
-
-
Method Detail
-
of
public static StringValue of(String name, String value)
Creates a new string registry value.- Parameters:
name
- The name of the registry value.value
- The registry value's string value.- Returns:
- The created string registry value.
- Throws:
NullPointerException
- If the given name or value isnull
.
-
expandableOf
public static StringValue expandableOf(String name, String value)
Creates a new string registry value.- Parameters:
name
- The name of the registry value.value
- The registry value's string value.- Returns:
- The created string registry value.
- Throws:
NullPointerException
- If the given name or value isnull
.
-
value
public String value()
Returns the registry value's string value. For expandable string registry values, this is the unexpanded value. UseexpandedValue()
for the expanded value.- Returns:
- The registry value's string value.
-
isExpandable
public boolean isExpandable()
Returns whether or not this registry value is an expandable string registry value. If so, its value can be expanded.- Returns:
true
if this registry value is an expandable string registry value, orfalse
otherwise.- See Also:
expandedValue()
-
expandedValue
public String expandedValue()
Returns the registry value's expanded string value.- Returns:
- The registry value's expanded string value.
- Throws:
IllegalStateException
- If this registry value is notexpandable
.
-
withName
public StringValue withName(String name)
Description copied from class:SettableRegistryValue
Returns a registry value with the same value as this registry value but a different name.- Specified by:
withName
in classSettableRegistryValue
- Parameters:
name
- The name of the registry value to return.- Returns:
- A registry value with the same value as this registry value and the given name.
-
withValue
public StringValue withValue(String value)
Returns a registry value with the same name as this registry value but a different value. This registry value will not beexpandable
.- Parameters:
value
- The value of the registry value to return.- Returns:
- A registry value with the same name as this registry value and the given value.
- Throws:
NullPointerException
- If the given value isnull
.
-
withExpandableValue
public StringValue withExpandableValue(String value)
Returns a registry value with the same name as this registry value but a different value. This registry value will beexpandable
.- Parameters:
value
- The value of the registry value to return.- Returns:
- A registry value with the same name as this registry value and the given value.
- Throws:
NullPointerException
- If the given value isnull
.
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classRegistryValue
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classRegistryValue
-
-