Holger's
Java API

com.antelmann.db
Class Keyword

java.lang.Object
  extended by com.antelmann.db.AbstractDBEntry
      extended by com.antelmann.db.Keyword
All Implemented Interfaces:
DBEntry, Tag, Serializable, Comparable<Keyword>
Direct Known Subclasses:
GTag

public class Keyword
extends AbstractDBEntry
implements Tag, Comparable<Keyword>

implements a Group/Tag solely based on a String that also represents the ID for the DBEntry it is. To easily be able to handle subclasses (as there may be multiple groups in an application), a convenience method is provided (createNewTag(Class, Object)) that assumes that subclasses also have a constructor that takes a single String or a single Object.

Since:
07.11.2008, 12:02:14
Author:
Holger Antelmann
See Also:
TaggableMapping, Serialized Form

Field Summary
 
Fields inherited from interface com.antelmann.db.DBEntry
ENTRY_FLAVOR, ENTRY_LIST_FLAVOR
 
Constructor Summary
Keyword(Object name)
           
Keyword(String name)
           
 
Method Summary
 int compareTo(Keyword kw)
           
static
<T extends Keyword>
T
createNewTag(Class<T> type, Object idAndName)
          allows to easily construct subclasses of Keyword assuming that these classes have a constructor taking a single Object argument - just as Keyword itself.
 String getTagName()
           
static
<T extends Keyword>
void
removeAllTags(Taggable<T> entry)
           
 String toString()
           
 
Methods inherited from class com.antelmann.db.AbstractDBEntry
equals, getID, hashCode, hashEntry, sameEntry
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Keyword

public Keyword(Object name)

Keyword

public Keyword(String name)
Method Detail

getTagName

public String getTagName()
Specified by:
getTagName in interface Tag

compareTo

public int compareTo(Keyword kw)
Specified by:
compareTo in interface Comparable<Keyword>

toString

public String toString()
Overrides:
toString in class AbstractDBEntry

removeAllTags

public static <T extends Keyword> void removeAllTags(Taggable<T> entry)

createNewTag

public static <T extends Keyword> T createNewTag(Class<T> type,
                                                 Object idAndName)
allows to easily construct subclasses of Keyword assuming that these classes have a constructor taking a single Object argument - just as Keyword itself.

Type Parameters:
T - the type that is to be created
Parameters:
type - specifies the class used to construct the new instance
idAndName - the String that is passed to the constructor
Returns:
a new instance of type T based on reflection


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads