RECODER 0.92

recoder.service
Class DefaultNameInfo

java.lang.Object
  extended by recoder.AbstractService
      extended by recoder.service.DefaultNameInfo
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, Service, NameInfo

public class DefaultNameInfo
extends AbstractService
implements NameInfo, java.beans.PropertyChangeListener


Field Summary
 
Fields inherited from class recoder.AbstractService
serviceConfiguration
 
Constructor Summary
DefaultNameInfo(ServiceConfiguration config)
          Creates a new initialized definition table.
 
Method Summary
 ArrayType createArrayType(Type basetype)
          Deprecated. 
 ArrayType createArrayType(Type basetype, int dimensions)
          Deprecated. 
 Package createPackage(java.lang.String name)
          Returns a package represented by the given fully qualified name.
 ArrayType getArrayType(Type basetype)
          Deprecated. 
 PrimitiveType getBooleanType()
          Returns the predefined boolean type.
 PrimitiveType getByteType()
          Returns the predefined byte type.
 PrimitiveType getCharType()
          Returns the predefined char type.
 ClassType getClassType(java.lang.String name)
          Returns the class type represented by the given fully qualified name.
 java.util.List<ClassType> getClassTypes()
          Returns the list of globally known class types.
 java.util.List<ClassType> getClassTypes(java.lang.String pattern)
           
 PrimitiveType getDoubleType()
          Returns the predefined double type.
 Field getField(java.lang.String name)
          Returns a field belonging to the given fully qualified name.
 java.util.List<Field> getFields()
          Returns the list of globally known fields.
 PrimitiveType getFloatType()
          Returns the predefined float type.
 PrimitiveType getIntType()
          Returns the predefined int type.
 ClassType getJavaIoSerializable()
          Returns the predefined Serializable type.
 ClassType getJavaLangAnnotationAnnotation()
          Returns the predefined interface java.lang.annotation.Annotation.
 ClassType getJavaLangBoolean()
          Returns the predefined Boolean type.
 ClassType getJavaLangByte()
          Returns the predefined Byte type.
 ClassType getJavaLangCharacter()
          Returns the predefined Character type.
 ClassType getJavaLangClass()
          Returns the predefined Class type.
 ClassType getJavaLangCloneable()
          Returns the predefined Cloneable type.
 ClassType getJavaLangDouble()
          Returns the predefined Double type.
 ClassType getJavaLangEnum()
          Returns the predefined class java.lang.Enum.
 ClassType getJavaLangFloat()
          Returns the predefined Float type.
 ClassType getJavaLangInteger()
          Returns the predefined Integer type.
 ClassType getJavaLangIterable()
          Returns the predefined class java.lang.Iterable.
 ClassType getJavaLangLong()
          Returns the predefined Long type.
 ClassType getJavaLangObject()
          Returns the predefined Object type.
 ClassType getJavaLangRunnable()
           
 ClassType getJavaLangShort()
          Returns the predefined Short type.
 ClassType getJavaLangString()
          Returns the predefined String type.
 PrimitiveType getLongType()
          Returns the predefined long type.
 java.util.List<Method> getMethods(java.lang.String pattern)
           
 ClassType getNullType()
          Returns the predefined Null type.
 Package getPackage(java.lang.String name)
          Returns the package represented by the given fully qualified name, if it already exists.
 java.util.List<Package> getPackages()
          Returns the list of globally known packages.
 PrimitiveType getShortType()
          Returns the predefined short type.
 Type getType(java.lang.String name)
          Returns the type represented by the given fully qualified name.
 java.util.List<Type> getTypes()
          Returns the list of globally known types.
 java.util.List<ClassType> getTypes(Package pkg)
          Returns the list of known class types of the given package.
 AnnotationProperty getUnknownAnnotationProperty()
          Returns the placeholder for an unknown annotation property.
 ClassType getUnknownClassType()
          Returns the placeholder for an unknown class type.
 Constructor getUnknownConstructor()
          Returns the placeholder for an unknown constructor.
 ProgramModelElement getUnknownElement()
          Returns the placeholder for an unknown entity that might be a package, class type, or field.
 Field getUnknownField()
          Returns the placeholder for an unknown field.
 Method getUnknownMethod()
          Returns the placeholder for an unknown method.
 Package getUnknownPackage()
          Returns the placeholder for an unknown package.
 Type getUnknownType()
          Returns the placeholder for an unknown type.
 Variable getUnknownVariable()
          Returns the placeholder for an unknown variable.
 java.lang.String information()
           
 void initialize(ServiceConfiguration cfg)
          Called by the service configuration indicating that all services are known.
 boolean isPackage(java.lang.String name)
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void register(ClassType ct)
          Registers a class type.
 void register(Field f)
          Registers a field.
 void unregisterClassType(java.lang.String fullname)
          Unregisters a class type.
 void unregisterField(java.lang.String fullname)
          Unregisters a field.
 void unregisterPackages()
           
 
