0N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0N/ACopyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 0N/ADO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/AThis code is free software; you can redistribute it and/or modify it 0N/Aunder the terms of the GNU General Public License version 2 only, as 0N/Apublished by the Free Software Foundation. Oracle designates this 0N/Aparticular file as subject to the "Classpath" exception as provided 0N/Aby Oracle in the LICENSE file that accompanied this code. 0N/AThis code is distributed in the hope that it will be useful, but WITHOUT 0N/AANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/AFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/Aversion 2 for more details (a copy is included in the LICENSE file that 0N/Aaccompanied this code). 0N/AYou should have received a copy of the GNU General Public License version 0N/A2 along with this work; if not, write to the Free Software Foundation, 0N/AInc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/APlease contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A<
body bgcolor="white">
0N/AThe Mirror API is used to model the semantic structure of a program.
0N/AIt provides representations of the entities
0N/Adeclared in a program, such as classes, methods, and fields.
0N/AConstructs below the method level, such as
0N/Aindividual statements and expressions, are not represented.
0N/A<
p> Also included is support for writing
0N/Ato examine and process the annotations
0N/Aof program elements. An annotation processor may, as an example, create
0N/Anew source files and XML documents to be used in conjunction with the
0N/A<
h4> Characteristics of the API </
h4>
0N/AA program is represented at the language level, rather than at the
0N/Alevel of the virtual machine. Nested classes, for example, are
0N/Ahandled as first-class constructs,
0N/Arather than in the translated form understood by the VM.
0N/ABoth source code and compiled code (class files) may be modeled
0N/A<
p> Programs are modeled in their static, or build-time, form.
0N/Awhich provides run-time information about classes and objects.
0N/A<
p> The API does not provide direct support for generating new code.
0N/A<
h4> Declarations and Types </
h4>
0N/AThe mirror API represents program constructs principally through the
0N/Aand its hierarchy of subinterfaces in the package {@link
0N/Aprogram element such as a package, class, or method.
0N/AThe interface hierarchy is depicted
0N/Ainterface and its hierarchy of subinterfaces in the
0N/Aclass and interface types, array types, type variables, and wildcards.
0N/AThe interface hierarchy is depicted
0N/A<
p> The API makes a clear distinction between declarations and types.
0N/AThis is most significant for generic types, where a single declaration
73N/Acan define an infinite family of types. For example, the declaration of
0N/Aand much more. Only the declaration can be annotated, for example,
0N/Aand only a type can appear in a method signature.
0N/A<
p> A program being modeled may be incomplete, in that
0N/Ait may depend on an unknown class or interface type.
0N/AThis may be the result of a processing error such as a missing class file,
0N/Aor perhaps the missing type is to be created by an annotation processor.
0N/Ahow such unknown types are handled.
0N/A<
h4> Utilities and Tool Support </
h4>
0N/Autilities to assist in the processing of declarations and types.
0N/AIncluded is support for using the visitor design pattern when
0N/Aoperating on declaration and type objects.
0N/Aof annotation processors. It provides the mechanism for them to
0N/Ainteract with an annotation processing tool.