1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements.  See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership.  The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License.  You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 // automatically generated by the FlatBuffers compiler, do not modify
18 
19 package org.apache.arrow.flatbuf;
20 
21 import java.nio.*;
22 import java.lang.*;
23 import java.util.*;
24 import com.google.flatbuffers.*;
25 
26 @SuppressWarnings("unused")
27 /**
28  * ----------------------------------------------------------------------
29  * A field represents a named column in a record / row batch or child of a
30  * nested type.
31  */
32 public final class Field extends Table {
ValidateVersion()33   public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
getRootAsField(ByteBuffer _bb)34   public static Field getRootAsField(ByteBuffer _bb) { return getRootAsField(_bb, new Field()); }
getRootAsField(ByteBuffer _bb, Field obj)35   public static Field getRootAsField(ByteBuffer _bb, Field obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
__init(int _i, ByteBuffer _bb)36   public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
__assign(int _i, ByteBuffer _bb)37   public Field __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
38 
39   /**
40    * Name is not required, in i.e. a List
41    */
name()42   public String name() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
nameAsByteBuffer()43   public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
nameInByteBuffer(ByteBuffer _bb)44   public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
45   /**
46    * Whether or not this field can contain nulls. Should be true in general.
47    */
nullable()48   public boolean nullable() { int o = __offset(6); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
typeType()49   public byte typeType() { int o = __offset(8); return o != 0 ? bb.get(o + bb_pos) : 0; }
50   /**
51    * This is the type of the decoded value if the field is dictionary encoded.
52    */
type(Table obj)53   public Table type(Table obj) { int o = __offset(10); return o != 0 ? __union(obj, o + bb_pos) : null; }
54   /**
55    * Present only if the field is dictionary encoded.
56    */
dictionary()57   public org.apache.arrow.flatbuf.DictionaryEncoding dictionary() { return dictionary(new org.apache.arrow.flatbuf.DictionaryEncoding()); }
dictionary(org.apache.arrow.flatbuf.DictionaryEncoding obj)58   public org.apache.arrow.flatbuf.DictionaryEncoding dictionary(org.apache.arrow.flatbuf.DictionaryEncoding obj) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
59   /**
60    * children apply only to nested data types like Struct, List and Union. For
61    * primitive types children will have length 0.
62    */
children(int j)63   public org.apache.arrow.flatbuf.Field children(int j) { return children(new org.apache.arrow.flatbuf.Field(), j); }
children(org.apache.arrow.flatbuf.Field obj, int j)64   public org.apache.arrow.flatbuf.Field children(org.apache.arrow.flatbuf.Field obj, int j) { int o = __offset(14); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
childrenLength()65   public int childrenLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; }
childrenVector()66   public org.apache.arrow.flatbuf.Field.Vector childrenVector() { return childrenVector(new org.apache.arrow.flatbuf.Field.Vector()); }
childrenVector(org.apache.arrow.flatbuf.Field.Vector obj)67   public org.apache.arrow.flatbuf.Field.Vector childrenVector(org.apache.arrow.flatbuf.Field.Vector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
68   /**
69    * User-defined metadata
70    */
customMetadata(int j)71   public org.apache.arrow.flatbuf.KeyValue customMetadata(int j) { return customMetadata(new org.apache.arrow.flatbuf.KeyValue(), j); }
customMetadata(org.apache.arrow.flatbuf.KeyValue obj, int j)72   public org.apache.arrow.flatbuf.KeyValue customMetadata(org.apache.arrow.flatbuf.KeyValue obj, int j) { int o = __offset(16); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
customMetadataLength()73   public int customMetadataLength() { int o = __offset(16); return o != 0 ? __vector_len(o) : 0; }
customMetadataVector()74   public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector() { return customMetadataVector(new org.apache.arrow.flatbuf.KeyValue.Vector()); }
customMetadataVector(org.apache.arrow.flatbuf.KeyValue.Vector obj)75   public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector(org.apache.arrow.flatbuf.KeyValue.Vector obj) { int o = __offset(16); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
76 
createField(FlatBufferBuilder builder, int nameOffset, boolean nullable, byte type_type, int typeOffset, int dictionaryOffset, int childrenOffset, int custom_metadataOffset)77   public static int createField(FlatBufferBuilder builder,
78       int nameOffset,
79       boolean nullable,
80       byte type_type,
81       int typeOffset,
82       int dictionaryOffset,
83       int childrenOffset,
84       int custom_metadataOffset) {
85     builder.startTable(7);
86     Field.addCustomMetadata(builder, custom_metadataOffset);
87     Field.addChildren(builder, childrenOffset);
88     Field.addDictionary(builder, dictionaryOffset);
89     Field.addType(builder, typeOffset);
90     Field.addName(builder, nameOffset);
91     Field.addTypeType(builder, type_type);
92     Field.addNullable(builder, nullable);
93     return Field.endField(builder);
94   }
95 
startField(FlatBufferBuilder builder)96   public static void startField(FlatBufferBuilder builder) { builder.startTable(7); }
addName(FlatBufferBuilder builder, int nameOffset)97   public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); }
addNullable(FlatBufferBuilder builder, boolean nullable)98   public static void addNullable(FlatBufferBuilder builder, boolean nullable) { builder.addBoolean(1, nullable, false); }
addTypeType(FlatBufferBuilder builder, byte typeType)99   public static void addTypeType(FlatBufferBuilder builder, byte typeType) { builder.addByte(2, typeType, 0); }
addType(FlatBufferBuilder builder, int typeOffset)100   public static void addType(FlatBufferBuilder builder, int typeOffset) { builder.addOffset(3, typeOffset, 0); }
addDictionary(FlatBufferBuilder builder, int dictionaryOffset)101   public static void addDictionary(FlatBufferBuilder builder, int dictionaryOffset) { builder.addOffset(4, dictionaryOffset, 0); }
addChildren(FlatBufferBuilder builder, int childrenOffset)102   public static void addChildren(FlatBufferBuilder builder, int childrenOffset) { builder.addOffset(5, childrenOffset, 0); }
createChildrenVector(FlatBufferBuilder builder, int[] data)103   public static int createChildrenVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
startChildrenVector(FlatBufferBuilder builder, int numElems)104   public static void startChildrenVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
addCustomMetadata(FlatBufferBuilder builder, int customMetadataOffset)105   public static void addCustomMetadata(FlatBufferBuilder builder, int customMetadataOffset) { builder.addOffset(6, customMetadataOffset, 0); }
createCustomMetadataVector(FlatBufferBuilder builder, int[] data)106   public static int createCustomMetadataVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
startCustomMetadataVector(FlatBufferBuilder builder, int numElems)107   public static void startCustomMetadataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
endField(FlatBufferBuilder builder)108   public static int endField(FlatBufferBuilder builder) {
109     int o = builder.endTable();
110     return o;
111   }
112 
113   public static final class Vector extends BaseVector {
__assign(int _vector, int _element_size, ByteBuffer _bb)114     public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
115 
get(int j)116     public Field get(int j) { return get(new Field(), j); }
get(Field obj, int j)117     public Field get(Field obj, int j) {  return obj.__assign(__indirect(__element(j), bb), bb); }
118   }
119 }
120 
121