FreeHEP API
Version v1.2.2

org.freehep.jaco.rtti
Class RTTI

java.lang.Object
  |
  +--org.freehep.jaco.rtti.RTTI

public class RTTI
extends Object

Factory class to build the RTTI (RunTime Type Identification) needed for JACO.

Classes are registered under their fully qualified name (without the packagePrefix, but with the already defined package name).

Version:
$Id: RTTI.java,v 1.21 2002/10/07 18:16:11 duns Exp $
Author:
Mark Donszelmann

Constructor Summary
RTTI()
          Creates an empty RTTI
 
Method Summary
 IClass createClass(String name, boolean isClass, String packageName, Vector packageComments, Vector comments, Vector eocComments, Vector interfaces, Vector constructors, IDestructor destructor, Vector methods, Vector fields)
          Creates a class and registers it under "packageName.name".
 IConstructor createConstructor(String name, Vector comments, Vector parameterTypes, Vector exceptionTypes)
          Creates a constructor.
 IDestructor createDestructor(String name, Vector comments, Vector exceptionTypes)
          Creates a destructor.
 IField createField(INamedType namedType, Vector comments)
          Creates a named field.
 IMethod createMethod(String name, Vector comments, boolean isStatic, IType returnType, boolean isConst, Vector parameterTypes, Vector exceptionTypes)
          Creates a method.
 INamedType createNamedType(String name, IType type, String init)
          Creates a named type.
 IType createType(String name, boolean konst, boolean primitive, boolean reference, int pointer, int dimension, Vector types)
          Creates a type (primitive or Class)
 IType createType(String name, IType alias, boolean reference, int pointer, int dimension)
          Creates an aliased type
 IClass getClass(String fullname)
          Returns the class with fully qualified name.
 IClass getClass(String packageName, String name)
          Returns the class for a fully qualified name: "packageName.name"
 String[] getClassNames()
          Returns the list of fully qualified class names, which can be used for lookups.
static String[] getComments(Vector comments, String language)
          returns language specific and general comments
 String toString()
          String representation of the RTTI, which lists the full RTTI in semi-java format, without package prefix.
 String toString(String packagePrefix)
          String representation of the RTTI, which lists the full RTTI in semi-java format, with package prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RTTI

public RTTI()
Creates an empty RTTI

Method Detail

getClassNames

public String[] getClassNames()
Returns the list of fully qualified class names, which can be used for lookups.

Returns:
array of fully qualified class names

getClass

public IClass getClass(String packageName,
                       String name)
Returns the class for a fully qualified name: "packageName.name"

Parameters:
packageName - name of the package
name - name of the class
Returns:
class definition

getClass

public IClass getClass(String fullname)
Returns the class with fully qualified name.

Parameters:
fullname - fully qualified name
Returns:
class definition

createClass

public IClass createClass(String name,
                          boolean isClass,
                          String packageName,
                          Vector packageComments,
                          Vector comments,
                          Vector eocComments,
                          Vector interfaces,
                          Vector constructors,
                          IDestructor destructor,
                          Vector methods,
                          Vector fields)
Creates a class and registers it under "packageName.name".

A warning is issued if a class definition already exists under this name. The class definition is overridden.

Parameters:
name - name of the class
packageName - package name
comments - list of comments (String)
interfaces - list of interface names (String: fully qualified)
constructors - list of constructors (IConstructor)
methods - list of methods (IMethod)
Returns:
class definition

createConstructor

public IConstructor createConstructor(String name,
                                      Vector comments,
                                      Vector parameterTypes,
                                      Vector exceptionTypes)
Creates a constructor.

Parameters:
name - name of the constructor
comments - list of comments (String)
parameterTypes - list of parameter types (InamedType)
exceptionTypes - list of exception names (String)
Returns:
constructor definition

createDestructor

public IDestructor createDestructor(String name,
                                    Vector comments,
                                    Vector exceptionTypes)
Creates a destructor.

Parameters:
name - name of the destructor
comments - list of comments (String)
exceptionTypes - list of exception names (String)
Returns:
destructor definition

createMethod

public IMethod createMethod(String name,
                            Vector comments,
                            boolean isStatic,
                            IType returnType,
                            boolean isConst,
                            Vector parameterTypes,
                            Vector exceptionTypes)
Creates a method.

Parameters:
name - name of the method
comments - list of comments (String)
isStatic - true if method is static
returnType - type of return parameter (IType)
parameterTypes - list of parameter types (INamedType)
exceptionTypes - list of exception names (String)
Returns:
method definition

createField

public IField createField(INamedType namedType,
                          Vector comments)
Creates a named field.

Parameters:
namedType - named type (INamedType)
Returns:
field definition

createNamedType

public INamedType createNamedType(String name,
                                  IType type,
                                  String init)
Creates a named type.

Parameters:
name - name of the parameter (String)
type - type of the parameter (IType)
init - init of the parameter (String)
Returns:
named type definition

createType

public IType createType(String name,
                        boolean konst,
                        boolean primitive,
                        boolean reference,
                        int pointer,
                        int dimension,
                        Vector types)
Creates a type (primitive or Class)

Parameters:
name - name of the type
primitive - true if this type is a primitive
reference - true if this type is a reference
pointer - number of pointer postfixes (*)
dimension - dimension of the type, 0 for no dimension.
Returns:
type definition

createType

public IType createType(String name,
                        IType alias,
                        boolean reference,
                        int pointer,
                        int dimension)
Creates an aliased type

Parameters:
name - name of the type
alias - pointing to aliased type (typedef)
reference - true if this type is a reference
pointer - number of pointer postfixes (*)
dimension - dimension of the type, 0 for no dimension.
Returns:
type definition

toString

public String toString()
String representation of the RTTI, which lists the full RTTI in semi-java format, without package prefix.

Overrides:
toString in class Object
Returns:
String representation of the RTTI.

toString

public String toString(String packagePrefix)
String representation of the RTTI, which lists the full RTTI in semi-java format, with package prefix.

Parameters:
packagePrefix - name to prefix to the package name
Returns:
String representation of the RTTI.

getComments

public static String[] getComments(Vector comments,
                                   String language)
returns language specific and general comments

Parameters:
comments - list of all comments, each may be preceded by @xxx: to specify language xxx
language - to be used to filter comments
Returns:
array of comments

FreeHEP API
Version v1.2.2

Copyright © 2000-2003 FreeHEP, All Rights Reserved.