Class ObjectIdentifier
java.lang.Object
org.apache.harmony.security.utils.ObjectIdentifier
public final class ObjectIdentifier extends Object
Instance of this class represents ObjectIdentifier (OID).
OID is represented as a sequence of subidentifier.
Each subidentifier is represented as non negative integer value.
There are at least 2 subidentifiers in the sequence.
Valid values for first subidentifier are 0, 1 and 2.
If the first subidentifier has 0 or 1 value the second
subidentifier MUST be less then 40.
- See Also:
- ASN.1
-
Constructor Summary
Constructors Constructor Description ObjectIdentifier(int[] oid)Creates ObjectIdentifier(OID) from array of integers.ObjectIdentifier(int[] oid, String name, Object oidGroup)Creates ObjectIdentifier(OID) from array of integers. -
Method Summary
Modifier and Type Method Description booleanequals(Object o)Compares object with OID for equality.ObjectgetGroup()Gets OID's group.StringgetName()Gets OID's name.int[]getOid()Gets OID.inthashCode()Returns an integer hash code for this object.static inthashIntArray(int[] array)Returns hash code for array of integersStringtoOIDString()Add "OID." to the beginning of string representation.StringtoString()Overrides Object.toString()static voidvalidateOid(int[] oid)Validates ObjectIdentifier (OID).
-
Constructor Details
-
ObjectIdentifier
public ObjectIdentifier(int[] oid)Creates ObjectIdentifier(OID) from array of integers.- Parameters:
oid- - array of integers- Throws:
NullPointerException- - if oid is nullIllegalArgumentException- - if oid is invalid
-
ObjectIdentifier
Creates ObjectIdentifier(OID) from array of integers.- Parameters:
oid- - array of integersname- - name of OIDoidGroup- - OID's group. Is used to separate different OID's- Throws:
NullPointerException- - if oid is nullIllegalArgumentException- - if oid is invalid
-
-
Method Details
-
getOid
public int[] getOid()Gets OID.- Returns:
- oid
-
getName
Gets OID's name.- Returns:
- name
-
getGroup
Gets OID's group.- Returns:
- group
-
equals
Compares object with OID for equality.- Overrides:
equalsin classObject- Parameters:
o- the object to compare this instance with.- Returns:
- true if object is ObjectIdentifier and it has the same representation as array of integers, otherwise false
- See Also:
Object.hashCode()
-
toOIDString
Add "OID." to the beginning of string representation.- Returns:
- oid as string
-
toString
Overrides Object.toString() -
hashCode
public int hashCode()Description copied from class:ObjectReturns an integer hash code for this object. By contract, any two objects for whichObject.equals(java.lang.Object)returnstruemust return the same hash code value. This means that subclasses ofObjectusually override both methods or neither method.Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCodemethod if you intend implementing your ownhashCodemethod.- Overrides:
hashCodein classObject- Returns:
- this object's hash code.
- See Also:
Object.hashCode()
-
validateOid
public static void validateOid(int[] oid)Validates ObjectIdentifier (OID).- Parameters:
oid- - oid as array of integers- Throws:
NullPointerException- - if oid is nullIllegalArgumentException- - if oid is invalid
-
hashIntArray
public static int hashIntArray(int[] array)Returns hash code for array of integers- Parameters:
oid- - array of integers
-