Package org.apache.sis.xml
Class XLink
- Object
-
- XLink
-
- All Implemented Interfaces:
Serializable
public class XLink extends Object implements Serializable
The XML attributes defined by OGC in the xlink schema. The allowed combinations of any one attribute depend on the value of the specialtypeattribute. Following is a summary of the element types (columns) on which the global attributes (rows) are allowed, with an indication of whether a value is required (R) or optional (O) (Source: W3C):
WhenXLink attribute usage patterns simpleextendedlocatorarcresourcetitletypeR R R R R R hrefO R roleO O O O arcroleO O titleO O O O O showO O actuateO O labelO O fromO toO xlinkattributes are found at unmarshalling time instead of an object definition, those attributes are given to theReferenceResolver.resolve(MarshalContext, Class, XLink)method. Users can override that method in order to fetch an instance in some catalog for the givenxlinkvalues.- Since:
- 0.3
- See Also:
- XML Linking Language, OGC schema, Serialized Form
Defined in the
sis-metadatamodule
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXLink.ActuateCommunicates the desired timing of traversal from the starting resource to the ending resource.static classXLink.ShowCommunicates the desired presentation of the ending resource on traversal from the starting resource.static classXLink.TypeThe type of axlink.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)Compares thisXLinkwith the given object for equality.voidfreeze()Marks thisxlinkas unmodifiable.XLink.ActuategetActuate()Returns the desired timing of traversal from the starting resource to the ending resource.URIgetArcRole()Returns a URI reference for some description of the arc role.StringgetFrom()Returns the starting resource.URIgetHRef()Returns a URN to an external resources, or to an other part of a XML document, or an identifier.StringgetLabel()Returns an identification of the target of afromortoattribute.URIgetRole()Returns a URI reference for some description of the arc role.XLink.ShowgetShow()Returns the desired presentation of the ending resource on traversal from the starting resource.InternationalStringgetTitle()Returns a human-readable string with a short description for the arc.StringgetTo()Returns the ending resource.XLink.TypegetType()Returns the type of link.inthashCode()Returns a hash code value for this XLink.voidsetActuate(XLink.Actuate actuate)Sets the desired timing of traversal from the starting resource to the ending resource.voidsetArcRole(URI arcrole)Sets a URI reference for some description of the arc role.voidsetFrom(String from)Sets the starting resource.voidsetHRef(URI href)Sets the URN to a resources.voidsetLabel(String label)Sets an identification of the target of afromortoattribute.voidsetRole(URI role)Sets the URI reference for some description of the arc role.voidsetShow(XLink.Show show)Sets the desired presentation of the ending resource on traversal from the starting resource.voidsetTitle(InternationalString title)Sets a human-readable string with a short description for the arc.voidsetTo(String to)Sets the ending resource.voidsetType(XLink.Type type)Sets the type of link.StringtoString()Returns a string representation of this object.
-
-
-
Constructor Detail
-
XLink
public XLink()
Creates a new link. The initial value of all attributes isnull.
-
XLink
public XLink(XLink link)
Creates a new link as a copy of the given link.- Parameters:
link- The link to copy, ornullif none.
-
-
Method Detail
-
getType
public XLink.Type getType()
Returns the type of link. May have one of the following values:- simple: a simple link
- extended: an extended, possibly multi-resource, link
- locator: a pointer to an external resource
- resource: an internal resource
- arc: a traversal rule between resources
- title: a descriptive title for another linking element
null. If thesetType(XLink.Type)method has been invoked with theAUTOenum, then this method will infer a type from the attributes having a non-null value.- Returns:
- the type of link, or
null.
-
setType
public void setType(XLink.Type type)
Sets the type of link. Any value different thanType.AUTO(includingnull) will overwrite the value inferred automatically bygetType(). AAUTOvalue will enable automatic type detection.- Parameters:
type- the new type of link, ornullif none.
-
getHRef
public URI getHRef()
Returns a URN to an external resources, or to an other part of a XML document, or an identifier.- Returns:
- a URN to a resources, or
nullif none.
-
setHRef
public void setHRef(URI href) throws IllegalStateException
Sets the URN to a resources.- Parameters:
href- a URN to a resources, ornullif none.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"href"attribute.
-
getRole
public URI getRole()
Returns a URI reference for some description of the arc role.- Returns:
- a URI reference for some description of the arc role, or
nullif none.
-
setRole
public void setRole(URI role) throws IllegalStateException
Sets the URI reference for some description of the arc role.- Parameters:
role- a URI reference for some description of the arc role, ornullif none.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"role"attribute.
-
getArcRole
public URI getArcRole()
Returns a URI reference for some description of the arc role.- Returns:
- a URI reference for some description of the arc role, or
nullif none.
-
setArcRole
public void setArcRole(URI arcrole) throws IllegalStateException
Sets a URI reference for some description of the arc role.- Parameters:
arcrole- a URI reference for some description of the arc role, ornullif none.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"arcrole"attribute.
-
getTitle
public InternationalString getTitle()
Returns a human-readable string with a short description for the arc.- Returns:
- a human-readable string with a short description for the arc, or
nullif none.
-
setTitle
public void setTitle(InternationalString title) throws IllegalStateException
Sets a human-readable string with a short description for the arc.- Parameters:
title- a human-readable string with a short description for the arc, ornullif none.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"title"attribute.
-
getShow
public XLink.Show getShow()
Returns the desired presentation of the ending resource on traversal from the starting resource. It's value should be treated as follows:- new: load ending resource in a new window, frame, pane, or other presentation context
- replace: load the resource in the same window, frame, pane, or other presentation context
- embed: load ending resource in place of the presentation of the starting resource
- other: behavior is unconstrained; examine other markup in the link for hints
- none: behavior is unconstrained
- Returns:
- the desired presentation of the ending resource, or
nullif unspecified.
-
setShow
public void setShow(XLink.Show show) throws IllegalStateException
Sets the desired presentation of the ending resource on traversal from the starting resource.- Parameters:
show- the desired presentation of the ending resource, ornullif unspecified.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"show"attribute.
-
getActuate
public XLink.Actuate getActuate()
Returns the desired timing of traversal from the starting resource to the ending resource. It's value should be treated as follows:- onLoad: traverse to the ending resource immediately on loading the starting resource
- onRequest: traverse from the starting resource to the ending resource only on a post-loading event triggered for this purpose
- other: behavior is unconstrained; examine other markup in link for hints
- none: behavior is unconstrained
- Returns:
- the desired timing of traversal from the starting resource to the ending resource,
or
nullif unspecified.
-
setActuate
public void setActuate(XLink.Actuate actuate) throws IllegalStateException
Sets the desired timing of traversal from the starting resource to the ending resource.- Parameters:
actuate- the desired timing of traversal from the starting resource to the ending resource, ornullif unspecified.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"actuate"attribute.
-
getLabel
public String getLabel()
Returns an identification of the target of afromortoattribute.- Returns:
- an identification of the target of a
fromortoattribute, ornull.
-
setLabel
public void setLabel(String label) throws IllegalStateException
Sets an identification of the target of afromortoattribute.- Parameters:
label- an identification of the target of afromortoattribute, ornull.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"label"attribute.
-
getFrom
public String getFrom()
Returns the starting resource. The value must correspond to the same value for somelabelattribute.- Returns:
- the starting resource, or
null.
-
setFrom
public void setFrom(String from) throws IllegalStateException
Sets the starting resource. The value must correspond to the same value for somelabelattribute.- Parameters:
from- the starting resource, ornull.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"from"attribute.
-
getTo
public String getTo()
Returns the ending resource. The value must correspond to the same value for somelabelattribute.- Returns:
- the ending resource, or
null.
-
setTo
public void setTo(String to) throws IllegalStateException
Sets the ending resource. The value must correspond to the same value for somelabelattribute.- Parameters:
to- the ending resource, ornull.- Throws:
UnsupportedOperationException- if thisxlinkis unmodifiable.IllegalStateException- if the link type has been explicitly set. and that type does not allow the"to"attribute.
-
freeze
public void freeze()
Marks thisxlinkas unmodifiable. After this method call, any call to a setter method will throw anUnsupportedOperationException.After the first call to this method, any subsequent calls have no effect.
-
equals
public boolean equals(Object object)
Compares thisXLinkwith the given object for equality.
-
hashCode
public int hashCode()
Returns a hash code value for this XLink.
-
-