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.


The easiest way is to create a widget ID from the components.

public static CWidgetId create(@Nullable final String aWidgetName,
                               @Nullable final String aWidgetSetName,
                               @Nullable final String aInstance);

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.

public static CWidgetId valueFromString(@Nullable final String aValue);

From a DataInput stream you can read the widget ID as follows:

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
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;


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
public String getName();

public CWidgetSetId getWidgetSetId();


The following method returns true if the name is not empty, and the widget set ID is valid.

public boolean isValid();


The class supports the equals(), the hashCode() and the toString() methods. - Innovative Distributed System