bbc.rd.tvanytime
Class ContentReference

java.lang.Object
  extended by bbc.rd.tvanytime.ContentReference
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
MemberOf

public class ContentReference
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

ContentReference: Represents a TV-Anytime CRID NOTE: Doesn't seem to work within a hashtable as a key, even though hashCode() method has been implemented. Solution is to use CRID.getCRID() (i.e. a string) as the key.

Version:
1.0 Modified T.Ferne, September 2004
Author:
Tim Sargeant, BBC Research & Development, April 2002
See Also:
Serialized Form

Constructor Summary
ContentReference()
          Constructor for objects of type ContentReference
ContentReference(java.lang.String crid)
          Constructor for objects of type ContentReference with required fields.
 
Method Summary
 java.lang.Object clone()
          Clones itself.
 boolean equals(java.lang.Object obj)
          Are these CRIDs equal?
 java.lang.String getAuthority()
          Get the authority part of this CRID
 java.lang.String getCRID()
          Get the whole of the CRID
 java.lang.String getData()
          Get the data part of this CRID
 int hashCode()
          Used in Hashtable.
 void setCRID(java.lang.String crid)
          Set the CRID Tests for validity of "crid://" portion of crid, and throws a TVAnytimeException if invalid.
 java.lang.String toString()
          Returns string representation of this object.
 java.lang.String toString(int indent)
          Returns string representation of this object.
 java.lang.String toXML()
          Returns XML representation of this object.
 java.lang.String toXML(int indent)
          Returns XML representation of this object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentReference

public ContentReference()
Constructor for objects of type ContentReference


ContentReference

public ContentReference(java.lang.String crid)
                 throws TVAnytimeException
Constructor for objects of type ContentReference with required fields. Tests for validity of "crid://" portion of crid, and throws a TVAnytimeException if invalid. Does not test for valid DNS name.

Parameters:
crid - string representation of the CRID (e.g. "crid://bbc.co.uk/21837")
Throws:
TVAnytimeException - thrown when crid starts with invalid pattern
Method Detail

getAuthority

public java.lang.String getAuthority()
Get the authority part of this CRID

Returns:
the resolving authority for this CRID (e.g. "bbc.co.uk") or null if crid is undefined

getData

public java.lang.String getData()
Get the data part of this CRID

Returns:
the unique data part of this CRID (e.g. "21837") or null if crid is undefined

getCRID

public java.lang.String getCRID()
Get the whole of the CRID

Returns:
the String representation of the CRID (e.g. "crid://bbc.co.uk/21837") or null if crid is undefined

equals

public boolean equals(java.lang.Object obj)
Are these CRIDs equal?

Overrides:
equals in class java.lang.Object
Parameters:
crid - The possibly null ContentReference to be compared
Returns:
true if ContentReference is equal to this ContentReference; false otherwise

hashCode

public int hashCode()
Used in Hashtable. Just returns has code of CRID string. NOTE: Doesn't seem to work correctly.

Overrides:
hashCode in class java.lang.Object
Returns:
Hashcode for CRID.

setCRID

public void setCRID(java.lang.String crid)
             throws TVAnytimeException
Set the CRID Tests for validity of "crid://" portion of crid, and throws a TVAnytimeException if invalid. Does not test for valid DNS name.

Parameters:
crid - the CRID as a String
Throws:
TVAnytimeException

toXML

public java.lang.String toXML()
Returns XML representation of this object.

Returns:
XML representation of this object.

toXML

public java.lang.String toXML(int indent)
Returns XML representation of this object.

Parameters:
indent - number of tabs to put before the string.
Returns:
XML representation of this object.

toString

public java.lang.String toString()
Returns string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this object.

toString

public java.lang.String toString(int indent)
Returns string representation of this object.

Parameters:
indent - number of tabs to put before the string.
Returns:
string representation of this object.

clone

public java.lang.Object clone()
Clones itself.

Overrides:
clone in class java.lang.Object
Returns:
A copy of itself.