Methods inherited from class recoder.AbstractService
getServiceConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface recoder.Service
getServiceConfiguration
 

Constructor Detail

DefaultNameInfo

public DefaultNameInfo(ServiceConfiguration config)
Creates a new initialized definition table.

Parameters:
config - the configuration this services becomes part of.
Method Detail

initialize

public void initialize(ServiceConfiguration cfg)
Description copied from class: AbstractService
Called by the service configuration indicating that all services are known. Services may now start communicating or linking among their configuration partners. The service configuration can be memorized if it has not been passed in by a constructor already. The default implementation does nothing.

Specified by:
initialize in interface Service
Overrides:
initialize in class AbstractService
Parameters:
cfg - the service configuration this services has been assigned to.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

register

public void register(ClassType ct)
Description copied from interface: NameInfo
Registers a class type.

Specified by:
register in interface NameInfo
Parameters:
ct - the class type to be recognized by this service.

register

public void register(Field f)
Description copied from interface: NameInfo
Registers a field.

Specified by:
register in interface NameInfo
Parameters:
f - the field to be recognized by this service.

getJavaLangObject

public ClassType getJavaLangObject()
Description copied from interface: NameInfo
Returns the predefined Object type.

Specified by:
getJavaLangObject in interface NameInfo
Returns:
the Object type.

getJavaLangString

public ClassType getJavaLangString()
Description copied from interface: NameInfo
Returns the predefined String type.

Specified by:
getJavaLangString in interface NameInfo
Returns:
the String type.

getJavaLangBoolean

public ClassType getJavaLangBoolean()
Description copied from interface: NameInfo
Returns the predefined Boolean type.

Specified by:
getJavaLangBoolean in interface NameInfo
Returns:
the Boolean type.

getJavaLangByte

public ClassType getJavaLangByte()
Description copied from interface: NameInfo
Returns the predefined Byte type.

Specified by:
getJavaLangByte in interface NameInfo
Returns:
the Byte type.

getJavaLangCharacter

public ClassType getJavaLangCharacter()
Description copied from interface: NameInfo
Returns the predefined Character type.

Specified by:
getJavaLangCharacter in interface NameInfo
Returns:
the Character type.

getJavaLangShort

public ClassType getJavaLangShort()
Description copied from interface: NameInfo
Returns the predefined Short type.

Specified by:
getJavaLangShort in interface NameInfo
Returns:
the Short type.

getJavaLangInteger

public ClassType getJavaLangInteger()
Description copied from interface: NameInfo
Returns the predefined Integer type.

Specified by:
getJavaLangInteger in interface NameInfo
Returns:
the Integer type.

getJavaLangLong

public ClassType getJavaLangLong()
Description copied from interface: NameInfo
Returns the predefined Long type.

Specified by:
getJavaLangLong in interface NameInfo
Returns:
the Long type.

getJavaLangFloat

public ClassType getJavaLangFloat()
Description copied from interface: NameInfo
Returns the predefined Float type.

Specified by:
getJavaLangFloat in interface NameInfo
Returns:
the Float type.

getJavaLangDouble

public ClassType getJavaLangDouble()
Description copied from interface: NameInfo
Returns the predefined Double type.

Specified by:
getJavaLangDouble in interface NameInfo
Returns:
the Double type.

getJavaLangClass

public ClassType getJavaLangClass()
Description copied from interface: NameInfo
Returns the predefined Class type. The Class type appears as the type of ".class" references.

Specified by:
getJavaLangClass in interface NameInfo
Returns:
the Class type.

getJavaLangCloneable

public ClassType getJavaLangCloneable()
Description copied from interface: NameInfo
Returns the predefined Cloneable type. The Cloneable type is a valid supertype of arrays.

Specified by:
getJavaLangCloneable in interface NameInfo
Returns:
the Cloneable type.

getJavaLangRunnable

public ClassType getJavaLangRunnable()

getJavaIoSerializable

public ClassType getJavaIoSerializable()
Description copied from interface: NameInfo
Returns the predefined Serializable type. The Serializable type is a valid supertype of arrays.

Specified by:
getJavaIoSerializable in interface NameInfo
Returns:
the Serializable type.

getJavaLangAnnotationAnnotation

