Class FieldsParameter


  • public class FieldsParameter
    extends Parameter
    By default the API will return the complete dataset for each endpoint request as defined in the respective endpoint documentation. However, oftentimes only a portion of the complete dataset is required by an application which is where the fields parameter is useful. The fields parameter allows you to control the output by passing a comma-separated list of the required properties you want returned for each object within the dataset.

    For example, your application only needs the observed temperature in degrees Fahrenheit, the primary weather type and weather icon. Using dot-notation to indicate these properties.
    • Constructor Detail

      • FieldsParameter

        public FieldsParameter()
        Basic constructor for the fields parameter. Use withFields(String...) to add fields
    • Method Detail

      • initWith

        public static FieldsParameter initWith​(CodedInterface... fields)
        Static instantiation for a fields parameter
        Parameters:
        fields - fields to create the parameter with.
        Returns:
        constructed fields parameter.
      • initWith

        public static FieldsParameter initWith​(String... fields)
        Static instantiation for a fields parameter
        Parameters:
        fields - fields to create the parameter with.
        Returns:
        constructed fields parameter.
      • withFields

        @Deprecated
        public FieldsParameter withFields​(CodedInterface... fields)
        Deprecated.
        Add fields to the parameter
        Parameters:
        fields - array of Coded fields to use.
        Returns:
        field parameter with the fields
      • withFields

        public FieldsParameter withFields​(String... fields)
        Add fields to the parameter
        Parameters:
        fields - array of String fields to use.
        Returns:
        field parameter with the fields