entagged.audioformats.generic
Class AbstractTag

java.lang.Object
  extended by entagged.audioformats.generic.AbstractTag
All Implemented Interfaces:
Tag
Direct Known Subclasses:
ApeTag, GenericTag, Id3v2Tag, Mp4Tag, OggTag

public abstract class AbstractTag
extends Object
implements Tag

This class is the default implementation for Tag and introduces some more useful functionality to be implemented.

Author:
Raphaël Slinckx

Field Summary
protected  int commonNumber
          Stores the amount of TagField with TagField.isCommon() true.
protected  HashMap fields
          This map stores the ids of the stored fields to the fields themselves.
 
Fields inherited from interface entagged.audioformats.Tag
DEFAULT_GENRES
 
Constructor Summary
AbstractTag()
           
 
Method Summary
 void add(TagField field)
          (overridden)
 void addAlbum(String s)
          (overridden)
 void addArtist(String s)
          (overridden)
 void addComment(String s)
          (overridden)
 void addGenre(String s)
          (overridden)
 void addTitle(String s)
          (overridden)
 void addTrack(String s)
          (overridden)
 void addYear(String s)
          (overridden)
protected abstract  TagField createAlbumField(String content)
          Creates a field which represents the "album".
The field will already contain the given content.
protected abstract  TagField createArtistField(String content)
          Creates a field which represents the "artist".
The field will already contain the given content.
protected abstract  TagField createCommentField(String content)
          Creates a field which represents the "comment".
The field will already contain the given content.
protected abstract  TagField createGenreField(String content)
          Creates a field which represents the "genre".
The field will already contain the given content.
protected abstract  TagField createTitleField(String content)
          Creates a field which represents the "title".
The field will already contain the given content.
protected abstract  TagField createTrackField(String content)
          Creates a field which represents the "track".
The field will already contain the given content.
protected abstract  TagField createYearField(String content)
          Creates a field which represents the "year".
The field will already contain the given content.
 List get(String id)
          (overridden)
 List getAlbum()
          (overridden)
protected abstract  String getAlbumId()
          Returns the identifier for a field representing the "album"
 List getArtist()
          (overridden)
protected abstract  String getArtistId()
          Returns the identifier for a field representing the "artist"
 List getComment()
          (overridden)
protected abstract  String getCommentId()
          Returns the identifier for a field representing the "comment"
 Iterator getFields()
          (overridden)
 String getFirstAlbum()
          (overridden)
 String getFirstArtist()
          (overridden)
 String getFirstComment()
          (overridden)
 String getFirstGenre()
          (overridden)
 String getFirstTitle()
          (overridden)
 String getFirstTrack()
          (overridden)
 String getFirstYear()
          (overridden)
 List getGenre()
          (overridden)
protected abstract  String getGenreId()
          Returns the identifier for a field representing the "genre"
 List getTitle()
          (overridden)
protected abstract  String getTitleId()
          Returns the identifier for a field representing the "title"
 List getTrack()
          (overridden)
protected abstract  String getTrackId()
          Returns the identifier for a field representing the "track"
 List getYear()
          (overridden)
protected abstract  String getYearId()
          Returns the identifier for a field representing the "year"
 boolean hasCommonFields()
          (overridden)
 boolean hasField(String id)
          (overridden)
protected abstract  boolean isAllowedEncoding(String enc)
          Determines whether the given charset encoding may be used for the represented tagging system.
 boolean isEmpty()
          (overridden)
 void merge(Tag tag)
          (overridden)
 void set(TagField field)
          (overridden)
 void setAlbum(String s)
          (overridden)
 void setArtist(String s)
          (overridden)
 void setComment(String s)
          (overridden)
 boolean setEncoding(String enc)
          (overridden)
 void setGenre(String s)
          (overridden)
 void setTitle(String s)
          (overridden)
 void setTrack(String s)
          (overridden)
 void setYear(String s)
          (overridden)
 String toString()
          (overridden)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

commonNumber

protected int commonNumber
Stores the amount of TagField with TagField.isCommon() true.


fields

protected HashMap fields
This map stores the ids of the stored fields to the fields themselves.

Constructor Detail

AbstractTag

public AbstractTag()
Method Detail

add

public void add(TagField field)
(overridden)

Specified by:
add in interface Tag
Parameters:
field - The field to add.
See Also:
Tag.add(entagged.audioformats.generic.TagField)

