Class StructuredFieldBareItem
java.lang.Object
org.apache.hc.core5.http.structured.StructuredFieldBareItem
-
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbyte[]longgetType()getValue()Returns the value using its Java representation.inthashCode()static StructuredFieldBareItemofBoolean(boolean value) Creates a Boolean bare Item.static StructuredFieldBareItemofByteSequence(byte[] value) Creates a Byte Sequence bare Item using a defensive copy.static StructuredFieldBareItemofDate(long epochSeconds) Creates a Date bare Item expressed as seconds since the Unix epoch.static StructuredFieldBareItemofDecimal(BigDecimal value) Creates a Decimal bare Item, applying the Structured Field rounding algorithm.static StructuredFieldBareItemofDisplayString(String value) Creates a Unicode Display String bare Item.static StructuredFieldBareItemofInteger(long value) Creates an Integer bare Item.static StructuredFieldBareItemCreates an ASCII String bare Item.static StructuredFieldBareItemCreates a Token bare Item.toString()
-
Method Details
-
ofInteger
Creates an Integer bare Item.- Parameters:
value- the integer value.- Returns:
- the bare Item.
- Throws:
IllegalArgumentException- if the value is outside the Structured Field range.
-
ofDecimal
Creates a Decimal bare Item, applying the Structured Field rounding algorithm.- Parameters:
value- the decimal value.- Returns:
- the bare Item.
- Throws:
IllegalArgumentException- if the rounded value has more than 12 integer digits.
-
ofString
Creates an ASCII String bare Item.- Parameters:
value- the printable ASCII value.- Returns:
- the bare Item.
- Throws:
IllegalArgumentException- if the value contains a character outside SP through~.
-
ofToken
Creates a Token bare Item.- Parameters:
value- the token value.- Returns:
- the bare Item.
- Throws:
IllegalArgumentException- if the value is not an Structured Field token.
-
ofByteSequence
Creates a Byte Sequence bare Item using a defensive copy.- Parameters:
value- the byte sequence.- Returns:
- the bare Item.
-
ofBoolean
Creates a Boolean bare Item.- Parameters:
value- the boolean value.- Returns:
- the bare Item.
-
ofDate
Creates a Date bare Item expressed as seconds since the Unix epoch.- Parameters:
epochSeconds- seconds since the Unix epoch.- Returns:
- the bare Item.
- Throws:
IllegalArgumentException- if the value is outside the Structured Field Integer range.
-
ofDisplayString
Creates a Unicode Display String bare Item.- Parameters:
value- the Unicode value.- Returns:
- the bare Item.
- Throws:
IllegalArgumentException- if the value contains an unpaired surrogate.
-
getType
- Returns:
- the bare Item type.
-
getValue
Returns the value using its Java representation. Byte sequences are defensively copied.- Returns:
- the value.
-
getLongValue
public long getLongValue()- Returns:
- the Integer or Date value.
- Throws:
IllegalStateException- if this Item is not an Integer or Date.
-
getDecimalValue
- Returns:
- the Decimal value.
- Throws:
IllegalStateException- if this Item is not a Decimal.
-
getTextValue
- Returns:
- the String, Token, or Display String value.
- Throws:
IllegalStateException- if this Item is not one of those textual types.
-
getByteSequenceValue
public byte[] getByteSequenceValue()- Returns:
- a defensive copy of the Byte Sequence value.
- Throws:
IllegalStateException- if this Item is not a Byte Sequence.
-
getBooleanValue
public boolean getBooleanValue()- Returns:
- the Boolean value.
- Throws:
IllegalStateException- if this Item is not a Boolean.
-
equals
-
hashCode
-
toString
-