Package org.apache.juneau.http.header
Class BasicHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
- All Implemented Interfaces:
- Serializable,- Cloneable,- Header,- NameValuePair
- Direct Known Subclasses:
- BasicBooleanHeader,- BasicCsvHeader,- BasicDateHeader,- BasicEntityTagHeader,- BasicEntityTagsHeader,- BasicIntegerHeader,- BasicLongHeader,- BasicStringHeader,- BasicStringRangesHeader,- BasicUriHeader,- ResponseHeader,- SerializedHeader
Superclass of all headers defined in this package.
 Provides the following features:
 
- Default support for various streams and readers.
- 
      Content from Suppliers.
- Caching.
- Fluent setters.
- Fluent assertions.
See Also:
- 
Constructor SummaryConstructorsModifierConstructorDescriptionBasicHeader(String name, Object value) Constructor.BasicHeader(String name, Supplier<Object> value) Constructor with delayed value.protectedBasicHeader(BasicHeader copyFrom) Copy constructor.
- 
Method SummaryModifier and TypeMethodDescriptionProvides an object for performing assertions against the name of this header.Provides an object for performing assertions against the value of this header.asString()Returns the value of this header as a string.booleanbooleanequalsIgnoreCase(String compare) Returnstrue if the specified value is the same usingString.equalsIgnoreCase(String).get()If a value is present, returns the value, otherwise throwsNoSuchElementException.getName()getValue()inthashCode()booleanReturnstrue if the value exists and is not empty.booleanReturnstrue if the value exists.static BasicHeaderStatic creator.static BasicHeaderof(NameValuePair o) Static creator.If a value is present, returns the value, otherwise returns other.toString()
- 
Constructor Details- 
BasicHeaderConstructor.- Parameters:
- name- The parameter name.
- value- The parameter value.
 Any non-String value will be converted to a String using- Object.toString().
 Can also be an- Object - Supplier.
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicHeaderConstructor with delayed value.Header value is re-evaluated on each call to getValue().- Parameters:
- name- The header name.
- value- The supplier of the header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicHeaderCopy constructor.- Parameters:
- copyFrom- The object to copy.
 
 
- 
- 
Method Details- 
ofStatic creator.- Parameters:
- name- The parameter name.
- value- The parameter value.
 Can be- null .
- Returns:
- A new header bean, or null if value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
ofStatic creator.- Parameters:
- o- The name value pair that makes up the header name and value. The parameter value.
 Any non-String value will be converted to a String using- Object.toString().
- Returns:
- A new header bean.
 
- 
getName- Specified by:
- getNamein interface- NameValuePair
 
- 
getValue- Specified by:
- getValuein interface- NameValuePair
 
- 
getElements- Specified by:
- getElementsin interface- Header
- Throws:
- ParseException
 
- 
equalsIgnoreCaseReturnstrue if the specified value is the same usingString.equalsIgnoreCase(String).- Parameters:
- compare- The value to compare against.
- Returns:
- true if the specified value is the same.
 
- 
assertNameProvides an object for performing assertions against the name of this header.- Returns:
- An object for performing assertions against the name of this header.
 
- 
assertStringValueProvides an object for performing assertions against the value of this header.- Returns:
- An object for performing assertions against the value of this header.
 
- 
asStringReturns the value of this header as a string.- Returns:
- The value of this header as a string, or Optional.empty()if the value isnull 
 
- 
isPresentReturnstrue if the value exists.This is a shortcut for calling asString().isPresent() .- Returns:
- true if the value exists.
 
- 
isNotEmptyReturnstrue if the value exists and is not empty.This is a shortcut for calling !asString().orElse( ."" ).isEmpty()- Returns:
- true if the value exists and is not empty.
 
- 
getIf a value is present, returns the value, otherwise throwsNoSuchElementException.This is a shortcut for calling asString().get() .- Returns:
- The value if present.
 
- 
orElseIf a value is present, returns the value, otherwise returns other.This is a shortcut for calling asString().orElse( .other )- Parameters:
- other- The other value.
- Returns:
- The value if present or the other value if not.
 
- 
equals
- 
hashCode
- 
toString
 
-