addAlbum

public void addAlbum(String s)
(overridden)

Specified by:
addAlbum in interface Tag
Parameters:
s - Album description
See Also:
Tag.addAlbum(java.lang.String)

addArtist

public void addArtist(String s)
(overridden)

Specified by:
addArtist in interface Tag
Parameters:
s - Artist's name
See Also:
Tag.addArtist(java.lang.String)

addComment

public void addComment(String s)
(overridden)

Specified by:
addComment in interface Tag
Parameters:
s - Comment.
See Also:
Tag.addComment(java.lang.String)

addGenre

public void addGenre(String s)
(overridden)

Specified by:
addGenre in interface Tag
Parameters:
s - Genre
See Also:
Tag.addGenre(java.lang.String)

addTitle

public void addTitle(String s)
(overridden)

Specified by:
addTitle in interface Tag
Parameters:
s - Title
See Also:
Tag.addTitle(java.lang.String)

addTrack

public void addTrack(String s)
(overridden)

Specified by:
addTrack in interface Tag
Parameters:
s - Track
See Also:
Tag.addTrack(java.lang.String)

addYear

public void addYear(String s)
(overridden)

Specified by:
addYear in interface Tag
Parameters:
s - Year
See Also:
Tag.addYear(java.lang.String)

createAlbumField

protected abstract TagField createAlbumField(String content)
Creates a field which represents the "album".
The field will already contain the given content.

Parameters:
content - The content of the created field.
Returns:
tagfield representing the "album"

createArtistField

protected abstract TagField createArtistField(String content)
Creates a field which represents the "artist".
The field will already contain the given content.

Parameters:
content - The content of the created field.
Returns:
tagfield representing the "artist"

createCommentField

protected abstract TagField createCommentField(String content)
Creates a field which represents the "comment".
The field will already contain the given content.

Parameters:
content - The content of the created field.
Returns:
tagfield representing the "comment"

createGenreField

protected abstract TagField createGenreField(String content)
Creates a field which represents the "genre".
The field will already contain the given content.

Parameters:
content - The content of the created field.
Returns:
tagfield representing the "genre"

createTitleField

protected abstract TagField createTitleField(String content)
Creates a field which represents the "title".
The field will already contain the given content.

Parameters:
content - The content of the created field.
Returns:
tagfield representing the "title"

createTrackField

protected abstract TagField createTrackField(String content)
Creates a field which represents the "track".
The field will already contain the given content.

Parameters:
content - The content of the created field.
Returns:
tagfield representing the "track"

createYearField

protected abstract TagField createYearField(String content)
Creates a field which represents the "year".
The field will already contain the given content.

Parameters:
content - The content of the created field.
Returns:
tagfield representing the "year"

get

public List get(String id)
(overridden)

Specified by:
get in interface Tag
Parameters:
id - The field id.
Returns:
A list of TagField objects with the given "id".
See Also:
Tag.get(java.lang.String)

getAlbum

public List getAlbum()
(overridden)

Specified by:
getAlbum in interface Tag
See Also:
Tag.getAlbum()

getAlbumId

protected abstract String getAlbumId()
Returns the identifier for a field representing the "album"

Returns:
identifier for the "album" field.
See Also:
TagField.getId()

getArtist

public List getArtist()
(overridden)

Specified by:
getArtist in interface Tag
See Also:
Tag.getArtist()

getArtistId

protected abstract String getArtistId()
Returns the identifier for a field representing the "artist"

Returns:
identifier for the "artist" field.
See Also:
TagField.getId()

getComment

public List getComment()
(overridden)

Specified by:
getComment in interface Tag
See Also:
Tag.getComment()

getCommentId

protected abstract String getCommentId()
Returns the identifier for a field representing the "comment"

Returns:
identifier for the "comment" field.
See Also:
TagField.getId()

getFields

public Iterator getFields()
(overridden)

Specified by:
getFields in interface Tag
See Also:
Tag.getFields()

getFirstAlbum

public String getFirstAlbum()
(overridden)

Specified by:
getFirstAlbum in interface Tag
See Also:
Tag.getFirstAlbum()

getFirstArtist

public String getFirstArtist()
(overridden)

Specified by:
getFirstArtist in interface Tag
See Also:
Tag.getFirstArtist()

getFirstComment

public String getFirstComment()
(overridden)