public ClassType getJavaLangAnnotationAnnotation()
Description copied from interface: NameInfo
Returns the predefined interface java.lang.annotation.Annotation.

Specified by:
getJavaLangAnnotationAnnotation in interface NameInfo
Returns:
the Annotation type

getJavaLangEnum

public ClassType getJavaLangEnum()
Description copied from interface: NameInfo
Returns the predefined class java.lang.Enum.

Specified by:
getJavaLangEnum in interface NameInfo
Returns:
the Annotation type

getJavaLangIterable

public ClassType getJavaLangIterable()
Description copied from interface: NameInfo
Returns the predefined class java.lang.Iterable.

Specified by:
getJavaLangIterable in interface NameInfo
Returns:
the Iterable type

getNullType

public ClassType getNullType()
Description copied from interface: NameInfo
Returns the predefined Null type. The Null type is widening to each class or array type.

Specified by:
getNullType in interface NameInfo
Returns:
the Null type.

getShortType

public PrimitiveType getShortType()
Description copied from interface: NameInfo
Returns the predefined short type.

Specified by:
getShortType in interface NameInfo
Returns:
the primitive short type.

getByteType

public PrimitiveType getByteType()
Description copied from interface: NameInfo
Returns the predefined byte type.

Specified by:
getByteType in interface NameInfo
Returns:
the primitive byte type.

getBooleanType

public PrimitiveType getBooleanType()
Description copied from interface: NameInfo
Returns the predefined boolean type.

Specified by:
getBooleanType in interface NameInfo
Returns:
the primitive boolean type.

getIntType

public PrimitiveType getIntType()
Description copied from interface: NameInfo
Returns the predefined int type.

Specified by:
getIntType in interface NameInfo
Returns:
the primitive int type.

getLongType

public PrimitiveType getLongType()
Description copied from interface: NameInfo
Returns the predefined long type.

Specified by:
getLongType in interface NameInfo
Returns:
the primitive long type.

getFloatType

public PrimitiveType getFloatType()
Description copied from interface: NameInfo
Returns the predefined float type.

Specified by:
getFloatType in interface NameInfo
Returns:
the primitive float type.

getDoubleType

public PrimitiveType getDoubleType()
Description copied from interface: NameInfo
Returns the predefined double type.

Specified by:
getDoubleType in interface NameInfo
Returns:
the primitive double type.

getCharType

public PrimitiveType getCharType()
Description copied from interface: NameInfo
Returns the predefined char type.

Specified by:
getCharType in interface NameInfo
Returns:
the primitive char type.

isPackage

public boolean isPackage(java.lang.String name)

createPackage

public Package createPackage(java.lang.String name)
Description copied from interface: NameInfo
Returns a package represented by the given fully qualified name. If the package has not been encountered before, a new package is created and returned.

Specified by:
createPackage in interface NameInfo
Parameters:
name - a qualified name.
Returns:
the according package, constructed on demand.

getPackage

public Package getPackage(java.lang.String name)
Description copied from interface: NameInfo
Returns the package represented by the given fully qualified name, if it already exists.

Specified by:
getPackage in interface NameInfo
Parameters:
name - a qualified name.
Returns:
the according package, or null.

getPackages

public java.util.List<Package> getPackages()
Description copied from interface: NameInfo
Returns the list of globally known packages.

Specified by:
getPackages in interface NameInfo
Returns:
the list of packages.

getClassType

public ClassType getClassType(java.lang.String name)
Description copied from interface: NameInfo
Returns the class type represented by the given fully qualified name. If the type is currently not available or does not represent a class type, the method returns null.

Specified by:
getClassType in interface NameInfo
Parameters:
name - a fully qualified type name.
Returns:
the according class type, or null.

createArrayType

@Deprecated
public ArrayType createArrayType(Type basetype)
Deprecated. 

Description copied from interface: NameInfo
Returns the array type for the given base type. This method will create one if needed. Same as createArrayType(basetype, 1)

Specified by:
createArrayType in interface NameInfo
Parameters:
basetype - the base type to find an array type for.
Returns:
the array type for the given base type.

createArrayType

@Deprecated
public ArrayType createArrayType(Type basetype,
                                            int dimensions)
Deprecated. 

Description copied from interface: NameInfo
Returns the array type for the given base type with the given dimensions. This method will create one if needed.

Specified by:
createArrayType in interface NameInfo
Parameters:
basetype - the base type to find an array type for.
Returns:
the array type for the given base type.

getArrayType

@Deprecated
public ArrayType getArrayType(Type basetype)
Deprecated. 

Description copied from interface: NameInfo
Returns the array type for the given base type, if it already exists.

