• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/db-4.7.25.NC/java/src/com/sleepycat/persist/raw/
1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2002,2008 Oracle.  All rights reserved.
5 *
6 * $Id: RawType.java,v 1.1 2008/02/07 17:12:28 mark Exp $
7 */
8
9package com.sleepycat.persist.raw;
10
11import java.util.List;
12import java.util.Map;
13
14import com.sleepycat.persist.model.Entity;
15import com.sleepycat.persist.model.Persistent;
16
17/**
18 * The type definition for a simple or complex persistent type, or an array
19 * of persistent types.
20 *
21 * <p>{@code RawType} objects are thread-safe.  Multiple threads may safely
22 * call the methods of a shared {@code RawType} object.</p>
23 *
24 * @author Mark Hayes
25 */
26public interface RawType {
27
28    /**
29     * Returns the class name for this type in the format specified by {@link
30     * Class#getName}.
31     *
32     * <p>If this class currently exists (has not been removed or renamed) then
33     * the class name may be passed to {@link Class#forName} to get the current
34     * {@link Class} object.  However, if this raw type is not the current
35     * version of the class, this type information may differ from that of the
36     * current {@link Class}.</p>
37     */
38    String getClassName();
39
40    /**
41     * Returns the class version for this type.  For simple types, zero is
42     * always returned.
43     *
44     * @see Entity#version
45     * @see Persistent#version
46     */
47    int getVersion();
48
49    /**
50     * Returns whether this is a {@link <a
51     * href="../model/Entity.html#simpleTypes">simple type</a>}: primitive,
52     * primitive wrapper, BigInteger, String or Date.
53     * <!--
54     * primitive wrapper, BigInteger, BigDecimal, String or Date.
55     * -->
56     *
57     * <p>If true is returned, {@link #isPrimitive} can be called for more
58     * information, and a raw value of this type is represented as a simple
59     * type object (not as a {@link RawObject}).</p>
60     *
61     * <p>If false is returned, this is a complex type, an array type (see
62     * {@link #isArray}), or an enum type, and a raw value of this type is
63     * represented as a {@link RawObject}.</p>
64     */
65    boolean isSimple();
66
67    /**
68     * Returns whether this type is a Java primitive: char, byte, short, int,
69     * long, float or double.
70     *
71     * <p>If true is returned, this is also a simple type.  In other words,
72     * primitive types are a subset of simple types.</p>
73     *
74     * <p>If true is returned, a raw value of this type is represented as a
75     * non-null instance of the primitive type's wrapper class.  For example,
76     * an <code>int</code> raw value is represented as an
77     * <code>Integer</code>.</p>
78     */
79    boolean isPrimitive();
80
81    /**
82     * Returns whether this is an enum type.
83     *
84     * <p>If true is returned, a value of this type is a {@link RawObject} and
85     * the enum constant String is available via {@link RawObject#getEnum}.</p>
86     *
87     * <p>If false is returned, then this is a complex type, an array type (see
88     * {@link #isArray}), or a simple type (see {@link #isSimple}).</p>
89     */
90    boolean isEnum();
91
92    /**
93     * Returns an unmodifiable list of the names of the enum instances, or null
94     * if this is not an enum type.
95     */
96    List<String> getEnumConstants();
97
98    /**
99     * Returns whether this is an array type.  Raw value arrays are represented
100     * as {@link RawObject} instances.
101     *
102     * <p>If true is returned, the array component type is returned by {@link
103     * #getComponentType} and the number of array dimensions is returned by
104     * {@link #getDimensions}.</p>
105     *
106     * <p>If false is returned, then this is a complex type, an enum type (see
107     * {@link #isEnum}), or a simple type (see {@link #isSimple}).</p>
108     */
109    boolean isArray();
110
111    /**
112     * Returns the number of array dimensions, or zero if this is not an array
113     * type.
114     */
115    int getDimensions();
116
117    /**
118     * Returns the array component type, or null if this is not an array type.
119     */
120    RawType getComponentType();
121
122    /**
123     * Returns a map of field name to raw field for each non-static
124     * non-transient field declared in this class, or null if this is not a
125     * complex type (in other words, this is a simple type or an array type).
126     */
127    Map<String,RawField> getFields();
128
129    /**
130     * Returns the type of the superclass, or null if the superclass is Object
131     * or this is not a complex type (in other words, this is a simple type or
132     * an array type).
133     */
134    RawType getSuperType();
135}
136