PageRenderTime 29ms CodeModel.GetById 24ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/tags/release-0.0.0-rc0/hive/external/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspector.java

#
Java | 64 lines | 8 code | 5 blank | 51 comment | 0 complexity | 57abcfa3e68f65b52616bed7e5fbfe7b MD5 | raw file
 1/**
 2 * Licensed to the Apache Software Foundation (ASF) under one
 3 * or more contributor license agreements.  See the NOTICE file
 4 * distributed with this work for additional information
 5 * regarding copyright ownership.  The ASF licenses this file
 6 * to you under the Apache License, Version 2.0 (the
 7 * "License"); you may not use this file except in compliance
 8 * with the License.  You may obtain a copy of the License at
 9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19package org.apache.hadoop.hive.serde2.objectinspector;
20
21/**
22 * ObjectInspector helps us to look into the internal structure of a complex
23 * object.
24 *
25 * A (probably configured) ObjectInspector instance stands for a specific type
26 * and a specific way to store the data of that type in the memory.
27 *
28 * For native java Object, we can directly access the internal structure through
29 * member fields and methods. ObjectInspector is a way to delegate that
30 * functionality away from the Object, so that we have more control on the
31 * behavior of those actions.
32 *
33 * An efficient implementation of ObjectInspector should rely on factory, so
34 * that we can make sure the same ObjectInspector only has one instance. That
35 * also makes sure hashCode() and equals() methods of java.lang.Object directly
36 * works for ObjectInspector as well.
37 */
38public interface ObjectInspector extends Cloneable {
39
40  /**
41   * Category.
42   *
43   */
44  public static enum Category {
45    PRIMITIVE, LIST, MAP, STRUCT, UNION
46  };
47
48  /**
49   * Returns the name of the data type that is inspected by this
50   * ObjectInspector. This is used to display the type information to the user.
51   *
52   * For primitive types, the type name is standardized. For other types, the
53   * type name can be something like "list<int>", "map<int,string>", java class
54   * names, or user-defined type names similar to typedef.
55   */
56  String getTypeName();
57
58  /**
59   * An ObjectInspector must inherit from one of the following interfaces if
60   * getCategory() returns: PRIMITIVE: PrimitiveObjectInspector LIST:
61   * ListObjectInspector MAP: MapObjectInspector STRUCT: StructObjectInspector.
62   */
63  Category getCategory();
64}