public class

AltFormat

extends Object
java.lang.Object
   ↳ com.google.gdata.wireformats.AltFormat

Class Overview

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.

Summary

Nested Classes
class AltFormat.Builder A builder for AltFormat. 
Fields
public static final AltFormat APPLICATION_XML Constant value representing application/xml document
public static final AltFormat ATOM Constant value representing the Atom Syndication Format, as defined by RFC 4287.
public static final AltFormat ATOM_SERVICE Constant value representing the AtomPub Service Document, as described by RFC 5023.
public static final AltFormat MEDIA Constant value representing the media content associated with a GData resource.
public static final AltFormat MEDIA_MULTIPART Constant value representing the MIME Multipart Document format, as described by RFC 2045.
public static final AltFormat OPENSEARCH Constant value representing the OpenSearch Description Document, as described by OpenSearch 1.1.
public static final AltFormat RSS Constant value representing the Really Simple Syndication (RSS) format, as defined by RSS 2.0 .
private final List<ContentType> acceptList List of acceptable matching types for alternate representation
private final AltFormat base The base alt format this alt format wraps another one, for the *-in-script variants.
private final ContentType contentType Primary MIME content type for alternate representation
private final Set<AltFormat> extraInputFormats
private final boolean isSelectableByType Boolean used to indicate that the primary MIME type can be used to select the representation.
private final String name Formal name of alternate representation
private final WireFormat wireFormat Wire format to use when parsing or generating the class (or null if no associated wire format exists).
Public Constructors
AltFormat(String name, WireFormat wireFormat, ContentType contentType, List<ContentType> acceptList, boolean isSelectableByType)
This constructor is deprecated. Please use the AltFormat.Builder instead. See builder().
Public Methods
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(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.
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.
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.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final AltFormat APPLICATION_XML

Constant value representing application/xml document

public static final AltFormat ATOM

Constant value representing the Atom Syndication Format, as defined by RFC 4287.

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.

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.

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.

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.

public static final AltFormat RSS

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

private final List<ContentType> acceptList

List of acceptable matching types for alternate representation

private final AltFormat base

The base alt format this alt format wraps another one, for the *-in-script variants.

private final ContentType contentType

Primary MIME content type for alternate representation

private final Set<AltFormat> extraInputFormats

private final boolean isSelectableByType

Boolean used to indicate that the primary MIME type can be used to select the representation.

private final String name

Formal name of alternate representation

private final WireFormat wireFormat

Wire format to use when parsing or generating the class (or null if no associated wire format exists).

Public Constructors

public AltFormat (String name, WireFormat wireFormat, ContentType contentType, List<ContentType> acceptList, boolean isSelectableByType)

This constructor is 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.

Public Methods

public boolean allowInputFormat (AltFormat inputFormat)

Returns true if inputFormat is allowed as input format when this format with this format as the output format.

Parameters
inputFormat

public static AltFormat.Builder builder ()

Creates a builder for a new AltFormat.

public static AltFormat.Builder builder (AltFormat format)

Creates a builder for a new AltFormat. Pre-initializes the builder with a prototype format.

Parameters
format

public boolean equals (Object o)

Parameters
o

public AltFormat getBaseFormat ()

Returns the base format, if this format is a variant. Otherwise returns null.

public ContentType getContentType ()

Returns the primary MIME content type used for the representation.

public 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.

public String getName ()

Returns the short name for this format. This values is suitable for use as the value of the alt query parameter.

public WireFormat getWireFormat ()

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

public boolean hasBaseFormat ()

Returns true if this format is a variant, such as *-in-script.

public int hashCode ()

public boolean isSelectableByType ()

Returns true, indicates that the MIME content type can be used as an alias to select the representation.

public String toString ()