CStringProperty
A string property is a property class where key and value consist of strings.
The components of a string property are the key and the value.
Constructors
The first constructor takes the components of the class.
public CStringProperty(@NotNull final String aKey, @NotNull final String aValue);
This constructor takes key and value from a string in the form "key=value".
A value "key" (where the value is missing) is also accepted, in which case the value is empty.
An empty key leads to an exception.
public CStringProperty(@NotNull final String aCombined) throws CException;
There is also a copy constructor.
public CStringProperty(@NotNull final CStringProperty aOther);
Test
A random property can be created for testing purposes.
@NotNull public static CStringProperty random();
Getter
The getter methods return the components of the property.
@NotNull public String getKey(); @NotNull public String getValue();
Stream I/O
This method writes a property to a DataOutput stream.
public void toStream(@NotNull final DataOutput aStream) throws IOException;
This method reads a property from a DataInput stream.
@NotNull public static CStringProperty fromStream(@NotNull final DataInput aStream) throws IOException;
String I/O
The method generates a string in the form "key=value".
@NotNull public String valueToString();
The method adds a property in the form "key=value" to a list.
public void valueToList(@NotNull final List<String> aList);
Notice
The class supports the equals and hashCode methods.