com.oopitis.weather
Class QueryHint

java.lang.Object
  extended by com.oopitis.weather.QueryHint
Direct Known Subclasses:
OwmQueryHint

public class QueryHint
extends java.lang.Object

A hint about what should be returned for a query. The basic information in this class includes the weather properties of interest, the features to be included and the features to be excluded. A weather service examines this information and decides which weather reports to create. In general, the list of requested weather properties take precedence when determining which features to include, unless a feature is explicitly excluded. If a feature is explicitly included, it will be considered even though the feature may not be associated with the requested properties.

For example, when WeatherService.HumidityPercent is included, a weather service may decide to create weather reports for both WeatherService.CONDITIONS_HOUR and WeatherService.CONDITIONS_DAY because both features contain information about humidity. If WeatherService.CONDITIONS_DAY is explicitly excluded in the hint, the weather service will create weather reports only for WeatherService.CONDITIONS_HOUR. If WeatherService.ALERT is explicitly included in the hint, the weather service will also include weather alerts even though they may not contain information about humidity.

Different service providers may interpret a hint differently, or extend this class to include more options specific to their services.

See Also:
Feature

Constructor Summary
QueryHint()
          Creates a hint.
 
Method Summary
 void exclude(Feature... features)
          Indicates that weather reports from a list of features must be excluded.
 Feature[] getExcludedFeatures()
          Returns the list of excluded features.
 Feature[] getIncludedFeatures()
          Returns the list of included features.
 WeatherProperty[] getProperties()
          Returns the list of weather properties of interest.
 void include(Feature... features)
          Indicates that weather reports from a list of features must be included.
 void include(Queryable... queryables)
          Indicates that a weather report must be included if any property in the given list of queryables is applicable to the report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryHint

public QueryHint()
Creates a hint.

Method Detail

include

public void include(Feature... features)
Indicates that weather reports from a list of features must be included.

Parameters:
features - the list of features to be included
Throws:
java.lang.IllegalArgumentException - if the list contains null element

exclude

public void exclude(Feature... features)
Indicates that weather reports from a list of features must be excluded.

Parameters:
features - the list of features to be excluded
Throws:
java.lang.IllegalArgumentException - if the list contains null element

include

public void include(Queryable... queryables)
Indicates that a weather report must be included if any property in the given list of queryables is applicable to the report.

Parameters:
queryables - the list of queryables applicable to the reports
Throws:
java.lang.IllegalArgumentException - if the list contains null element

getIncludedFeatures

public Feature[] getIncludedFeatures()
Returns the list of included features. The list of included features and the list of excluded features are mutually exclusive.

Returns:
the list of included features

getExcludedFeatures

public Feature[] getExcludedFeatures()
Returns the list of excluded features. The list of included features and the list of excluded features are mutually exclusive.

Returns:
the list of excluded features

getProperties

public WeatherProperty[] getProperties()
Returns the list of weather properties of interest.

Returns:
the list of weather properties of interest