S
- scalar output typeA
- array output typepublic abstract class HapiType<S,A>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static HapiType<java.lang.Double,double[]> |
DOUBLE
Floating point type.
|
static HapiType<java.lang.Integer,int[]> |
INTEGER
Integer type.
|
static HapiType<java.lang.String,java.lang.String[]> |
ISOTIME
Restricted ISO-8601 timestamp type.
|
static HapiType<java.lang.String,java.lang.String[]> |
STRING
String type.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
adjustInfo(DefaultValueInfo info)
Performs customisation appropriate to this type on a
metadata info object that will represent it.
|
abstract void |
applyFills(A array,
S fill)
Replaces array elements matching a given fill value
in place with a suitable blank value representation.
|
static HapiType<?,?> |
fromText(java.lang.String txt)
Returns a type value given the identifier string as found
in the "type" member of a Parameter JSON object.
|
java.lang.Class<A> |
getArrayClass()
Returns the output class for array values.
|
int |
getByteCount(int paramLength)
Returns the number of bytes required for a scalar element
with this type and the supplied length value.
|
java.lang.String |
getIdentifier()
Returns the name for this type, which is also the
value of the "type" member in a corresponding Parameter JSON object.
|
java.lang.Class<S> |
getScalarClass()
Returns the output class for scalar values.
|
abstract A |
readBinaryArray(byte[] buf,
int ipos,
int elSize,
int nel)
Returns an array value of this type from a binary buffer.
|
abstract S |
readBinaryScalar(byte[] buf,
int ipos,
int leng)
Returns a scalar value of this type from its binary representation.
|
abstract A |
readStringArray(java.lang.String[] txts,
int ipos,
int nel)
Returns an array value of this type from an array of string
representations.
|
abstract S |
readStringScalar(java.lang.String txt)
Returns a scalar value of this type from its text representation.
|
java.lang.String |
toString() |
public static final HapiType<java.lang.String,java.lang.String[]> STRING
public static final HapiType<java.lang.String,java.lang.String[]> ISOTIME
public static final HapiType<java.lang.Double,double[]> DOUBLE
public static final HapiType<java.lang.Integer,int[]> INTEGER
public java.lang.String getIdentifier()
public java.lang.Class<S> getScalarClass()
public java.lang.Class<A> getArrayClass()
public int getByteCount(int paramLength)
paramLength
is as supplied by
HapiParam.getLength()
.paramLength
- string length, or -1 for non-string typespublic abstract S readStringScalar(java.lang.String txt)
txt
- text field as found in CSVpublic abstract S readBinaryScalar(byte[] buf, int ipos, int leng)
buf
- bytes representing value as found in binary format streamipos
- starting position of value in bufleng
- length of value in bytespublic abstract A readStringArray(java.lang.String[] txts, int ipos, int nel)
txts
- text fields as found in CSV, elements may be nullipos
- index of first element in txts to readnel
- number of elements in txts to readpublic abstract A readBinaryArray(byte[] buf, int ipos, int elSize, int nel)
buf
- bytes representing values as found in binary format streamipos
- starting position of values in bufelSize
- number of bytes per valuenel
- number of values to decodenel
elementspublic abstract void applyFills(A array, S fill)
array
- array whose elements can be replacedfill
- non-null value for which corresponding array
elements should be blankedpublic abstract void adjustInfo(DefaultValueInfo info)
info
- metadata object to modify in placepublic java.lang.String toString()
toString
in class java.lang.Object
public static HapiType<?,?> fromText(java.lang.String txt)
txt
- identifier string