Package org.openhab.core.common
Class AbstractUID
java.lang.Object
org.openhab.core.common.AbstractUID
- Direct Known Subclasses:
MetadataKey
,UID
A non specific base class for unique identifiers.
- Author:
- Markus Rathgeb - Initial contribution
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructor must be public, otherwise it can not be called by subclasses from another package.AbstractUID
(String uid) Parses a UID for a given string.AbstractUID
(String... segments) Creates an AbstractUID for a list of segments.AbstractUID
(List<String> segments) Creates a UID for list of segments. -
Method Summary
Modifier and TypeMethodDescriptionboolean
protected abstract int
Specifies how many segments the UID has to have at least.protected String
getSegment
(int segment) int
hashCode()
toString()
protected void
validateSegment
(String segment, int index, int length)
-
Field Details
-
SEGMENT_PATTERN
- See Also:
-
SEPARATOR
- See Also:
-
-
Constructor Details
-
AbstractUID
public AbstractUID()Constructor must be public, otherwise it can not be called by subclasses from another package. -
AbstractUID
Parses a UID for a given string. The UID must be in the format 'bindingId:segment:segment:...'.- Parameters:
uid
- uid in form a string
-
AbstractUID
Creates an AbstractUID for a list of segments.- Parameters:
segments
- the id segments
-
AbstractUID
Creates a UID for list of segments.- Parameters:
segments
- segments
-
-
Method Details
-
getMinimalNumberOfSegments
protected abstract int getMinimalNumberOfSegments()Specifies how many segments the UID has to have at least.- Returns:
- the number of segments
-
getAllSegments
-
getSegment
-
validateSegment
-
toString
-
getAsString
-
hashCode
public int hashCode() -
equals
-