View Javadoc
1   /*
2    * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package com.sun.tools.internal.xjc.model.nav;
27  
28  import com.sun.codemodel.internal.JType;
29  import com.sun.tools.internal.xjc.outline.Aspect;
30  import com.sun.tools.internal.xjc.outline.Outline;
31  
32  /**
33   * A type.
34   *
35   * See the package documentaion for details.
36   *
37   * @author Kohsuke Kawaguchi
38   */
39  public interface NType {
40      /**
41       * Returns the representation of this type in code model.
42       * <p>
43       * This operation requires the whole model to be built,
44       * and hence it takes {@link Outline}.
45       * <p>
46       * Under some code generation strategy, some bean classes
47       * are considered implementation specific (such as impl.FooImpl class)
48       * These classes always have accompanying "exposed" type (such as
49       * the Foo interface).
50       * <p>
51       * For such Jekyll and Hyde type, the aspect parameter determines
52       * which personality is returned.
53       *
54       * @param aspect
55       *      If {@link Aspect#IMPLEMENTATION}, this method returns the
56       *      implementation specific class that this type represents.
57       *      If {@link Aspect#EXPOSED}, this method returns the
58       *      publicly exposed type that this type represents.
59       *
60       *      For ordinary classes, the aspect parameter is meaningless.
61       *
62       */
63      JType toType(Outline o, Aspect aspect);
64  
65      /**
66       * Returns true iff this type represents a class that has a unboxed form.
67       *
68       * For example, for {@link String} this is false, but for {@link Integer}
69       * this is true.
70       */
71      boolean isBoxedType();
72  
73      /**
74       * Human readable name of this type.
75       */
76      String fullName();
77  }