Specified by:
getFirstComment in interface Tag
See Also:
Tag.getFirstComment()

getFirstGenre

public String getFirstGenre()
(overridden)

Specified by:
getFirstGenre in interface Tag
See Also:
Tag.getFirstGenre()

getFirstTitle

public String getFirstTitle()
(overridden)

Specified by:
getFirstTitle in interface Tag
See Also:
Tag.getFirstTitle()

getFirstTrack

public String getFirstTrack()
(overridden)

Specified by:
getFirstTrack in interface Tag
See Also:
Tag.getFirstTrack()

getFirstYear

public String getFirstYear()
(overridden)

Specified by:
getFirstYear in interface Tag
See Also:
Tag.getFirstYear()

getGenre

public List getGenre()
(overridden)

Specified by:
getGenre in interface Tag
See Also:
Tag.getGenre()

getGenreId

protected abstract String getGenreId()
Returns the identifier for a field representing the "genre"

Returns:
identifier for the "genre" field.
See Also:
TagField.getId()

getTitle

public List getTitle()
(overridden)

Specified by:
getTitle in interface Tag
See Also:
Tag.getTitle()

getTitleId

protected abstract String getTitleId()
Returns the identifier for a field representing the "title"

Returns:
identifier for the "title" field.
See Also:
TagField.getId()

getTrack

public List getTrack()
(overridden)

Specified by:
getTrack in interface Tag
See Also:
Tag.getTrack()

getTrackId

protected abstract String getTrackId()
Returns the identifier for a field representing the "track"

Returns:
identifier for the "track" field.
See Also:
TagField.getId()

getYear

public List getYear()
(overridden)

Specified by:
getYear in interface Tag
See Also:
Tag.getYear()

getYearId

protected abstract String getYearId()
Returns the identifier for a field representing the "year"

Returns:
identifier for the "year" field.
See Also:
TagField.getId()

hasCommonFields

public boolean hasCommonFields()
(overridden)

Specified by:
hasCommonFields in interface Tag
Returns:
true if a common field is present.
See Also:
Tag.hasCommonFields()

hasField

public boolean hasField(String id)
(overridden)

Specified by:
hasField in interface Tag
Parameters:
id - The field id to look for.
Returns:
true if tag contains a TagField with the given id.
See Also:
Tag.hasField(java.lang.String)

isAllowedEncoding

protected abstract boolean isAllowedEncoding(String enc)
Determines whether the given charset encoding may be used for the represented tagging system.

Parameters:
enc - charset encoding.
Returns:
true if the given encoding can be used.

isEmpty

public boolean isEmpty()
(overridden)

Specified by:
isEmpty in interface Tag
Returns:
true if tag contains no field.
See Also:
Tag.isEmpty()

merge

public void merge(Tag tag)
(overridden)

Specified by:
merge in interface Tag
See Also:
Tag.merge(entagged.audioformats.Tag)

set

public void set(TagField field)
(overridden)

Specified by:
set in interface Tag
See Also:
Tag.set(entagged.audioformats.generic.TagField)

setAlbum

public void setAlbum(String s)
(overridden)

Specified by:
setAlbum in interface Tag
See Also:
Tag.setAlbum(java.lang.String)

setArtist

public void setArtist(String s)
(overridden)

Specified by:
setArtist in interface Tag
See Also:
Tag.setArtist(java.lang.String)

setComment

public void setComment(String s)
(overridden)

Specified by:
setComment in interface Tag
See Also:
Tag.setComment(java.lang.String)

setEncoding

public boolean setEncoding(String enc)
(overridden)

Specified by:
setEncoding in interface Tag
See Also:
Tag.setEncoding(java.lang.String)

setGenre

public void setGenre(String s)
(overridden)

Specified by:
setGenre in interface Tag
See Also:
Tag.setGenre(java.lang.String)

setTitle

public void setTitle(String s)
(overridden)

Specified by:
setTitle in interface Tag
See Also:
Tag.setTitle(java.lang.String)

setTrack

public void setTrack(String s)
(overridden)

Specified by:
setTrack in interface Tag
See Also:
Tag.setTrack(java.lang.String)

setYear

public void setYear(String s)
(overridden)

Specified by:
setYear in interface Tag
See Also:
Tag.setYear(java.lang.String)

toString

public String toString()
(overridden)

Specified by:
toString in interface Tag
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2007-2008. All Rights Reserved.