org.davesag.generica.core
Class AbstractContent

java.lang.Object
  extended byorg.davesag.generica.core.AbstractDateStamped
      extended byorg.davesag.generica.core.AbstractContent
All Implemented Interfaces:
Content, DateStamped, Localisable, Persistable, Serializable
Direct Known Subclasses:
AbstractExtensibleContent, Faq, Link

public abstract class AbstractContent
extends AbstractDateStamped
implements Content

This AbstractContent bean is an abstract Persitable Content item with created and lastModified dates and language and country codes.

Since:
Generica 1.0
Version:
CVS Revision $Id: AbstractContent.java,v 1.13 2004/04/08 13:19:07 davesag Exp $
Author:
Dave Sag http://www.davesag.com
See Also:
Serialized Form
Peristable via Hibernate:
table = "contents"

Field Summary
protected  String theCountryCode
          the iso code of the country the content is written for
protected  String theLanguageCode
          the iso code of the language the content is written in
 
Fields inherited from class org.davesag.generica.core.AbstractDateStamped
theCreated, theId, theLastModified
 
Constructor Summary
AbstractContent()
          default constructor
AbstractContent(Locale loc)
          Constructor takes a locale.
AbstractContent(String lang)
          Constructor takes a language code and uses the default country settings.
 
Method Summary
 boolean equals(Object o)
          Tests if the supplied object is equal to this AbstractContent, ie do they have the same Id?
 String getCountryCode()
          get the ISO Country Code of this AbstractContent.
 String getLanguageCode()
          get the ISO Language Code of this AbstractContent.
 Locale getLocale()
          get the locale.
abstract  int hashcode()
          Objects must override the hashcode if they override the equals method.
 void setCountryCode(String lang)
          Set the AbstractContent's country code.
 void setLanguageCode(String lang)
          Set the AbstractContent's language code.
 void setLocale(Locale loc)
          Set the AbstractContent's language and country codes using a Locale object.
abstract  String toString()
          Override this to be useful to you.
 
Methods inherited from class org.davesag.generica.core.AbstractDateStamped
getCreated, getId, getLastModified, setCreated, setId, setLastModified, setTemplateId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.davesag.generica.core.DateStamped
getCreated, getLastModified, setCreated, setLastModified
 

Field Detail

theLanguageCode

protected String theLanguageCode
the iso code of the language the content is written in


theCountryCode

protected String theCountryCode
the iso code of the country the content is written for

Constructor Detail

AbstractContent

public AbstractContent()
default constructor


AbstractContent

public AbstractContent(String lang)
Constructor takes a language code and uses the default country settings.

Parameters:
lang - The ISO Language Code.

AbstractContent

public AbstractContent(Locale loc)
Constructor takes a locale. This is the preferred option for sites that span countries as well as simply languages.

Parameters:
loc - The Locale.
Method Detail

getLanguageCode

public String getLanguageCode()
get the ISO Language Code of this AbstractContent.

Specified by:
getLanguageCode in interface Localisable
Returns:
The iso language code of this AbstractContent.
Hibernate Property:
length = "3" not-null="true"

setLanguageCode

public void setLanguageCode(String lang)
Set the AbstractContent's language code.

Specified by:
setLanguageCode in interface Localisable
Parameters:
lang - The iso language code of this AbstractContent.

getCountryCode

public String getCountryCode()
get the ISO Country Code of this AbstractContent.

Specified by:
getCountryCode in interface Localisable
Returns:
The iso country code of this AbstractContent.
Hibernate Property:
length = "5"

setCountryCode

public void setCountryCode(String lang)
Set the AbstractContent's country code.

Specified by:
setCountryCode in interface Localisable
Parameters:
lang - The iso country code of this AbstractContent.

setLocale

public void setLocale(Locale loc)
Set the AbstractContent's language and country codes using a Locale object.

Specified by:
setLocale in interface Localisable
Parameters:
loc - The locale to use to derive the language code.

getLocale

public Locale getLocale()
get the locale.

Specified by:
getLocale in interface Localisable
Returns:
the current Locale.

toString

public abstract String toString()
Override this to be useful to you.

Specified by:
toString in class AbstractDateStamped
Returns:
the content title. useful for debugging.

equals

public boolean equals(Object o)
Tests if the supplied object is equal to this AbstractContent, ie do they have the same Id?

Overrides:
equals in class AbstractDateStamped
Parameters:
o - The object to test against this AbstractContent. Must also be a AbstractContent to make sense.
Returns:
true if the two users have the same id.

hashcode

public abstract int hashcode()
Objects must override the hashcode if they override the equals method.

Specified by:
hashcode in class AbstractDateStamped
Returns:
a valid hashcode for this content.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.