|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.xtm.XtmNode
org.ceryle.xtm.XtmReference
public class XtmReference
Defines a reference occurring in a topic map.
Instances of this class are objects containing URI references, typed internally as either representations of topicRef, resourceRef, or subjectIndicatorRef elements. This class allows only a subset of URIs, given that it builds the provided string as a java.net.URL, throwing an exception if unable. The internal representation of the URI is also stored as a String value, so if the initial setting throws a MalformedURLException, this can be caught and the String value set directly using the setLinkURI() method, which does not set the URL value.
If this default behaviour is considered annoying, it can be altered by changing the boolean strictURIs to false and recompiling. The URL returned by getLinkURL() will then in all cases return a null value.
| Field Summary | |
|---|---|
protected String |
uri
A String containing the URI reference of this XtmReference. |
| Fields inherited from class org.ceryle.xtm.XtmNode |
|---|
ASSOCIATION_NODE, BASENAME_NODE, BASENAMESTRING_NODE, COMMENT_NODE, DOCUMENT_NODE, GrpSep, GRPSEP, id, INSTANCEOF_NODE, MEMBER_NODE, MERGEMAP_NODE, NODE, NonType, NONTYPE, OCCURRENCE_NODE, PARAMETERS_NODE, PROCESSING_INSTRUCTION_NODE, RecSep, RECSEP, REFERENCE_NODE, RESOURCEDATA_NODE, RESOURCEREF_NODE, ROLESPEC_NODE, SCOPE_NODE, SUBJECTIDENTITY_NODE, SUBJECTINDICATORREF_NODE, TOPIC_NODE, TOPICMAP_NODE, TOPICREF_NODE, VARIANT_NODE, VARIANTNAME_NODE |
| Constructor Summary | |
|---|---|
XtmReference(int type,
String uri)
XtmReference constructor with type indicator and URI. |
|
XtmReference(String uri)
XtmReference constructor URI, which creates a <topicRef> if the URI begins with a "#", otherwise defaults to a <subjectIndicatorRef> reference type. |
|
XtmReference(String id,
int type,
String uri)
XtmReference constructor including an ID identifier, type indicator and URI. |
|
| Method Summary | |
|---|---|
int |
compareTo(Object o)
Compares the URI of this XtmReference with the provided Object for order. |
String |
getHash()
Return a String hashcode generated from this XtmReference's URI. |
String |
getLinkURI()
Return XtmReference's link URI as String. |
URL |
getLinkURL()
Return XtmReference's URI reference as URL. |
String |
getName()
Return a String matching this XtmReference's element type name. |
short |
getNodeType()
A short integer indicating what type of node this is. |
int |
getReferenceType()
Return an int code (1-3) indicating this XtmReference's element type. |
void |
setLinkURI(String uri)
Set XtmReference's URI reference to String uri. |
void |
setReferenceType(int type)
Set the type of this XtmReference's element type to the int type. |
XtmTopic |
sgetTopic(XtmProcessor xtmp,
XtmTopic reftopic)
Returns the XtmTopic to which this XtmReference refers. |
String |
toString()
Returns a String suitable as a description of this XtmReference. |
| Methods inherited from class org.ceryle.xtm.XtmNode |
|---|
addPI, getID, getPI, getPIs, hasNext, next, remove, removePI, setID |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String uri
| Constructor Detail |
|---|
public XtmReference(String uri)
NOTE: So that this can be used in a static context, the XtmReference on setting the URI is suppressed, with only a println indicating such an error occurred.
public XtmReference(int type,
String uri)
throws XtmException
XtmException
public XtmReference(String id,
int type,
String uri)
throws XtmException
XtmException| Method Detail |
|---|
public String getName()
getName in class XtmNodepublic void setReferenceType(int type)
public int getReferenceType()
public short getNodeType()
getNodeType in class XtmNode
public XtmTopic sgetTopic(XtmProcessor xtmp,
XtmTopic reftopic)
Alternately, if reftopic is null and the XtmProcessor xtmp is non-null, it will be used to resolve a topic from this XtmReference's URI. Returns null if unable to resolve, or if the topic is unavailable.
xtmp - the XtmProcessor used for topic resolutionreftopic - the XtmTopic to set as a reference
public void setLinkURI(String uri)
throws XtmException
uri.
XtmExceptionpublic String getHash()
public String getLinkURI()
public URL getLinkURL()
public int compareTo(Object o)
compareTo in interface Comparablepublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||