]>
git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/java/vector/src/main/codegen/templates/AbstractFieldReader.java
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 < @pp . dropOutputFile
/>
19 < @pp . changeOutputFile name
= "/org/apache/arrow/vector/complex/impl/AbstractFieldReader.java" />
22 < #include
"/@includes/license.ftl" />
24 package org
. apache
. arrow
. vector
. complex
. impl
;
26 < #include
"/@includes/vv_imports.ftl" />
29 * Source code generated using FreeMarker template ${.template_name}
31 @SuppressWarnings ( "unused" )
32 abstract class AbstractFieldReader
extends AbstractBaseReader
implements FieldReader
{
34 AbstractFieldReader (){
39 * Returns true if the current value of the reader is not null
40 * @return whether the current value is set
42 public boolean isSet () {
47 public Field
getField () {
52 < #list
[ "Object" , "BigDecimal" , "Short" , "Integer" , "Long" , "Boolean" ,
53 "LocalDateTime" , "Duration" , "Period" , "Double" , "Float" ,
54 "Character" , "Text" , "String" , "Byte" , "byte[]" , "PeriodDuration" ] as friendlyType
>
55 < #assign safeType
= friendlyType
/>
56 < #
if safeType
== "byte[]" >< #assign safeType
= "ByteArray" /></ #
if >
57 public $
{ friendlyType
} read$
{ safeType
}( int arrayIndex
) {
58 fail ( "read${safeType}(int arrayIndex)" );
62 public $
{ friendlyType
} read$
{ safeType
}() {
63 fail ( "read${safeType}()" );
68 public void copyAsValue ( StructWriter writer
) {
69 fail ( "CopyAsValue StructWriter" );
72 public void copyAsField ( String name
, StructWriter writer
) {
73 fail ( "CopyAsField StructWriter" );
76 public void copyAsField ( String name
, ListWriter writer
) {
77 fail ( "CopyAsFieldList" );
80 public void copyAsField ( String name
, MapWriter writer
) {
81 fail ( "CopyAsFieldMap" );
84 < #list vv
. types as type
>< #list type
. minor as minor
>< #assign name
= minor
. class ?cap_first
/>
85 < #assign boxedType
= ( minor
. boxedType
! type
. boxedType
) />
86 public void read ( $
{ name
} Holder holder
) {
90 public void read ( Nullable$
{ name
} Holder holder
) {
94 public void read ( int arrayIndex
, $
{ name
} Holder holder
) {
95 fail ( "Repeated${name}" );
98 public void read ( int arrayIndex
, Nullable$
{ name
} Holder holder
) {
99 fail ( "Repeated${name}" );
102 public void copyAsValue ( $
{ name
} Writer writer
) {
103 fail ( "CopyAsValue${name}" );
106 public void copyAsField ( String name
, $
{ name
} Writer writer
) {
107 fail ( "CopyAsField${name}" );
111 public FieldReader
reader ( String name
) {
112 fail ( "reader(String name)" );
116 public FieldReader
reader () {
126 private void fail ( String name
) {
127 throw new IllegalArgumentException ( String
. format ( "You tried to read a [%s] type when you are using a field reader of type [%s]." , name
, this . getClass (). getSimpleName ()));