net.sourceforge.pebble.domain
Class Tag

java.lang.Object
  extended by net.sourceforge.pebble.domain.Tag
All Implemented Interfaces:
java.lang.Comparable, Permalinkable
Direct Known Subclasses:
IndexedTag

public class Tag
extends java.lang.Object
implements Permalinkable, java.lang.Comparable

Represents a tag.

Author:
Simon Brown

Field Summary
protected  int rank
          the rank for this tag
 
Constructor Summary
Tag(java.lang.String name, Blog blog)
          Creates a new tag with the specified properties.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
static java.lang.String encode(java.lang.String tag)
          Encodes a tag.
 boolean equals(java.lang.Object o)
          Determines whether the specified object is equal to this one.
 java.lang.String getName()
          Gets the name of this tag.
 java.lang.String getPermalink()
          Gets the permalink for this object.
 int getRank()
          Gets the rank for this tag.
 int hashCode()
          Gets the hashcode of this object.
static java.util.List<Tag> parse(Blog blog, java.lang.String tags)
          Given a string containing whitespace separated tags, this method returns a List containing the tags.
 void setName(java.lang.String name)
          Sets the name of this tag.
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

rank

protected int rank
the rank for this tag

Constructor Detail

Tag

public Tag(java.lang.String name,
           Blog blog)
Creates a new tag with the specified properties.

Parameters:
name - the name
blog - a Blog instance
Method Detail

getName

public java.lang.String getName()
Gets the name of this tag.

Returns:
the name as a String

setName

public void setName(java.lang.String name)
Sets the name of this tag.

Parameters:
name - the new tag name

getPermalink

public java.lang.String getPermalink()
Gets the permalink for this object.

Specified by:
getPermalink in interface Permalinkable
Returns:
a URL as a String

hashCode

public int hashCode()
Gets the hashcode of this object.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode as an int

equals

public boolean equals(java.lang.Object o)
Determines whether the specified object is equal to this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare against
Returns:
true if Object o represents the same tag, false otherwise

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.

toString

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

Overrides:
toString in class java.lang.Object
Returns:
a String

getRank

public int getRank()
Gets the rank for this tag.

Returns:
an int between 1 and 10;

parse

public static java.util.List<Tag> parse(Blog blog,
                                        java.lang.String tags)
Given a string containing whitespace separated tags, this method returns a List containing the tags.

Parameters:
tags - a whitespace separated list of tags
Returns:
a List of Tag instances

encode

public static java.lang.String encode(java.lang.String tag)
Encodes a tag.

Parameters:
tag - a String


Copyright © 2003-2006, Simon Brown. All Rights Reserved.