org.jboss.resteasy.specimpl

## Class VariantListBuilderImpl

- java.lang.Object
- - javax.ws.rs.core.Variant.VariantListBuilder
  - - org.jboss.resteasy.specimpl.VariantListBuilderImpl

-     public class VariantListBuilderImpl
      extends Variant.VariantListBuilder

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VariantListBuilderImpl()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Variant.VariantListBuilder` | `add()` Add the current combination of metadata to the list of supported variants, after this method is called the current combination of metadata is emptied.
    `List<Variant>` | `build()` Add the current combination of metadata to the list of supported variants (provided the current combination of metadata is not empty) and build a list of representation variants from the current state of the builder.
    `Variant.VariantListBuilder` | `encodings(String... encodings)` Set the encoding(s) for this variant.
    `Variant.VariantListBuilder` | `languages(Locale... languages)` Set the language(s) for this variant.
    `Variant.VariantListBuilder` | `mediaTypes(MediaType... mediaTypes)` Set the media type(s) for this variant.

    - ### Methods inherited from class javax.ws.rs.core.Variant.VariantListBuilder

      `newInstance`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VariantListBuilderImpl

          public VariantListBuilderImpl()

  - ### Method Detail

    - #### build

          public List<Variant> build()

      Description copied from class: `Variant.VariantListBuilder`
      Add the current combination of metadata to the list of supported variants (provided the current combination of metadata is not empty) and build a list of representation variants from the current state of the builder. After this method is called the builder is reset to an empty state.
      Specified by:
        `build` in class `Variant.VariantListBuilder`
      Returns:
        a list of representation variants.

    - #### add

          public Variant.VariantListBuilder add()

      Description copied from class: `Variant.VariantListBuilder`
      Add the current combination of metadata to the list of supported variants, after this method is called the current combination of metadata is emptied.

      If more than one value is supplied for one or more of the variant properties then a variant will be generated for each possible combination. E.g. in the following `list` would have five (4 + 1) members:

          List list = VariantListBuilder.newInstance()
                   .languages(Locale.ENGLISH, Locale.FRENCH).encodings("zip", "identity").add()
                   .languages(Locale.GERMAN).mediaTypes(MediaType.TEXT_PLAIN_TYPE).add()
                   .build()

      Note that it is not necessary to call the `add()` method immediately before the build method is called. E.g. the resulting list produced in the example above would be identical to the list produced by the following code:

          List list = VariantListBuilder.newInstance()
                   .languages(Locale.ENGLISH, Locale.FRENCH).encodings("zip", "identity").add()
                   .languages(Locale.GERMAN).mediaTypes(MediaType.TEXT_PLAIN_TYPE)
                   .build()

      Specified by:
        `add` in class `Variant.VariantListBuilder`
      Returns:
        the updated builder.

    - #### languages

          public Variant.VariantListBuilder languages(Locale... languages)

      Description copied from class: `Variant.VariantListBuilder`
      Set the language(s) for this variant.
      Specified by:
        `languages` in class `Variant.VariantListBuilder`
      Parameters:
        `languages` - the available languages.
      Returns:
        the updated builder.

    - #### encodings

          public Variant.VariantListBuilder encodings(String... encodings)

      Description copied from class: `Variant.VariantListBuilder`
      Set the encoding(s) for this variant.
      Specified by:
        `encodings` in class `Variant.VariantListBuilder`
      Parameters:
        `encodings` - the available encodings.
      Returns:
        the updated builder.

    - #### mediaTypes

          public Variant.VariantListBuilder mediaTypes(MediaType... mediaTypes)

      Description copied from class: `Variant.VariantListBuilder`
      Set the media type(s) for this variant.
      Specified by:
        `mediaTypes` in class `Variant.VariantListBuilder`
      Parameters:
        `mediaTypes` - the available mediaTypes. If specific charsets are supported they should be included as parameters of the respective media type.
      Returns:
        the updated builder.

Copyright © 2014. All Rights Reserved.