org.davesag.generica.core
Class MediaType

java.lang.Object
  extended byorg.davesag.generica.core.AbstractDateStamped
      extended byorg.davesag.generica.core.AbstractContent
          extended byorg.davesag.generica.core.AbstractExtensibleContent
              extended byorg.davesag.generica.core.MediaType
All Implemented Interfaces:
Content, DateStamped, Extensible, Localisable, Persistable, Serializable

public class MediaType
extends AbstractExtensibleContent
implements Serializable

The MediaType bean represents basic information about the MediaTypes.

Since:
Generica 1.0
Version:
CVS Revision $Id: MediaType.java,v 1.6 2004/04/08 13:19:08 davesag Exp $
Author:
Dave Sag http://www.davesag.com
See Also:
Serialized Form

Field Summary
static Map MEDIA_TYPES
          a synchrosized map of all media types, keyed by mime type.
protected  String theFileSuffix
          the media-types' file suffix.
protected  String theMimeType
          the media-types' mime-type
protected  String theName
          the media-types' name
 
Fields inherited from class org.davesag.generica.core.AbstractExtensibleContent
theMetaData
 
Fields inherited from class org.davesag.generica.core.AbstractContent
theCountryCode, theLanguageCode
 
Fields inherited from class org.davesag.generica.core.AbstractDateStamped
theCreated, theId, theLastModified
 
Constructor Summary
MediaType()
          null constructor required by hibernate.
MediaType(String name, String mimetype, String filesuffix)
          Constructor takes a name and mime type and populates a simple mediatype object.
 
Method Summary
 boolean equals(Object o)
          Tests if the supplied object is equal to this MediaType, ie do they have the same Id?
 String getFileSuffix()
          get the file suffix.
static MediaType getMediaType(String mimetype)
          get the media type for the given mime type.
 String getMimeType()
          get the mime type.
 String getName()
          get the name
static Map getTypes()
          get the media types map.
 int hashcode()
          Objects must override the hashcode if they override the equals method.
 void setFileSuffix(String linkback)
          set the file suffix.
 void setMimeType(String mimetype)
          set the mime type.
 void setName(String name)
          set the name
 String toString()
          string description of the media type.
 
Methods inherited from class org.davesag.generica.core.AbstractExtensibleContent
addMetaData, getMetaData, getMetaData, removeMetaData, setMetaData
 
Methods inherited from class org.davesag.generica.core.AbstractContent
getCountryCode, getLanguageCode, getLocale, setCountryCode, setLanguageCode, setLocale
 
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

MEDIA_TYPES

public static Map MEDIA_TYPES
a synchrosized map of all media types, keyed by mime type.


theName

protected String theName
the media-types' name


theMimeType

protected String theMimeType
the media-types' mime-type


theFileSuffix

protected String theFileSuffix
the media-types' file suffix.

Constructor Detail

MediaType

public MediaType()
null constructor required by hibernate.


MediaType

public MediaType(String name,
                 String mimetype,
                 String filesuffix)
Constructor takes a name and mime type and populates a simple mediatype object. This will be extended shortly.

Parameters:
name - The name of the user.
mimetype - The mime type.
filesuffix - The file suffix.
Method Detail

getTypes

public static Map getTypes()
get the media types map.

Returns:
Map of media types, keyed against mime type.

getMediaType

public static MediaType getMediaType(String mimetype)
get the media type for the given mime type.

Parameters:
mimetype - the mimetype requested.
Returns:
the matching media type.

getName

public String getName()
get the name

Returns:
the name
Hibernate Property:
length = "255" not-null="true"

setName

public void setName(String name)
set the name

Parameters:
name - the name.

getMimeType

public String getMimeType()
get the mime type.

Returns:
The mime type.
Hibernate Property:
length = "255" not-null="true"

setMimeType

public void setMimeType(String mimetype)
set the mime type.

Parameters:
mimetype - the mime type.

getFileSuffix

public String getFileSuffix()
get the file suffix.

Returns:
The file suffix.
Hibernate Property:
length = "12" not-null="true"

setFileSuffix

public void setFileSuffix(String linkback)
set the file suffix.

Parameters:
linkback - the file suffix.

equals

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

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

hashcode

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

Specified by:
hashcode in class AbstractContent
Returns:
a valid hashcode for this Merchant.

toString

public String toString()
string description of the media type.

Specified by:
toString in class AbstractContent
Returns:
string description of the media type.


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