org.freehep.rtti
Class RTTI

java.lang.Object
  extended by org.freehep.rtti.RTTI

public class RTTI
extends Object

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

Version:
$Id: RTTI.java 8584 2006-08-10 23:06:37Z duns $
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 its package.
 IClass createClass(String name, boolean isClass, String packageName, Vector packageComments, Vector comments, Vector eocComments, Vector templateParameters, Vector interfaces, Vector constructors, IDestructor destructor, Vector methods, Vector fields)
          Creates a class and registers it under its package.
 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.
 IMethod createMethod(String name, Vector comments, boolean isStatic, Vector templateParameters, IType returnType, boolean isConst, Vector parameterTypes, Vector exceptionTypes)
          Creates a method.
 INamedType createNamedType(String name, IType type, String init)
          Creates a named type.
 IPackage createPackage(String packageName)
           
 IType createType(String name, boolean konst, boolean primitive, boolean enumeration, 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
static String[] getComments(Vector comments, String language)
          returns language specific and general comments
 IPackage getPackage(String packageName)
          Returns the Package with fully qualified name.
 IPackage[] getPackages()
          Returns the list of packages.
 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

getPackages

public IPackage[] getPackages()
Returns the list of packages.

Returns:
array of packages

getPackage

public IPackage getPackage(String packageName)
Returns the Package with fully qualified name.

Parameters:
packageName - fully qualified name
Returns:
package definition

createPackage

public IPackage createPackage(String packageName)

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 its package.

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)
destructor - destructors (IDestructor)
methods - list of methods (IMethod)
Returns:
class definition

createClass

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

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)
destructor - destructors (IDestructor)
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

createMethod

public IMethod createMethod(String name,
                            Vector comments,
                            boolean isStatic,
                            Vector templateParameters,
                            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 enumeration,
                        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
enumeration - true if this is an enumeration
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


Copyright © 2000-2007 FreeHEP. All Rights Reserved.