com.google.gdata.wireformats
Class AltFormat

java.lang.Object
  extended by com.google.gdata.wireformats.AltFormat

public class AltFormat
extends java.lang.Object

The AltFormat class represents an alternate representation format for a GData resources. An alternate format has a name (which may be used as the alt query parameter for GData requests), a primary MIME content type (which may act as an alias for the name if unique to the representation), and several other attributes.

Two AltFormat instances are considered to be equal if they have the same name.

This class also exposes static constants for common GData alternate representation formats that are available across multiple GData services.


Nested Class Summary
static class AltFormat.Builder
          A builder for AltFormat.
 
Field Summary
static AltFormat APPLICATION_XML
          Constant value representing application/xml document
static AltFormat ATOM
          Constant value representing the Atom Syndication Format, as defined by RFC 4287.
static AltFormat ATOM_SERVICE
          Constant value representing the AtomPub Service Document, as described by RFC 5023.
static AltFormat MEDIA
          Constant value representing the media content associated with a GData resource.
static AltFormat MEDIA_MULTIPART
          Constant value representing the MIME Multipart Document format, as described by RFC 2045.
static AltFormat OPENSEARCH
          Constant value representing the OpenSearch Description Document, as described by OpenSearch 1.1.
static AltFormat RSS
          Constant value representing the Really Simple Syndication (RSS) format, as defined by RSS 2.0 .
 
Constructor Summary
AltFormat(java.lang.String name, WireFormat wireFormat, ContentType contentType, java.util.List<ContentType> acceptList, boolean isSelectableByType)
          Deprecated. Please use the AltFormat.Builder instead. See builder().
 
Method Summary
 boolean allowInputFormat(AltFormat inputFormat)
          Returns true if inputFormat is allowed as input format when this format with this format as the output format.
static AltFormat.Builder builder()
          Creates a builder for a new AltFormat.
static AltFormat.Builder builder(AltFormat format)
          Creates a builder for a new AltFormat.
 boolean equals(java.lang.Object o)
           
 AltFormat getBaseFormat()
          Returns the base format, if this format is a variant.
 ContentType getContentType()
          Returns the primary MIME content type used for the representation.
 java.util.List<ContentType> getMatchingTypes()
          Returns a list of all MIME types that will be considered to potentially match the representation for the purposes of content negotiation.
 java.lang.String getName()
          Returns the short name for this format.
 WireFormat getWireFormat()
          Returns the WireFormat that is used to parse and generate the representation or null if no supporting wire format exists.
 boolean hasBaseFormat()
          Returns true if this format is a variant, such as *-in-script.
 int hashCode()
           
 boolean isSelectableByType()
          Returns true, indicates that the MIME content type can be used as an alias to select the representation.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RSS

public static final AltFormat RSS
Constant value representing the Really Simple Syndication (RSS) format, as defined by RSS 2.0 .


OPENSEARCH

public static final AltFormat OPENSEARCH
Constant value representing the OpenSearch Description Document, as described by OpenSearch 1.1. This representation is only able for feed resources.


ATOM_SERVICE

public static final AltFormat ATOM_SERVICE
Constant value representing the AtomPub Service Document, as described by RFC 5023. This representation is only available for feed resources.


APPLICATION_XML

public static final AltFormat APPLICATION_XML
Constant value representing application/xml document


MEDIA

public static final AltFormat MEDIA
Constant value representing the media content associated with a GData resource. The actual content type returned will depend upon the native media representation of the target resource.


MEDIA_MULTIPART

public static final AltFormat MEDIA_MULTIPART
Constant value representing the MIME Multipart Document format, as described by RFC 2045. The multipart document contains both the Atom representation (as one part) and the associated media content (as another part). This representation is available only for GData media resources.


ATOM

public static final AltFormat ATOM
Constant value representing the Atom Syndication Format, as defined by RFC 4287.

Constructor Detail

AltFormat

@Deprecated
public AltFormat(java.lang.String name,
                            WireFormat wireFormat,
                            ContentType contentType,
                            java.util.List<ContentType> acceptList,
                            boolean isSelectableByType)
Deprecated. Please use the AltFormat.Builder instead. See builder().

Constructs a new alternate representation format with the provided attributes.

Parameters:
name - the short name for this format. This values is suitable for use as the value of the alt query parameter.
wireFormat - the content wire format or null if there is no associated wire format for the representation.
contentType - the primary MIME content type used for the representation.
acceptList - a list of all MIME types that will be considered to potentially match the representation for the purposes of content negotiation. A value of null is equivalent to a single item list containing only the primary content type.
isSelectableByType - if true, indicates that the MIME content type can be used as an alias to select the representation.
Method Detail

builder

public static AltFormat.Builder builder()
Creates a builder for a new AltFormat.


builder

public static AltFormat.Builder builder(AltFormat format)
Creates a builder for a new AltFormat. Pre-initializes the builder with a prototype format.


getName

public java.lang.String getName()
Returns the short name for this format. This values is suitable for use as the value of the alt query parameter.


getWireFormat

public WireFormat getWireFormat()
Returns the WireFormat that is used to parse and generate the representation or null if no supporting wire format exists.


getContentType

public ContentType getContentType()
Returns the primary MIME content type used for the representation.


getMatchingTypes

public java.util.List<ContentType> getMatchingTypes()
Returns a list of all MIME types that will be considered to potentially match the representation for the purposes of content negotiation.


isSelectableByType

public boolean isSelectableByType()
Returns true, indicates that the MIME content type can be used as an alias to select the representation.


allowInputFormat

public boolean allowInputFormat(AltFormat inputFormat)
Returns true if inputFormat is allowed as input format when this format with this format as the output format.


hasBaseFormat

public boolean hasBaseFormat()
Returns true if this format is a variant, such as *-in-script.


getBaseFormat

public AltFormat getBaseFormat()
Returns the base format, if this format is a variant. Otherwise returns null.


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

toString

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