]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | /* |
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 | |
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 | ||
18 | <@pp.dropOutputFile /> | |
19 | <@pp.changeOutputFile name="/org/apache/arrow/vector/complex/impl/AbstractFieldReader.java" /> | |
20 | ||
21 | ||
22 | <#include "/@includes/license.ftl" /> | |
23 | ||
24 | package org.apache.arrow.vector.complex.impl; | |
25 | ||
26 | <#include "/@includes/vv_imports.ftl" /> | |
27 | ||
28 | /** | |
29 | * Source code generated using FreeMarker template ${.template_name} | |
30 | */ | |
31 | @SuppressWarnings("unused") | |
32 | abstract class AbstractFieldReader extends AbstractBaseReader implements FieldReader{ | |
33 | ||
34 | AbstractFieldReader(){ | |
35 | super(); | |
36 | } | |
37 | ||
38 | /** | |
39 | * Returns true if the current value of the reader is not null | |
40 | * @return whether the current value is set | |
41 | */ | |
42 | public boolean isSet() { | |
43 | return true; | |
44 | } | |
45 | ||
46 | @Override | |
47 | public Field getField() { | |
48 | fail("getField"); | |
49 | return null; | |
50 | } | |
51 | ||
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)"); | |
59 | return null; | |
60 | } | |
61 | ||
62 | public ${friendlyType} read${safeType}() { | |
63 | fail("read${safeType}()"); | |
64 | return null; | |
65 | } | |
66 | ||
67 | </#list> | |
68 | public void copyAsValue(StructWriter writer) { | |
69 | fail("CopyAsValue StructWriter"); | |
70 | } | |
71 | ||
72 | public void copyAsField(String name, StructWriter writer) { | |
73 | fail("CopyAsField StructWriter"); | |
74 | } | |
75 | ||
76 | public void copyAsField(String name, ListWriter writer) { | |
77 | fail("CopyAsFieldList"); | |
78 | } | |
79 | ||
80 | public void copyAsField(String name, MapWriter writer) { | |
81 | fail("CopyAsFieldMap"); | |
82 | } | |
83 | ||
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) { | |
87 | fail("${name}"); | |
88 | } | |
89 | ||
90 | public void read(Nullable${name}Holder holder) { | |
91 | fail("${name}"); | |
92 | } | |
93 | ||
94 | public void read(int arrayIndex, ${name}Holder holder) { | |
95 | fail("Repeated${name}"); | |
96 | } | |
97 | ||
98 | public void read(int arrayIndex, Nullable${name}Holder holder) { | |
99 | fail("Repeated${name}"); | |
100 | } | |
101 | ||
102 | public void copyAsValue(${name}Writer writer) { | |
103 | fail("CopyAsValue${name}"); | |
104 | } | |
105 | ||
106 | public void copyAsField(String name, ${name}Writer writer) { | |
107 | fail("CopyAsField${name}"); | |
108 | } | |
109 | ||
110 | </#list></#list> | |
111 | public FieldReader reader(String name) { | |
112 | fail("reader(String name)"); | |
113 | return null; | |
114 | } | |
115 | ||
116 | public FieldReader reader() { | |
117 | fail("reader()"); | |
118 | return null; | |
119 | } | |
120 | ||
121 | public int size() { | |
122 | fail("size()"); | |
123 | return -1; | |
124 | } | |
125 | ||
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())); | |
128 | } | |
129 | } | |
130 | ||
131 | ||
132 |