sk.baka.ambient.collection
Class CategoryItem

java.lang.Object
  extended by sk.baka.ambient.collection.CategoryItem
All Implemented Interfaces:
Serializable

public final class CategoryItem
extends Object
implements Serializable

A single category, may be an artist, an album or a genre.

Author:
Martin Vysny
See Also:
Serialized Form

Nested Class Summary
static class CategoryItem.Builder
          Builds the CategoryItem.
 
Field Summary
 int albums
          Contains a number of albums for given artist or genre.
 CategoryEnum category
          The category of this item, must not be null.
 Object id
          The collection-strategy-dependent ID, may be null.
 String name
          The name of the item, may be null if the name is missing.
 int songs
          Contains a number of songs for given artist, genre or album.
 String year
          In case of an album the year may be specified.
 
Constructor Summary
CategoryItem(Object id, String name, String year, CategoryEnum category, int albums, int songs)
          Creates new category item instance.
 
Method Summary
 boolean equals(Object o)
           
 String getDisplayableName()
          Returns displayable name (the "[empty]" string instead of null).
 String getDisplayableYear()
          Returns displayable year (the "[empty]" string instead of null).
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

public final Object id
The collection-strategy-dependent ID, may be null.


name

public final String name
The name of the item, may be null if the name is missing.


year

public final String year
In case of an album the year may be specified. null if not known.


category

public final CategoryEnum category
The category of this item, must not be null.


albums

public final int albums
Contains a number of albums for given artist or genre. Equals to 1 for CategoryEnum.Title and CategoryEnum.Album categories. May be -1 if not known.


songs

public final int songs
Contains a number of songs for given artist, genre or album. Equals to 1 for CategoryEnum.Title. May be -1 if not known.

Constructor Detail

CategoryItem

public CategoryItem(Object id,
                    String name,
                    String year,
                    CategoryEnum category,
                    int albums,
                    int songs)
Creates new category item instance.

Parameters:
id - the collection-strategy-dependent ID, may be null
name - the name of the item.
year - in case of an album the year may be specified. null if not known.
category - The category of this item, must not be null.
albums - Contains a number of albums for given artist or genre. Equals to 1 for CategoryEnum.Title and CategoryEnum.Album categories. May be -1 if not known.
songs - Contains a number of songs for given artist, genre or album. Equals to 1 for CategoryEnum.Title. May be -1 if not known.
Method Detail

getDisplayableName

public String getDisplayableName()
Returns displayable name (the "[empty]" string instead of null).

Returns:
the displayable name.

getDisplayableYear

public String getDisplayableYear()
Returns displayable year (the "[empty]" string instead of null).

Returns:
the displayable year.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2007-2008. All Rights Reserved.