Package org.greenbytes.http.sfv
Class IntegerItem
- java.lang.Object
-
- org.greenbytes.http.sfv.IntegerItem
-
- All Implemented Interfaces:
LongSupplier,Supplier<Long>,Item<Long>,ListElement<Long>,NumberItem<Long>,Parameterizable<Long>,Type<Long>
public class IntegerItem extends Object implements NumberItem<Long>
Represents an Integer.- See Also:
- Section 3.3.1 of RFC 9651
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Longget()longgetAsLong()intgetDivisor()Returns the divisor to be used to obtain the actual numerical value (as opposed to the underlying long value returned byLongSupplier.getAsLong()).ParametersgetParams()Get theParametersof thisItem.Stringserialize()Serialize.StringBuilderserializeTo(StringBuilder sb)Serialize to an existingStringBuilder.static IntegerItemvalueOf(long value)Creates anIntegerIteminstance representing the specifiedlongvalue.IntegerItemwithParams(Parameters params)Given an existingItem, return a new instance with the specifiedParameters.
-
-
-
Method Detail
-
valueOf
public static IntegerItem valueOf(long value)
Creates anIntegerIteminstance representing the specifiedlongvalue.- Parameters:
value- alongvalue.- Returns:
- a
IntegerItemrepresentingvalue.
-
withParams
public IntegerItem withParams(Parameters params)
Description copied from interface:ParameterizableGiven an existingItem, return a new instance with the specifiedParameters.- Specified by:
withParamsin interfaceItem<Long>- Specified by:
withParamsin interfaceNumberItem<Long>- Specified by:
withParamsin interfaceParameterizable<Long>- Parameters:
params-Parametersto set (must be non-null)- Returns:
- new instance with specified
Parameters.
-
getParams
public Parameters getParams()
Description copied from interface:ParameterizableGet theParametersof thisItem.- Specified by:
getParamsin interfaceParameterizable<Long>- Returns:
- the parameters.
-
serializeTo
public StringBuilder serializeTo(StringBuilder sb)
Description copied from interface:TypeSerialize to an existingStringBuilder.- Specified by:
serializeToin interfaceType<Long>- Parameters:
sb- where to serialize to- Returns:
- the
StringBuilderso calls can be chained.
-
getAsLong
public long getAsLong()
- Specified by:
getAsLongin interfaceLongSupplier
-
getDivisor
public int getDivisor()
Description copied from interface:NumberItemReturns the divisor to be used to obtain the actual numerical value (as opposed to the underlying long value returned byLongSupplier.getAsLong()).- Specified by:
getDivisorin interfaceNumberItem<Long>- Returns:
- the divisor (
1for Integers,1000for Decimals)
-
-