Class AbsIRIImpl
- java.lang.Object
-
- org.apache.jena.iri.impl.AbsIRIFactoryImpl
-
- org.apache.jena.iri.IRI
-
- org.apache.jena.iri.impl.AbsIRIImpl
-
- All Implemented Interfaces:
IRIComponents,IRIFactoryI,IRIRelativize,ViolationCodes
- Direct Known Subclasses:
IRIImpl,ResolvedRelativeIRI
public abstract class AbsIRIImpl extends IRI implements ViolationCodes, IRIComponents
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jena.iri.ViolationCodes
ViolationCodes.Initialize
-
-
Field Summary
-
Fields inherited from class org.apache.jena.iri.IRI
ILLFORMED_PORT, NO_PORT
-
Fields inherited from interface org.apache.jena.iri.IRIComponents
AUTHORITY, FRAGMENT, HOST, PATH, PATHQUERY, PORT, QUERY, SCHEME, USER
-
Fields inherited from interface org.apache.jena.iri.IRIRelativize
ABSOLUTE, CHILD, GRANDPARENT, NETWORK, PARENT, SAMEDOCUMENT
-
Fields inherited from interface org.apache.jena.iri.ViolationCodes
ACE_PREFIX, BAD_BIDI_SUBCOMPONENT, BAD_DOT_IN_IDN, BAD_IDN, BAD_IDN_UNASSIGNED_CHARS, BIDI_FORMATTING_CHARACTER, COMPATIBILITY_CHARACTER, CONTROL_CHARACTER, DEFAULT_PORT_SHOULD_BE_OMITTED, DEPRECATED_UNICODE_CHARACTER, DISCOURAGED_IRI_CHARACTER, DISCOURAGED_XML_CHARACTER, DNS_LABEL_DASH_START_OR_END, DNS_LABEL_LENGTH_LIMIT, DNS_LENGTH_LIMIT, DOUBLE_DASH_IN_REG_NAME, DOUBLE_WHITESPACE, EMPTY_SCHEME, HAS_PASSWORD, ILLEGAL_CHARACTER, ILLEGAL_PERCENT_ENCODING, IP_V4_OCTET_RANGE, IP_V6_OR_FUTURE_ADDRESS_SYNTAX, IPv6ADDRESS_SHOULD_BE_LOWERCASE, LONE_SURROGATE, LOWERCASE_PREFERRED, MAYBE_NOT_NFC, MAYBE_NOT_NFKC, NON_INITIAL_DOT_SEGMENT, NON_URI_CHARACTER, NON_XML_CHARACTER, NOT_DNS_NAME, NOT_NFC, NOT_NFKC, NOT_UTF8_ESCAPE, NOT_UTF8_ESCAPE_IN_HOST, NOT_XML_SCHEMA_WHITESPACE, PERCENT, PERCENT_20, PERCENT_ENCODING_SHOULD_BE_UPPERCASE, PORT_SHOULD_NOT_BE_EMPTY, PORT_SHOULD_NOT_BE_WELL_KNOWN, PORT_SHOULD_NOT_START_IN_ZERO, PRIVATE_USE_CHARACTER, PROHIBITED_COMPONENT_PRESENT, QUERY_IN_LEGACY_SCHEME, REQUIRED_COMPONENT_MISSING, SCHEME_INCLUDES_DASH, SCHEME_MUST_START_WITH_LETTER, SCHEME_PATTERN_MATCH_FAILED, SCHEME_PREFERS_LOWERCASE, SCHEME_REQUIRES_LOWERCASE, SUPERFLUOUS_ASCII_PERCENT_ENCODING, SUPERFLUOUS_NON_ASCII_PERCENT_ENCODING, UNASSIGNED_UNICODE_CHARACTER, UNDEFINED_UNICODE_CHARACTER, UNICODE_CONTROL_CHARACTER, UNICODE_WHITESPACE, UNREGISTERED_IANA_SCHEME, UNREGISTERED_NONIETF_SCHEME_TREE, UNWISE_CHARACTER, USE_PUNYCODE_NOT_PERCENTS, WHITESPACE
-
-
Constructor Summary
Constructors Constructor Description AbsIRIImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<Violation>allViolations()IRIcreate(java.lang.String s)Make a new IRI object (possibly including IRI resolution), and check it for violations of the standards being enforced by the factory.IRIcreate(IRI i)Make a new IRI object (possibly including IRI resolution), and check it for violations of the standards being enforced by the factory.booleanequals(java.lang.Object o)java.lang.StringgetASCIIHost()The host part of the authority, encoded as an International Domain Name.java.lang.StringgetAuthority()The authority component, found between the first "//" and the next "/".java.lang.StringgetFragment()The fragment, found after a "#" at the end of the main URI (note a fragment may itself contain a "#").java.lang.StringgetHost()The host part of the authority.java.lang.StringgetPath()The path component of the IRI; always present, possibly the empty string.intgetPort()The port number from the authority component.java.lang.StringgetQuery()The query component of the IRI.java.lang.StringgetRawAuthority()The authority component, found between the first "//" and the next "/".java.lang.StringgetRawFragment()The fragment, found after a "#" at the end of the main URI (note a fragment may itself contain a "#").java.lang.StringgetRawHost()The host part of the authority.java.lang.StringgetRawPath()The path component of the IRI; always present, possibly the empty string.java.lang.StringgetRawQuery()The query component of the IRI.java.lang.StringgetRawUserinfo()The user information part of the authority component of the IRI.java.lang.StringgetScheme()The scheme component of the IRI.java.lang.StringgetUserinfo()The user information part of the authority component of the IRI.inthashCode()booleanhasViolation(boolean includeWarnings)Are there any violations of the factory's specification settings.booleanisAbsolute()Does this IRI specify a scheme.booleanisRelative()Is this IRI a relative reference without a scheme specified.booleanisRootless()Is this an 'opaque' IRI.intladderEquals(IRI iri)To be defined: use the comparison ladder.booleanladderEquals(IRI iri, int other)To be defined: use the comparison ladder.IRInormalize(boolean useDns)To be defined - return result does not violate any minting conditions.IRIrelativize(java.lang.String abs)Returns an IRI that when resolved against this IRI would returnabs.IRIrelativize(java.lang.String abs, int flags)Returns an IRI that when resolved against this IRI would returnabs.IRIrelativize(IRI abs)Returns an IRI that when resolved against this IRI would returnabs.IRIrelativize(IRI abs, int flags)Returns an IRI that when resolved against this IRI would returnabs.java.lang.StringtoASCIIString()Converts the IRI into ASCII.java.lang.StringtoDisplayString()The IRI string with any recommended bi-directional control characters (if necessary) to ensure correct display.java.net.URItoURI()Converts the IRI to an ASCII string, and then to a java.net.URI.java.net.URLtoURL()Converts the IRI to an ASCII string, and then to a URL.java.util.Iterator<Violation>violations(boolean includeWarnings)The error and warning conditions associated with this IRI violating the standards associated with its factory.-
Methods inherited from class org.apache.jena.iri.impl.AbsIRIFactoryImpl
construct, construct, construct, create
-
Methods inherited from interface org.apache.jena.iri.IRIFactoryI
construct, construct, construct, create
-
-
-
-
Method Detail
-
isAbsolute
public boolean isAbsolute()
Description copied from class:IRIDoes this IRI specify a scheme.- Specified by:
isAbsolutein classIRI- Returns:
- True if this IRI has a scheme specified.
-
isRelative
public boolean isRelative()
Description copied from class:IRIIs this IRI a relative reference without a scheme specified.- Specified by:
isRelativein classIRI- Returns:
- True if the IRI is a relative reference
-
hasViolation
public boolean hasViolation(boolean includeWarnings)
Description copied from class:IRIAre there any violations of the factory's specification settings. Quick check, equivalent toviolations(includeWarnings).hasNext(), but faster.- Specified by:
hasViolationin classIRI- Parameters:
includeWarnings- If true then warnings are reported as well as errors.- Returns:
- true if the factory's specifications have been violated.
-
violations
public java.util.Iterator<Violation> violations(boolean includeWarnings)
Description copied from class:IRIThe error and warning conditions associated with this IRI violating the standards associated with its factory.- Specified by:
violationsin classIRI- Parameters:
includeWarnings- If true then warnings are returned as well as errors.- Returns:
- The
Violations found which violate the factory's standards.
-
toURL
public java.net.URL toURL() throws java.net.MalformedURLExceptionDescription copied from class:IRIConverts the IRI to an ASCII string, and then to a URL.
-
toURI
public java.net.URI toURI() throws java.net.URISyntaxExceptionDescription copied from class:IRIConverts the IRI to an ASCII string, and then to a java.net.URI.
-
toASCIIString
public java.lang.String toASCIIString() throws MalformedIDNExceptionDescription copied from class:IRIConverts the IRI into ASCII. The hostname is converted into punycode; other components are converted using percent encoding. Even if the IRI is already ASCII, the hostname may be modified, if, for example, it (inappropriately) uses percent encoding. This may be impossible (even in the ASCII case), in which case an exception is thrown.- Specified by:
toASCIIStringin classIRI- Returns:
- An ASCII string corresponding to this IRI.
- Throws:
MalformedIDNException
-
relativize
public IRI relativize(java.lang.String abs, int flags)
Description copied from class:IRIReturns an IRI that when resolved against this IRI would returnabs. If possible, a relative IRI is formed, using any of the methods specified in flags, which is a bitwise or of values fromIRIRelativize.If
abscontains a dot segment (either "/./" or "/../") then the contract cannot be satisfied and an incorrect answer is returned. This incorrect return value has anViolationCodes.NON_INITIAL_DOT_SEGMENTviolation associated with it.- Specified by:
relativizein classIRI- Parameters:
abs- An absolute IRI to make relative.flags- Which type of relative IRIs to permit.- Returns:
- A relative or absolute IRI equivalent to abs.
-
relativize
public IRI relativize(java.lang.String abs)
Description copied from class:IRIReturns an IRI that when resolved against this IRI would returnabs. If possible, a relative IRI is formed, using default methods.If
abscontains a dot segment (either "/./" or "/../") then the contract cannot be satisfied and an incorrect answer is returned. This incorrect return value has anViolationCodes.NON_INITIAL_DOT_SEGMENTviolation associated with it.- Specified by:
relativizein classIRI- Parameters:
abs- An absolute IRI to make relative.- Returns:
- A relative or absolute IRI equivalent to abs.
-
relativize
public IRI relativize(IRI abs)
Description copied from class:IRIReturns an IRI that when resolved against this IRI would returnabs. If possible, a relative IRI is formed, using default methods.If
abscontains a dot segment (either "/./" or "/../") then the contract cannot be satisfied and an incorrect answer is returned. This incorrect return value has anViolationCodes.NON_INITIAL_DOT_SEGMENTviolation associated with it.- Specified by:
relativizein classIRI- Parameters:
abs- An absolute IRI to make relative.- Returns:
- A relative or absolute IRI equivalent to abs.
-
relativize
public IRI relativize(IRI abs, int flags)
Description copied from class:IRIReturns an IRI that when resolved against this IRI would returnabs. If possible, a relative IRI is formed, using any of the methods specified in flags, which is a bitwise or of values fromIRIRelativize.If
abscontains a dot segment (either "/./" or "/../") then the contract cannot be satisfied and an incorrect answer is returned. This incorrect return value has anViolationCodes.NON_INITIAL_DOT_SEGMENTviolation associated with it.- Specified by:
relativizein classIRI- Parameters:
abs- An absolute IRI to make relative.flags- Which type of relative IRIs to permit.- Returns:
- A relative or absolute IRI equivalent to abs.
-
allViolations
public java.util.Iterator<Violation> allViolations()
-
getRawUserinfo
public java.lang.String getRawUserinfo()
Description copied from class:IRIThe user information part of the authority component of the IRI. Found before the first "@" in the authority. May include a ":" separating the user name from a password,ViolationCodes.HAS_PASSWORD. No decoding is done; this method is cheap.- Specified by:
getRawUserinfoin classIRI- Returns:
- The user information, or null if none.
-
getPort
public int getPort()
Description copied from class:IRIThe port number from the authority component. Found after the last ":" in the authority.- Specified by:
getPortin classIRI- Returns:
- The port number, or
IRI.NO_PORTorIRI.ILLFORMED_PORT.
-
getRawQuery
public java.lang.String getRawQuery()
Description copied from class:IRIThe query component of the IRI. Found after the "?" and before an optional "#". No decoding is done; this method is cheap.- Specified by:
getRawQueryin classIRI- Returns:
- The query component, or null if none.
-
getRawFragment
public java.lang.String getRawFragment()
Description copied from class:IRIThe fragment, found after a "#" at the end of the main URI (note a fragment may itself contain a "#"). No decoding is done; this method is cheap.- Specified by:
getRawFragmentin classIRI- Returns:
- The fragment, or null if none,
-
getRawHost
public java.lang.String getRawHost()
Description copied from class:IRIThe host part of the authority. Found between an optional "@" and an optional ":" in the authority. No decoding is done; this method is cheap.- Specified by:
getRawHostin classIRI- Returns:
- The host, or null if none.
-
getScheme
public java.lang.String getScheme()
Description copied from class:IRIThe scheme component of the IRI. Found before the first ":".
-
getRawPath
public java.lang.String getRawPath()
Description copied from class:IRIThe path component of the IRI; always present, possibly the empty string. This includes any leading "/". Found after the authority, and before any "?" or "#". No decoding is done; this method is cheap.- Specified by:
getRawPathin classIRI- Returns:
- The path.
-
isRootless
public boolean isRootless()
Description copied from class:IRIIs this an 'opaque' IRI. Is this IRI an absolute IRI with a path matching the path-rootless production: i.e. it has a scheme but no authority, and a path not starting in "/". Note: in the earlier RFC 2396 this concept was called being opaque.- Specified by:
isRootlessin classIRI- Returns:
- True if the non-empty path of this non-relative IRI is rootless
-
getRawAuthority
public java.lang.String getRawAuthority()
Description copied from class:IRIThe authority component, found between the first "//" and the next "/". No decoding is done; this method is cheap.- Specified by:
getRawAuthorityin classIRI- Returns:
- The authority component, or null if none.
-
create
public IRI create(IRI i)
Description copied from interface:IRIFactoryIMake a new IRI object (possibly including IRI resolution), and check it for violations of the standards being enforced by the factory. This method both allows IRI resolution against a base, and for creating a new IRI using a different factory, with different conformance settings, implementing a different URI or IRI standard, or variant thereof. This method does not throw exceptions, but records all errors and warnings found to be queried later usingIRI.hasViolation(boolean)andIRI.violations(boolean).- Specified by:
createin interfaceIRIFactoryI- Specified by:
createin classAbsIRIFactoryImpl- Parameters:
i- The IRI to use.- Returns:
- A new IRI object.
-
create
public IRI create(java.lang.String s)
Description copied from interface:IRIFactoryIMake a new IRI object (possibly including IRI resolution), and check it for violations of the standards being enforced by the factory. This method does not throw exceptions, but records all errors and warnings found to be queried later usingIRI.hasViolation(boolean)andIRI.violations(boolean).- Specified by:
createin interfaceIRIFactoryI- Overrides:
createin classAbsIRIFactoryImpl- Parameters:
s- The IRI to use.- Returns:
- A new IRI object.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getAuthority
public java.lang.String getAuthority()
Description copied from class:IRIThe authority component, found between the first "//" and the next "/". Any legal percent escape sequences are decoded. If the host name is an Internationalized Domain Name, then that is decoded too. This method may be more expensive thanIRI.getRawAuthority().- Specified by:
getAuthorityin classIRI- Returns:
- The authority component, or null if none.
-
getFragment
public java.lang.String getFragment()
Description copied from class:IRIThe fragment, found after a "#" at the end of the main URI (note a fragment may itself contain a "#"). Any legal percent escape sequences are decoded. This method may be more expensive thanIRI.getRawFragment().- Specified by:
getFragmentin classIRI- Returns:
- The fragment, or null if none,
-
getHost
public java.lang.String getHost()
Description copied from class:IRIThe host part of the authority. Found between an optional "@" and an optional ":" in the authority. Any legal percent escape sequences are decoded. Any legal punycode is decoded. This method may be more expensive thanIRI.getRawHost().
-
getPath
public java.lang.String getPath()
Description copied from class:IRIThe path component of the IRI; always present, possibly the empty string. This includes any leading "/". Found after the authority, and before any "?" or "#". Any legal percent escape sequences are decoded. This method may be more expensive thanIRI.getRawPath().
-
getQuery
public java.lang.String getQuery()
Description copied from class:IRIThe query component of the IRI. Found after the "?" and before an optional "#". Any legal percent escape sequences are decoded. This method may be more expensive thanIRI.getRawQuery().
-
getUserinfo
public java.lang.String getUserinfo()
Description copied from class:IRIThe user information part of the authority component of the IRI. Found before the first "@" in the authority. May include a ":" separating the user name from a password,ViolationCodes.HAS_PASSWORD. Any legal percent escape sequences are decoded. This method may be more expensive thanIRI.getRawUserinfo().- Specified by:
getUserinfoin classIRI- Returns:
- The user information, or null if none.
-
normalize
public IRI normalize(boolean useDns)
Description copied from class:IRITo be defined - return result does not violate any minting conditions.
-
toDisplayString
public java.lang.String toDisplayString()
Description copied from class:IRIThe IRI string with any recommended bi-directional control characters (if necessary) to ensure correct display.- Specified by:
toDisplayStringin classIRI- Returns:
- The IRI string formatted with unicode bidi control characters
-
getASCIIHost
public java.lang.String getASCIIHost() throws java.net.MalformedURLExceptionDescription copied from class:IRIThe host part of the authority, encoded as an International Domain Name. Any legal percent escape sequences are decoded. Any non-ASCII characters are encoded as punycode, if possible. This may be impossible (even in the ASCII case), in which case an exception is thrown. This method may be more expensive thanIRI.getRawHost().- Specified by:
getASCIIHostin classIRI- Returns:
- The host as an IDN, or null if none.
- Throws:
java.net.MalformedURLException- An Internationalized Domain Name algorithm failed, there is no equivalent ascii string.
-
ladderEquals
public boolean ladderEquals(IRI iri, int other)
Description copied from class:IRITo be defined: use the comparison ladder.- Specified by:
ladderEqualsin classIRI- Parameters:
iri- IRIother- Specifies where on the ladder to make the comparison.- Returns:
- True if this IRI is equal to the given one, when normalized with rules specified by other.
-
ladderEquals
public int ladderEquals(IRI iri)
Description copied from class:IRITo be defined: use the comparison ladder.- Specified by:
ladderEqualsin classIRI- Parameters:
iri- IRI- Returns:
- A value for other to make
IRI.ladderEquals(IRI, int)true, or -1 if none.
-
-