public class GeneralNames extends java.lang.Object implements ASN1Type
GeneralNames
structure is defined as Vector of GeneralName
objects.
ASN.1 definition:
GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
GeneralName ::= CHOICE { otherName [0] OtherName, rfc822Name [1] IA5String, dNSName [2] IA5String, x400Address [3] ORAddress, directoryName [4] Name, ediPartyName [5] EDIPartyName, uniformResourceIdentifier [6] IA5String, iPAddress [7] OCTET STRING, registeredID [8] OBJECT IDENTIFIER}
OtherName ::= SEQUENCE { type-id OBJECT IDENTIFIER, value [0] EXPLICIT ANY DEFINED BY type-id }
EDIPartyName ::= SEQUENCE { nameAssigner [0] DirectoryString OPTIONAL, partyName [1] DirectoryString }
DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..maxSize), printableString PrintableString (SIZE (1..maxSize)), universalString UniversalString (SIZE (1..maxSize)), bmpString BMPString (SIZE(1..maxSIZE)) }
When creating a new GeneralNames
structure, a GeneralName
object immediatly may be supplied, e.g.:
GeneralNames gNames = new GeneralNames(new GeneralName(...));Further GeneralName objects may be added by means of the
addName
method, e.g.:
gNames.addName(new GeneralName(...));
ASN1Type
,
GeneralName
,
IA5String
,
OCTET_STRING
,
ObjectID
,
Name
,
T61String
,
PrintableString
,
UNIString
Constructor and Description |
---|
GeneralNames()
Default constructor.
|
GeneralNames(ASN1Object obj)
Constructs a GeneralNames object from an ASN1Object.
|
GeneralNames(GeneralName generalName)
Creates a GeneralNames structure from a GeneralName.
|
Modifier and Type | Method and Description |
---|---|
void |
addName(GeneralName generalName)
Adds a GeneralName to the list of general names.
|
boolean |
contains(GeneralName generalName)
Checks if the given GeneralName is contained in this GeneralName.
|
boolean |
containsGeneralName(int type)
Checks if the GeneralNames contains a GeneralName
of the requested type.
|
void |
decode(ASN1Object obj)
Decodes a
GeneralNames from the given ASN1Object. |
boolean |
equals(java.lang.Object obj)
Compares this GeneralNames with the given GeneralNames.
|
java.util.Enumeration |
getNames()
Returns an enumeration of the general names.
|
GeneralName[] |
getNames(int type)
Returns all general names of the given type.
|
int |
hashCode()
Returns a hash code value for this object.
|
void |
removeAllNames()
Removes all genereal names from the list.
|
int |
size()
Returns the number of GeneralName objects that are contained
in this GeneralNames.
|
ASN1Object |
toASN1Object()
Returns this
GeneralNames object as ASN1Object. |
java.lang.String |
toString()
Returns a string that represents the contents of this
GeneralNames object. |
public GeneralNames()
Use the addName
method for
adding a GeneralName.
public GeneralNames(GeneralName generalName)
addName
method for
adding further GeneralName objects.generalName
- the GeneralName to addpublic GeneralNames(ASN1Object obj) throws CodingException
The given ASN1Object represents an already existing GeneralNames structure
that may have been created by means of the toASN1Object
method.
obj
- the GeneralNames as ASN1ObjectCodingException
- if an parsing error occurspublic void decode(ASN1Object obj) throws CodingException
GeneralNames
from the given ASN1Object.
The ASN1Object may represent a single GeneralName
or may be
composed of several GeneralName
objects that have to be included
into the new GeneralNames
object.decode
in interface ASN1Type
obj
- the GeneralNames
ASN1Object consisting of one or more GeneralName
objectsCodingException
- if the ASN1Object don't realizes a GeneralName structurepublic void addName(GeneralName generalName)
generalName
- the GeneralName to addpublic void removeAllNames()
public java.util.Enumeration getNames()
public GeneralName[] getNames(int type)
type
- the type to be asked for (e.g. GeneralName.uniformResourceIdentifier)public boolean containsGeneralName(int type)
type
- the type to be asked for (e.g. GeneralName.uniformResourceIdentifier)true
if a GeneralName of the requested type is included,
false
if no such GeneralName is includedpublic ASN1Object toASN1Object() throws CodingException
GeneralNames
object as ASN1Object.toASN1Object
in interface ASN1Type
GeneralNames
as SEQUENCE ASN1ObjectCodingException
- if an de/encoding error occurspublic boolean equals(java.lang.Object obj)
This method steps through all GeneralName
objects included and compares them for equality.
equals
in class java.lang.Object
obj
- the other GeneralNamestrue
, if the two GeneralNames are equal, false
otherwisepublic int hashCode()
hashCode
in class java.lang.Object
public boolean contains(GeneralName generalName)
generalName
- the GeneralName to be checked if being includedtrue
if the given GeneralName is included,
false
otherwisepublic int size()
public java.lang.String toString()
GeneralNames
object.toString
in class java.lang.Object