Package net.ygbstudio.jbrave.api.filters
Enum Class Freshness
- All Implemented Interfaces:
Serializable,Comparable<Freshness>,Constable,BraveAPIConstant,ClientProvidedOption,ProvidedOption,SearchFilterOption,SearchOption
An enumeration representing freshness filters for the API requests. Filters search results by
when they were discovered.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields inherited from interface net.ygbstudio.jbrave.core.domain.BraveAPIConstant
SEARCH_API_BASEFields inherited from interface net.ygbstudio.jbrave.core.domain.ProvidedOption
UNITS -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull @Unmodifiable SearchOptionCarrier<String> Joins the given dates with the "to" keyword and returns it as a value for the freshness filter.@NotNull @Unmodifiable SearchOptionCarrier<String> Converts this search filter to aSearchOptionCarrierthat can be used to build a URL parameter.@NotNull StringurlParam()Returns the URL parameter associated with this constant.value()Returns the value of the constant.static FreshnessReturns the enum constant of this class with the specified name.static Freshness[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
WITHIN_24H
-
WITHIN_7D
-
WITHIN_31D
-
WITHIN_1Y
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
between
@Contract("_, _ -> new") @NotNull public static @NotNull @Unmodifiable SearchOptionCarrier<String> between(@NotNull @NotNull LocalDate startDate, @NotNull @NotNull LocalDate endDate) Joins the given dates with the "to" keyword and returns it as a value for the freshness filter.This method ensures that builders understand the correct range of freshness for the query.
- Parameters:
startDate- the first date.endDate- the second date.- Returns:
- the freshness filter value with the joined dates as a string.
- Throws:
InvalidFreshnessInterval- if the end date is before the start date.
-
value
Description copied from interface:BraveAPIConstantReturns the value of the constant. Must be implemented by the enum constants.- Specified by:
valuein interfaceBraveAPIConstant- Returns:
- the value of the constant
-
urlParam
Description copied from interface:BraveAPIConstantReturns the URL parameter associated with this constant. It can be implemented by default at the interface level with the value of the parameter.This method is used to generate the URL parameter for the API requests and represents a unit of
option/parameterName/parameterConstant + "=" + parameterValue.A
parameterValuemay be provided by the API or require that the client provides it. By default, all options/parameters names are provided by the API.- Specified by:
urlParamin interfaceBraveAPIConstant- Returns:
- the URL parameter associated with this constant
- See Also:
-
toSearchOption
@Contract(" -> new") @NotNull public @NotNull @Unmodifiable SearchOptionCarrier<String> toSearchOption()Description copied from interface:SearchFilterOptionConverts this search filter to aSearchOptionCarrierthat can be used to build a URL parameter.- Specified by:
toSearchOptionin interfaceProvidedOption- Specified by:
toSearchOptionin interfaceSearchFilterOption- Returns:
- a
SearchOptionCarrierrepresenting this search filter
-