Specified by:
getArrayType in interface NameInfo
Parameters:
basetype - the base type to find an array type for.
Returns:
the array type for the given base type, or null.

getType

public Type getType(java.lang.String name)
Description copied from interface: NameInfo
Returns the type represented by the given fully qualified name. If the type is currently not available, the method returns null. A type may be unavailable either if it currently has not been analyzed or is undefined. The specific behavior depends on the compiler configuration.

As of 0.90, this method can be used to obtain ParameterizedTypes. These types are not registered internally to be returned by getTypes(). null is returned even if just one of the TypeArguments cannot be resolved.

Further, as of 0.90, types from java.lang. are automatically found. I.e., it is now possible to just call getType("String"> to get java.lang.String.

Specified by:
getType in interface NameInfo
Parameters:
name - a fully qualified type name, possibly with type arguments.
Returns:
the according type, or null.

getTypes

public java.util.List<Type> getTypes()
Description copied from interface: NameInfo
Returns the list of globally known types.

Specified by:
getTypes in interface NameInfo
Returns:
the list of types.

getTypes

public java.util.List<ClassType> getTypes(Package pkg)
Description copied from interface: NameInfo
Returns the list of known class types of the given package.

Specified by:
getTypes in interface NameInfo
Parameters:
pkg - a package.
Returns:
the list of class types in the package.

getClassTypes

public java.util.List<ClassType> getClassTypes()
Description copied from interface: NameInfo
Returns the list of globally known class types.

Specified by:
getClassTypes in interface NameInfo
Returns:
the list of class types.

getField

public Field getField(java.lang.String name)
Description copied from interface: NameInfo
Returns a field belonging to the given fully qualified name.

Specified by:
getField in interface NameInfo
Returns:
the field with that name, or null if no such field is known.

getFields

public java.util.List<Field> getFields()
Description copied from interface: NameInfo
Returns the list of globally known fields.

Specified by:
getFields in interface NameInfo
Returns:
the list of fields.

information

public java.lang.String information()

unregisterClassType

public void unregisterClassType(java.lang.String fullname)
Description copied from interface: NameInfo
Unregisters a class type.

Specified by:
unregisterClassType in interface NameInfo
Parameters:
fullname - the (former) class type name.

unregisterField

public void unregisterField(java.lang.String fullname)
Description copied from interface: NameInfo
Unregisters a field.

Specified by:
unregisterField in interface NameInfo
Parameters:
fullname - the (former) field name.

unregisterPackages

public void unregisterPackages()

getUnknownClassType

public ClassType getUnknownClassType()
Description copied from interface: NameInfo
Returns the placeholder for an unknown class type. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownClassType in interface NameInfo

getUnknownElement

public ProgramModelElement getUnknownElement()
Description copied from interface: NameInfo
Returns the placeholder for an unknown entity that might be a package, class type, or field. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownElement in interface NameInfo

getUnknownPackage

public Package getUnknownPackage()
Description copied from interface: NameInfo
Returns the placeholder for an unknown package. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownPackage in interface NameInfo

getUnknownMethod

public Method getUnknownMethod()
Description copied from interface: NameInfo
Returns the placeholder for an unknown method. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownMethod in interface NameInfo

getUnknownConstructor

public Constructor getUnknownConstructor()
Description copied from interface: NameInfo
Returns the placeholder for an unknown constructor. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownConstructor in interface NameInfo

getUnknownVariable

public Variable getUnknownVariable()
Description copied from interface: NameInfo
Returns the placeholder for an unknown variable. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownVariable in interface NameInfo

getUnknownField

public Field getUnknownField()
Description copied from interface: NameInfo
Returns the placeholder for an unknown field. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownField in interface NameInfo

getUnknownType

public Type getUnknownType()
Description copied from interface: NameInfo
Returns the placeholder for an unknown type. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownType in interface NameInfo

getUnknownAnnotationProperty

public AnnotationProperty getUnknownAnnotationProperty()
Description copied from interface: NameInfo
Returns the placeholder for an unknown annotation property. Unknown elements can model incomplete programs. Queries for properties of unknown elements will return only minimum information, even though it often is possible to infer certain information about single unknown elements. As the alias problem is not solvable, there is only one representative for all unknown elements of a certain type.

Specified by:
getUnknownAnnotationProperty in interface NameInfo

getClassTypes

public java.util.List<ClassType> getClassTypes(java.lang.String pattern)
Specified by:
getClassTypes in interface NameInfo
Returns:

getMethods

public java.util.List<Method> getMethods(java.lang.String pattern)
Specified by:
getMethods in interface NameInfo
Returns:

RECODER 0.92