sk.baka.ambient.collection
Class CategoryItem

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

public final class CategoryItem
extends java.lang.Object
implements java.io.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.
 java.lang.Object id
          The collection-strategy-dependent ID, may be null.
 java.lang.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.
 java.lang.String sortKey
          The sort key, used for sorting the items, retrieved from the name by CollectionUtils.keyFor(String).
 java.lang.String year
          In case of an album the year may be specified.
 
Constructor Summary
CategoryItem(java.lang.Object id, java.lang.String name, java.lang.String year, CategoryEnum category, int albums, int songs)
          Creates new category item instance.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getDisplayableName()
          Returns displayable name (the "[empty]" string instead of null).
 java.lang.String getDisplayableYear()
          Returns displayable year (the "[empty]" string instead of null).
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

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


name

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


sortKey

public final java.lang.String sortKey
The sort key, used for sorting the items, retrieved from the name by CollectionUtils.keyFor(String).


year

public final java.lang.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(java.lang.Object id,
                    java.lang.String name,
                    java.lang.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 java.lang.String getDisplayableName()
Returns displayable name (the "[empty]" string instead of null).

Returns:
the displayable name.

getDisplayableYear

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

Returns:
the displayable year.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2007-2009. All Rights Reserved.