Package org.forgerock.opendj.ldap
Class AttributeParser
- java.lang.Object
-
- org.forgerock.opendj.ldap.AttributeParser
-
public final class AttributeParser extends Object
A fluent API for parsing attributes as different types of object. An attribute parser is obtained from an entry using the methodEntry.parseAttribute(org.forgerock.opendj.ldap.AttributeDescription)or from an attribute usingAttribute.parse().Methods throw an
IllegalArgumentExceptionwhen a value cannot be parsed (e.g. because its syntax is invalid). Methods which return aSetalways return a modifiable non-nullresult, even if the attribute isnullor empty.Examples:
Entry entry = ...; Calendar timestamp = entry.parseAttribute("createTimestamp").asCalendar(); boolean isEnabled = entry.parseAttribute("enabled").asBoolean(false); Entry group = ...; Schema schema = ...; Set<DN> members = group.parseAttribute("member").usingSchema(schema).asSetOfDN();
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T,E extends Exception>
Tas(Function<ByteString,? extends T,E> f)Returns the first value decoded as aTusing the providedFunction, ornullif the attribute does not contain any values.<T,E extends Exception>
Tas(Function<ByteString,? extends T,E> f, T defaultValue)Returns the first value decoded as aTusing the providedFunction, ordefaultValueif the attribute does not contain any values.AttributeDescriptionasAttributeDescription()Returns the first value decoded as anAttributeDescriptionusing the schema associated with this parser, ornullif the attribute does not contain any values.AttributeDescriptionasAttributeDescription(String defaultValue)Returns the first value decoded as anAttributeDescriptionusing the schema associated with this parser, ordefaultValueif the attribute does not contain any values.AttributeDescriptionasAttributeDescription(AttributeDescription defaultValue)Returns the first value decoded as anAttributeDescriptionusing the schema associated with this parser, ordefaultValueif the attribute does not contain any values.BooleanasBoolean()Returns the first value decoded as a boolean, ornullif the attribute does not contain any values.booleanasBoolean(boolean defaultValue)Returns the first value decoded as anBoolean, ordefaultValueif the attribute does not contain any values.ByteStringasByteString()Returns the first value, ornullif the attribute does not contain any values.ByteStringasByteString(ByteString defaultValue)Returns the first value, ordefaultValueif the attribute does not contain any values.X509CertificateasCertificate()Returns the first value decoded as aX509Certificate, ornullif the attribute does not contain any values.X509CertificateasCertificate(X509Certificate defaultValue)Returns the first value decoded as aX509Certificate, ordefaultValueif the attribute does not contain any values.DnasDn()Returns the first value decoded as aDNusing the schema associated with this parser, ornullif the attribute does not contain any values.DnasDn(String defaultValue)Returns the first value decoded as aDNusing the schema associated with this parser, ordefaultValueif the attribute does not contain any values.DnasDn(Dn defaultValue)Returns the first value decoded as aDNusing the schema associated with this parser, ordefaultValueif the attribute does not contain any values.DurationasDuration(Duration defaultValue)Returns the first value decoded as aDurationordefaultValueif the attribute does not contain any values.GeneralizedTimeasGeneralizedTime()Returns the first value decoded as aGeneralizedTimeusing the generalized time syntax, ornullif the attribute does not contain any values.GeneralizedTimeasGeneralizedTime(GeneralizedTime defaultValue)Returns the first value decoded as anGeneralizedTimeusing the generalized time syntax, ordefaultValueif the attribute does not contain any values.IntegerasInteger()Returns the first value decoded as anInteger, ornullif the attribute does not contain any values.intasInteger(int defaultValue)Returns the first value decoded as anInteger, ordefaultValueif the attribute does not contain any values.LongasLong()Returns the first value decoded as aLong, ornullif the attribute does not contain any values.longasLong(long defaultValue)Returns the first value decoded as aLong, ordefaultValueif the attribute does not contain any values.PathasPath()Returns the first value decoded as aPath, ornullif the attribute does not contain any values.PathasPath(Path defaultValue)Returns the first value decoded as aPath, or defaultValue if the attribute does not contain any values.<T,E extends Exception>
Set<T>asSetOf(Function<ByteString,? extends T,E> f, Collection<? extends T> defaultValues)Returns the values decoded as a set ofTs using the providedFunction, ordefaultValuesif the attribute does not contain any values.<T,E extends Exception>
Set<T>asSetOf(Function<ByteString,? extends T,E> f, T... defaultValues)Returns the values decoded as a set ofTs using the providedFunction, ordefaultValuesif the attribute does not contain any values.Set<AttributeDescription>asSetOfAttributeDescription()Returns the values decoded as a set ofAttributeDescriptions using the schema associated with this parser, or an empty set if the attribute does not contain any values.Set<AttributeDescription>asSetOfAttributeDescription(String... defaultValues)Returns the values decoded as a set ofAttributeDescriptions using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.Set<AttributeDescription>asSetOfAttributeDescription(Collection<AttributeDescription> defaultValues)Returns the values decoded as a set ofAttributeDescriptions using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.Set<AttributeDescription>asSetOfAttributeDescription(AttributeDescription... defaultValues)Returns the values decoded as a set ofAttributeDescriptions using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.Set<Boolean>asSetOfBoolean(Boolean... defaultValues)Returns the values decoded as a set ofBooleans, ordefaultValuesif the attribute does not contain any values.Set<Boolean>asSetOfBoolean(Collection<Boolean> defaultValues)Returns the values decoded as a set ofBooleans, ordefaultValuesif the attribute does not contain any values.Set<ByteString>asSetOfByteString(Collection<ByteString> defaultValues)Returns the values contained in the attribute, ordefaultValuesif the attribute does not contain any values.Set<ByteString>asSetOfByteString(ByteString... defaultValues)Returns the values contained in the attribute, ordefaultValuesif the attribute does not contain any values.Set<X509Certificate>asSetOfCertificate()Returns the values decoded as a set ofX509Certificates, or an empty set if the attribute does not contain any values.Set<Dn>asSetOfDn()Returns the values decoded as a set ofDNs using the schema associated with this parser, or an empty set if the attribute does not contain any values.Set<Dn>asSetOfDn(String... defaultValues)Returns the values decoded as a set ofDNs using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.Set<Dn>asSetOfDn(Collection<Dn> defaultValues)Returns the values decoded as a set ofDNs using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.Set<Dn>asSetOfDn(Dn... defaultValues)Returns the values decoded as a set ofDNs using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.Set<GeneralizedTime>asSetOfGeneralizedTime(Collection<GeneralizedTime> defaultValues)Returns the values decoded as a set ofGeneralizedTimes using the generalized time syntax, ordefaultValuesif the attribute does not contain any values.Set<GeneralizedTime>asSetOfGeneralizedTime(GeneralizedTime... defaultValues)Returns the values decoded as a set ofGeneralizedTimes using the generalized time syntax, ordefaultValuesif the attribute does not contain any values.Set<Integer>asSetOfInteger(Integer... defaultValues)Returns the values decoded as a set ofIntegers, ordefaultValuesif the attribute does not contain any values.Set<Integer>asSetOfInteger(Collection<Integer> defaultValues)Returns the values decoded as a set ofIntegers, ordefaultValuesif the attribute does not contain any values.Set<Long>asSetOfLong(Long... defaultValues)Returns the values decoded as a set ofLongs, ordefaultValuesif the attribute does not contain any values.Set<Long>asSetOfLong(Collection<Long> defaultValues)Returns the values decoded as a set ofLongs, ordefaultValuesif the attribute does not contain any values.Set<String>asSetOfString(String... defaultValues)Returns the values decoded as a set ofStrings, ordefaultValuesif the attribute does not contain any values.Set<String>asSetOfString(Collection<String> defaultValues)Returns the values decoded as a set ofStrings, ordefaultValuesif the attribute does not contain any values.<T,E extends Exception>
Set<T>asSetOfString(Function<String,? extends T,E> f, Collection<? extends T> defaultValues)Returns the values decoded as a set ofTs from their string representations using the providedFunction, ordefaultValuesif the attribute does not contain any values.<T,E extends Exception>
Set<T>asSetOfString(Function<String,? extends T,E> f, T... defaultValues)Returns the values decoded as a set ofTs from their string representations using the providedFunction, ordefaultValuesif the attribute does not contain any values.Stream<ByteString>asStream()Returns the values as a stream ofByteString.StringasString()Returns the first value decoded as aString, ornullif the attribute does not contain any values.StringasString(String defaultValue)Returns the first value decoded as aString, ordefaultValueif the attribute does not contain any values.<T,E extends Exception>
TasString(Function<String,? extends T,E> f)Returns the first value decoded as aTfrom its string representation using the providedFunction, ornullif the attribute does not contain any values.<T,E extends Exception>
TasString(Function<String,? extends T,E> f, T defaultValue)Returns the first value decoded as aTfrom its string representation using the providedFunction, or thedefaultValueif the attribute does not contain any values.static AttributeParserparseAttribute(Attribute attribute)Returns an attribute parser for the provided attribute.AttributeParserrequireValue()Throws aLocalizedIllegalArgumentExceptionif the attribute referenced by this parser isnullor empty.AttributeParserusingSchema(Schema schema)Sets theSchemawhich will be used when parsing schema sensitive values such as DNs and attribute descriptions.
-
-
-
Method Detail
-
parseAttribute
public static AttributeParser parseAttribute(Attribute attribute)
Returns an attribute parser for the provided attribute.- Parameters:
attribute- The attribute to be parsed, which must not benull.- Returns:
- The attribute parser.
- Throws:
NullPointerException- ifattributeisnull.
-
asString
public <T,E extends Exception> T asString(Function<String,? extends T,E> f) throws E extends Exception
Returns the first value decoded as aTfrom its string representation using the providedFunction, ornullif the attribute does not contain any values.- Type Parameters:
T- The type of the value to be decoded.E- The type of exception thrown by the function.- Parameters:
f- The function which should be used to decode the value from aString.- Returns:
- The first value decoded as a
T, ornullif there is no value. - Throws:
E- If an error occurred when parsing the attribute.E extends Exception
-
asString
public <T,E extends Exception> T asString(Function<String,? extends T,E> f, T defaultValue) throws E extends Exception
Returns the first value decoded as aTfrom its string representation using the providedFunction, or thedefaultValueif the attribute does not contain any values.- Type Parameters:
T- The type of the value to be decoded.E- The type of exception thrown by the function.- Parameters:
f- The function which should be used to decode the value from aString.defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
T, ordefaultValueif there is no value. - Throws:
E- If an error occurred when parsing the attribute.E extends Exception
-
as
public <T,E extends Exception> T as(Function<ByteString,? extends T,E> f) throws E extends Exception
Returns the first value decoded as aTusing the providedFunction, ornullif the attribute does not contain any values.- Type Parameters:
T- The type of the value to be decoded.E- The type of exception thrown by the function.- Parameters:
f- The function which should be used to decode the value.- Returns:
- The first value decoded as a
T. - Throws:
E- If an error occurred when parsing the attribute.E extends Exception
-
as
public <T,E extends Exception> T as(Function<ByteString,? extends T,E> f, T defaultValue) throws E extends Exception
Returns the first value decoded as aTusing the providedFunction, ordefaultValueif the attribute does not contain any values.- Type Parameters:
T- The type of the value to be decoded.E- The type of exception thrown by the function.- Parameters:
f- The function which should be used to decode the value.defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
T. - Throws:
E- If an error occurred when parsing the attribute.E extends Exception
-
asAttributeDescription
public AttributeDescription asAttributeDescription()
Returns the first value decoded as anAttributeDescriptionusing the schema associated with this parser, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as an
AttributeDescription.
-
asAttributeDescription
public AttributeDescription asAttributeDescription(AttributeDescription defaultValue)
Returns the first value decoded as anAttributeDescriptionusing the schema associated with this parser, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as an
AttributeDescription.
-
asAttributeDescription
public AttributeDescription asAttributeDescription(String defaultValue)
Returns the first value decoded as anAttributeDescriptionusing the schema associated with this parser, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as an
AttributeDescription.
-
asBoolean
public Boolean asBoolean()
Returns the first value decoded as a boolean, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as a boolean.
-
asBoolean
public boolean asBoolean(boolean defaultValue)
Returns the first value decoded as anBoolean, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as an
Boolean.
-
asByteString
public ByteString asByteString()
Returns the first value, ornullif the attribute does not contain any values.- Returns:
- The first value.
-
asByteString
public ByteString asByteString(ByteString defaultValue)
Returns the first value, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value.
-
asCertificate
public X509Certificate asCertificate()
Returns the first value decoded as aX509Certificate, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as a
X509Certificate.
-
asCertificate
public X509Certificate asCertificate(X509Certificate defaultValue)
Returns the first value decoded as aX509Certificate, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
X509Certificate.
-
asDn
public Dn asDn()
Returns the first value decoded as aDNusing the schema associated with this parser, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as a
DN.
-
asDn
public Dn asDn(Dn defaultValue)
Returns the first value decoded as aDNusing the schema associated with this parser, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
DN.
-
asDn
public Dn asDn(String defaultValue)
Returns the first value decoded as aDNusing the schema associated with this parser, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
DN.
-
asDuration
public Duration asDuration(Duration defaultValue)
Returns the first value decoded as aDurationordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
Duration.
-
asGeneralizedTime
public GeneralizedTime asGeneralizedTime()
Returns the first value decoded as aGeneralizedTimeusing the generalized time syntax, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as a
GeneralizedTime.
-
asGeneralizedTime
public GeneralizedTime asGeneralizedTime(GeneralizedTime defaultValue)
Returns the first value decoded as anGeneralizedTimeusing the generalized time syntax, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as an
GeneralizedTime.
-
asInteger
public Integer asInteger()
Returns the first value decoded as anInteger, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as an
Integer.
-
asInteger
public int asInteger(int defaultValue)
Returns the first value decoded as anInteger, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as an
Integer.
-
asLong
public Long asLong()
Returns the first value decoded as aLong, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as a
Long.
-
asLong
public long asLong(long defaultValue)
Returns the first value decoded as aLong, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
Long.
-
asPath
public Path asPath()
Returns the first value decoded as aPath, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as a
Path. - Throws:
LocalizedIllegalArgumentException- If an invalid value is provided.
-
asPath
public Path asPath(Path defaultValue)
Returns the first value decoded as aPath, or defaultValue if the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
Path. - Throws:
LocalizedIllegalArgumentException- If an invalid value is provided.
-
asSetOfString
@SafeVarargs public final <T,E extends Exception> Set<T> asSetOfString(Function<String,? extends T,E> f, T... defaultValues) throws E extends Exception
Returns the values decoded as a set ofTs from their string representations using the providedFunction, ordefaultValuesif the attribute does not contain any values.- Type Parameters:
T- The type of the values to be decoded.E- The type of exception thrown by the function.- Parameters:
f- The function which should be used to decode values fromStrings.defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Ts. - Throws:
E- If an error occurred when parsing the attribute.E extends Exception
-
asSetOfString
public <T,E extends Exception> Set<T> asSetOfString(Function<String,? extends T,E> f, Collection<? extends T> defaultValues) throws E extends Exception
Returns the values decoded as a set ofTs from their string representations using the providedFunction, ordefaultValuesif the attribute does not contain any values.- Type Parameters:
T- The type of the values to be decoded.E- The type of exception thrown by the function.- Parameters:
f- The function which should be used to decode values fromStringsdefaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Ts. - Throws:
E- If an error occurred when parsing the attribute.E extends Exception
-
asSetOf
@SafeVarargs public final <T,E extends Exception> Set<T> asSetOf(Function<ByteString,? extends T,E> f, T... defaultValues) throws E extends Exception
Returns the values decoded as a set ofTs using the providedFunction, ordefaultValuesif the attribute does not contain any values.- Type Parameters:
T- The type of the values to be decoded.E- The type of exception thrown by the function.- Parameters:
f- The function which should be used to decode values.defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Ts. - Throws:
E- If an error occurred when parsing the attribute.E extends Exception
-
asSetOf
public <T,E extends Exception> Set<T> asSetOf(Function<ByteString,? extends T,E> f, Collection<? extends T> defaultValues) throws E extends Exception
Returns the values decoded as a set ofTs using the providedFunction, ordefaultValuesif the attribute does not contain any values.- Type Parameters:
T- The type of the values to be decoded.E- The type of exception thrown by the function.- Parameters:
f- The function which should be used to decode values.defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Ts. - Throws:
E- If an error occurred when parsing the attribute.E extends Exception
-
asStream
public Stream<ByteString> asStream()
Returns the values as a stream ofByteString. If the attribute is empty, this method will return an empty stream.- Returns:
- The values as a stream of
ByteString.
-
asSetOfAttributeDescription
public Set<AttributeDescription> asSetOfAttributeDescription()
Returns the values decoded as a set ofAttributeDescriptions using the schema associated with this parser, or an empty set if the attribute does not contain any values.- Returns:
- The values decoded as a set of
AttributeDescriptions.
-
asSetOfAttributeDescription
public Set<AttributeDescription> asSetOfAttributeDescription(AttributeDescription... defaultValues)
Returns the values decoded as a set ofAttributeDescriptions using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
AttributeDescriptions.
-
asSetOfAttributeDescription
public Set<AttributeDescription> asSetOfAttributeDescription(Collection<AttributeDescription> defaultValues)
Returns the values decoded as a set ofAttributeDescriptions using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
AttributeDescriptions.
-
asSetOfAttributeDescription
public Set<AttributeDescription> asSetOfAttributeDescription(String... defaultValues)
Returns the values decoded as a set ofAttributeDescriptions using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
AttributeDescriptions.
-
asSetOfBoolean
public Set<Boolean> asSetOfBoolean(Boolean... defaultValues)
Returns the values decoded as a set ofBooleans, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Booleans.
-
asSetOfBoolean
public Set<Boolean> asSetOfBoolean(Collection<Boolean> defaultValues)
Returns the values decoded as a set ofBooleans, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Booleans.
-
asSetOfByteString
public Set<ByteString> asSetOfByteString(ByteString... defaultValues)
Returns the values contained in the attribute, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values contained in the attribute.
-
asSetOfByteString
public Set<ByteString> asSetOfByteString(Collection<ByteString> defaultValues)
Returns the values contained in the attribute, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values contained in the attribute.
-
asSetOfCertificate
public Set<X509Certificate> asSetOfCertificate()
Returns the values decoded as a set ofX509Certificates, or an empty set if the attribute does not contain any values.- Returns:
- The values decoded as a set of
X509Certificates.
-
asSetOfDn
public Set<Dn> asSetOfDn()
Returns the values decoded as a set ofDNs using the schema associated with this parser, or an empty set if the attribute does not contain any values.- Returns:
- The values decoded as a set of
DNs.
-
asSetOfDn
public Set<Dn> asSetOfDn(Collection<Dn> defaultValues)
Returns the values decoded as a set ofDNs using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
DNs.
-
asSetOfDn
public Set<Dn> asSetOfDn(Dn... defaultValues)
Returns the values decoded as a set ofDNs using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
DNs.
-
asSetOfDn
public Set<Dn> asSetOfDn(String... defaultValues)
Returns the values decoded as a set ofDNs using the schema associated with this parser, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
DNs.
-
asSetOfGeneralizedTime
public Set<GeneralizedTime> asSetOfGeneralizedTime(Collection<GeneralizedTime> defaultValues)
Returns the values decoded as a set ofGeneralizedTimes using the generalized time syntax, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
GeneralizedTimes.
-
asSetOfGeneralizedTime
public Set<GeneralizedTime> asSetOfGeneralizedTime(GeneralizedTime... defaultValues)
Returns the values decoded as a set ofGeneralizedTimes using the generalized time syntax, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
GeneralizedTimes.
-
asSetOfInteger
public Set<Integer> asSetOfInteger(Collection<Integer> defaultValues)
Returns the values decoded as a set ofIntegers, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Integers.
-
asSetOfInteger
public Set<Integer> asSetOfInteger(Integer... defaultValues)
Returns the values decoded as a set ofIntegers, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Integers.
-
asSetOfLong
public Set<Long> asSetOfLong(Collection<Long> defaultValues)
Returns the values decoded as a set ofLongs, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Longs.
-
asSetOfLong
public Set<Long> asSetOfLong(Long... defaultValues)
Returns the values decoded as a set ofLongs, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Longs.
-
asSetOfString
public Set<String> asSetOfString(String... defaultValues)
Returns the values decoded as a set ofStrings, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Strings.
-
asSetOfString
public Set<String> asSetOfString(Collection<String> defaultValues)
Returns the values decoded as a set ofStrings, ordefaultValuesif the attribute does not contain any values.- Parameters:
defaultValues- The default values to return if the attribute is empty.- Returns:
- The values decoded as a set of
Strings.
-
asString
public String asString()
Returns the first value decoded as aString, ornullif the attribute does not contain any values.- Returns:
- The first value decoded as a
String.
-
asString
public String asString(String defaultValue)
Returns the first value decoded as aString, ordefaultValueif the attribute does not contain any values.- Parameters:
defaultValue- The default value to return if the attribute is empty.- Returns:
- The first value decoded as a
String.
-
requireValue
public AttributeParser requireValue()
Throws aLocalizedIllegalArgumentExceptionif the attribute referenced by this parser isnullor empty.- Returns:
- A reference to this attribute parser.
- Throws:
LocalizedIllegalArgumentException- If the attribute referenced by this parser isnullor empty.
-
usingSchema
public AttributeParser usingSchema(Schema schema)
Sets theSchemawhich will be used when parsing schema sensitive values such as DNs and attribute descriptions.- Parameters:
schema- TheSchemawhich will be used when parsing schema sensitive values.- Returns:
- This attribute parser.
-
-