CWidgetId
A widget id identifies a widget on the client side.
It consists of a widget name and a widget set ID, which consists of a widget set name and an instance ID.
Creation
The easiest way is to create a widget ID from the components.
@NotNull
public static CWidgetId create(@Nullable final String aWidgetName,
@Nullable final String aWidgetSetName,
@Nullable final String aInstance);
@NotNull
public static CWidgetId create(@Nullable final String aWidgetName,
@Nullable final CWidgetSetId aWidgetSetId);
The string form of a widget ID is WidgetName.WidgetSetName.InstanceId.
Conversely, there is a factory method that generates the widget ID from such a
string.
@Nullable
public static CWidgetId valueFromString(@Nullable final String aValue);
From a DataInput stream you can read the widget ID as follows:
@Nullable
public static CWidgetId fromStream(@NotNull final DataInput aStream) throws IOException;
Convert to string
A widget ID can be easily converted to a string.
// returns null if the argument is null
@NotNull
public static String valueToString(@Nullable final CWidgetId aValue);
// or
public String valueToString();
Write to a DataOutput stream
The counterpart to reading from a DataInput stream is writing to a
DataOutput stream.
public static void toStream(@NotNull final DataOutput aStream,
@Nullable final CWidgetId aValue) throws IOException;
Getter
Name and instance ID can be fetched via getter. If the instance ID is missing, an empty string is returned.
// gives an empty String on null
@NotNull
public String getName();
@NotNull
public CWidgetSetId getWidgetSetId();
Check
The following method returns true if the name is not empty, and the widget set ID is valid.
public boolean isValid();
Notice
The class supports the equals(), the hashCode() and the toString()
methods.