Package net.ygbstudio.jbrave.core.model
Record Class BraveSearchHeader
java.lang.Object
java.lang.Record
net.ygbstudio.jbrave.core.model.BraveSearchHeader
- Record Components:
header- the header namevalue- the header value
A record class representing a Brave Search API header.
This class is an immutable representation of a Brave Search API header, which consists of a header name and a corresponding value. It is used for internal handling of headers.
-
Constructor Summary
ConstructorsConstructorDescriptionBraveSearchHeader(String header, String value) Creates an instance of aBraveSearchHeaderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static <K extends SearchHeader>
Stream<BraveSearchHeader> fromHeaderMap(@NotNull Map<K, String> headerMap) Returns a stream ofBraveSearchHeaderobjects created from the entries of the given map.final inthashCode()Returns a hash code value for this object.header()Returns the value of theheaderrecord component.toEntry()Returns an immutable entry of this header.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Method Details
-
fromHeaderMap
public static <K extends SearchHeader> Stream<BraveSearchHeader> fromHeaderMap(@NotNull @NotNull Map<K, String> headerMap) Returns a stream ofBraveSearchHeaderobjects created from the entries of the given map.This method takes a map of
SearchHeaderobjects and their corresponding values, and converts them into a stream ofBraveSearchHeaderobjects.- Type Parameters:
K- the type of the keys in the map, which must extendSearchHeader- Parameters:
headerMap- a map ofSearchHeaderobjects and their corresponding values- Returns:
- a stream of
BraveSearchHeaderobjects
-
toEntry
Returns an immutable entry of this header.This method is used to convert a
BraveSearchHeaderobject into aMap.Entryobject, which is useful for adding headers to the request.- Returns:
- an immutable entry of this header
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
header
Returns the value of theheaderrecord component.- Returns:
- the value of the
headerrecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-