public final class OID extends Object implements Serializable, Comparable<OID>
| 构造器和说明 |
|---|
OID(int... components)
Creates a new OID object from the provided set of numeric components.
|
OID(List<Integer> components)
Creates a new OID object from the provided set of numeric components.
|
OID(OID parentOID,
int childComponent)
Creates a new OID that is a child of the provided parent OID.
|
OID(String oidString)
Creates a new OID object from the provided string representation.
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
compareTo(OID oid)
Indicates the position of the provided object relative to this OID in a
sorted list.
|
boolean |
equals(Object o)
Indicates whether the provided object is equal to this OID.
|
List<Integer> |
getComponents()
Retrieves the numeric components that comprise this OID.
|
OID |
getParent()
Retrieves the OID that is the parent for this OID.
|
int |
hashCode()
Retrieves a hash code for this OID.
|
boolean |
isAncestorOf(OID oid)
Indicates whether this OID is an ancestor of the provided OID.
|
boolean |
isDescendantOf(OID oid)
Indicates whether this OID is a descendant of the provided OID.
|
boolean |
isStrictlyValidNumericOID()
Indicates whether this object represents a strictly valid numeric OID.
|
static boolean |
isStrictlyValidNumericOID(String s)
Indicates whether this object represents a strictly valid numeric OID.
|
boolean |
isValidNumericOID()
Indicates whether the provided string represents a valid numeric OID.
|
static boolean |
isValidNumericOID(String s)
Indicates whether the provided string represents a valid numeric OID.
|
static List<Integer> |
parseComponents(String oidString)
Parses the provided string as a numeric OID and extracts the numeric
components from it.
|
static OID |
parseNumericOID(String oidString,
boolean strict)
Parses the provided string as a numeric OID, optionally using additional
strict validation.
|
String |
toString()
Retrieves a string representation of this OID.
|
public OID(@Nullable String oidString)
oidString - The string to use to create this OID.public OID(@Nullable int... components)
components - The numeric components to include in the OID.public OID(@Nullable List<Integer> components)
components - The numeric components to include in the OID.public OID(@NonNull OID parentOID, int childComponent) throws ParseException
parentOID - The parent OID below which the child should be
created. It must not be null, and it must
be a valid numeric OID.childComponent - The integer value for the child component.ParseException - If the provided parent OID is not a valid numeric
OID.@Nullable public static List<Integer> parseComponents(@Nullable String oidString)
oidString - The string to parse as a numeric OID.null if the provided string does not represent a valid
numeric OID.@NonNull public static OID parseNumericOID(@Nullable String oidString, boolean strict) throws ParseException
oidString - The string to be parsed as a numeric OID. It must not
be null.strict - Indicates whether to use strict validation. If this is
false, then the method will verify that the
provided string is made up of a dotted list of numbers
that does not start or end with a period and does not
contain consecutive periods. If this is true,
then it will additional verify that the OID contains at
least two components, that the value of the first
component is not greater than two, and that the value of
the second component is not greater than 39 if the value
of the first component is zero or one.ParseException - If the provided string cannot be parsed as a valid
numeric OID.public static boolean isValidNumericOID(@Nullable String s)
isStrictlyValidNumericOID(String) method
performs additional validation, including ensuring that the OID contains
at least two components, that the value of the first component is not
greater than two, and that the value of the second component is not greater
than 39 if the value of the first component is zero or one.s - The string for which to make the determination.true if the provided string represents a valid numeric
OID, or false if not.public boolean isValidNumericOID()
isStrictlyValidNumericOID() method
performs additional validation, including ensuring that the OID contains
at least two components, that the value of the first component is not
greater than two, and that the value of the second component is not greater
than 39 if the value of the first component is zero or one.true if this object represents a valid numeric OID, or
false if not.public static boolean isStrictlyValidNumericOID(@Nullable String s)
s - The string for which to make the determination.true if this object represents a strictly valid numeric
OID, or false if not.public boolean isStrictlyValidNumericOID()
true if this object represents a strictly valid numeric
OID, or false if not.@Nullable public List<Integer> getComponents()
null value if isValidNumericOID(java.lang.String) returns
true.null if
this object does not represent a valid numeric OID.@Nullable public OID getParent() throws ParseException
null if this
OID doesn't have a parent. Note that the returned OID may not
necessarily be strictly valid in some cases (for example, if this
OID only contains two components, as all strictly valid OIDs must
contain at least two components).ParseException - If this OID does not represent a valid numeric
OID.public boolean isAncestorOf(@NonNull OID oid) throws ParseException
oid - The OID for which to make the determination. It must not be
null, and it must represent a valid numeric OID.true if this OID is an ancestor of the provided OID, or
false if not.ParseException - If either this OID or the provided OID does not
represent a valid numeric OID.public boolean isDescendantOf(@NonNull OID oid) throws ParseException
oid - The OID for which to make the determination. It must not be
null, and it must represent a valid numeric OID.true if this OID is a descendant of the provided OID, or
false if not.ParseException - If either this OID or the provided OID does not
represent a valid numeric OID.public int hashCode()
public boolean equals(@Nullable Object o)
public int compareTo(@NonNull OID oid)
compareTo 在接口中 Comparable<OID>oid - The OID to compare against this OID.Copyright © 2022. All rights reserved.