PageRenderTime 35ms CodeModel.GetById 11ms RepoModel.GetById 0ms 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
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  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. package org.apache.hadoop.hive.serde2.objectinspector;
  19. /**
  20. * ObjectInspector helps us to look into the internal structure of a complex
  21. * object.
  22. *
  23. * A (probably configured) ObjectInspector instance stands for a specific type
  24. * and a specific way to store the data of that type in the memory.
  25. *
  26. * For native java Object, we can directly access the internal structure through
  27. * member fields and methods. ObjectInspector is a way to delegate that
  28. * functionality away from the Object, so that we have more control on the
  29. * behavior of those actions.
  30. *
  31. * An efficient implementation of ObjectInspector should rely on factory, so
  32. * that we can make sure the same ObjectInspector only has one instance. That
  33. * also makes sure hashCode() and equals() methods of java.lang.Object directly
  34. * works for ObjectInspector as well.
  35. */
  36. public interface ObjectInspector extends Cloneable {
  37. /**
  38. * Category.
  39. *
  40. */
  41. public static enum Category {
  42. PRIMITIVE, LIST, MAP, STRUCT, UNION
  43. };
  44. /**
  45. * Returns the name of the data type that is inspected by this
  46. * ObjectInspector. This is used to display the type information to the user.
  47. *
  48. * For primitive types, the type name is standardized. For other types, the
  49. * type name can be something like "list<int>", "map<int,string>", java class
  50. * names, or user-defined type names similar to typedef.
  51. */
  52. String getTypeName();
  53. /**
  54. * An ObjectInspector must inherit from one of the following interfaces if
  55. * getCategory() returns: PRIMITIVE: PrimitiveObjectInspector LIST:
  56. * ListObjectInspector MAP: MapObjectInspector STRUCT: StructObjectInspector.
  57. */
  58. Category getCategory();
  59. }