/** * Equivalent to calling {@link #get(String)} and casting the result to a Float. */ public Float getFloat32(String fieldName) { return (Float) getCheckType(fieldName, Schema.Type.FLOAT32); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a Double. */ public Double getFloat64(String fieldName) { return (Double) getCheckType(fieldName, Schema.Type.FLOAT64); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a String. */ public String getString(String fieldName) { return (String) getCheckType(fieldName, Schema.Type.STRING); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a List. */ @SuppressWarnings("unchecked") public <T> List<T> getArray(String fieldName) { return (List<T>) getCheckType(fieldName, Schema.Type.ARRAY); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a Struct. */ public Struct getStruct(String fieldName) { return (Struct) getCheckType(fieldName, Schema.Type.STRUCT); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a Byte. */ public Byte getInt8(String fieldName) { return (Byte) getCheckType(fieldName, Schema.Type.INT8); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a Boolean. */ public Boolean getBoolean(String fieldName) { return (Boolean) getCheckType(fieldName, Schema.Type.BOOLEAN); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a Short. */ public Short getInt16(String fieldName) { return (Short) getCheckType(fieldName, Schema.Type.INT16); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a Integer. */ public Integer getInt32(String fieldName) { return (Integer) getCheckType(fieldName, Schema.Type.INT32); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a Long. */ public Long getInt64(String fieldName) { return (Long) getCheckType(fieldName, Schema.Type.INT64); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a Map. */ @SuppressWarnings("unchecked") public <K, V> Map<K, V> getMap(String fieldName) { return (Map<K, V>) getCheckType(fieldName, Schema.Type.MAP); }
/** * Equivalent to calling {@link #get(String)} and casting the result to a byte[]. */ public byte[] getBytes(String fieldName) { Object bytes = getCheckType(fieldName, Schema.Type.BYTES); if (bytes instanceof ByteBuffer) return ((ByteBuffer) bytes).array(); return (byte[]) bytes; }