ezvcard.parameters
Class MediaTypeParameter

java.lang.Object
  extended by ezvcard.parameters.VCardParameter
      extended by ezvcard.parameters.TypeParameter
          extended by ezvcard.parameters.MediaTypeParameter
Direct Known Subclasses:
ImageTypeParameter, KeyTypeParameter, SoundTypeParameter

public class MediaTypeParameter
extends TypeParameter

Represents a TYPE parameter that also has a media type associated with it. The TYPE parameter value is used in 2.1 and 3.0 vCards, while the media type value is used in 4.0 vCards.

Author:
Michael Angstadt

Field Summary
protected  String extension
           
protected  String mediaType
           
 
Fields inherited from class ezvcard.parameters.TypeParameter
NAME
 
Fields inherited from class ezvcard.parameters.VCardParameter
name, value
 
Constructor Summary
MediaTypeParameter(String value, String mediaType, String extension)
           
 
Method Summary
 boolean equals(Object obj)
           
protected static
<T extends MediaTypeParameter>
T
findByMediaType(String mediaType, Class<T> clazz)
          Searches the static objects of a child class for one that has a certain media type value.
 String getExtension()
          Gets the file extension.
 String getMediaType()
          Gets the media type.
 int hashCode()
           
 
Methods inherited from class ezvcard.parameters.VCardParameter
all, findByValue, getName, getValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mediaType

protected final String mediaType

extension

protected final String extension
Constructor Detail

MediaTypeParameter

public MediaTypeParameter(String value,
                          String mediaType,
                          String extension)
Parameters:
value - the TYPE parameter value (e.g. "JPEG")
mediaType - the media type (e.g. "image/jpeg")
extension - the file extension (e.g. "jpg")
Method Detail

getMediaType

public String getMediaType()
Gets the media type.

Returns:
the media type (e.g. "image/jpeg")

getExtension

public String getExtension()
Gets the file extension.

Returns:
the file extension (e.g. "jpg")

hashCode

public int hashCode()
Overrides:
hashCode in class VCardParameter

equals

public boolean equals(Object obj)
Overrides:
equals in class VCardParameter

findByMediaType

protected static <T extends MediaTypeParameter> T findByMediaType(String mediaType,
                                                                  Class<T> clazz)
Searches the static objects of a child class for one that has a certain media type value.

Parameters:
mediaType - the media type value to look for
clazz - the child class
Returns:
the object or null if not found


Copyright © 2012-2013. All Rights Reserved.