saffron.rel
Interface TypeFactory

All Known Subinterfaces:
OJTypeFactory
All Known Implementing Classes:
OJTypeFactoryImpl, TypeFactoryImpl

public interface TypeFactory

Creates types.

Any implementation of TypeFactory must ensure that types are canonical: two types are equal if and only if they are the same object.

Since:
May 29, 2003
Version:
$Id: //open/saffron/src/main/saffron/rel/TypeFactory.java#3 $
Author:
jhyde

Nested Class Summary
static interface TypeFactory.FieldInfo
          Callback which provides enough information to create fields.
 
Method Summary
 Type createJavaType(Class clazz)
          Creates a type which encapsulates a Java class.
 Type createJoinType(Type[] types)
          Creates a cartesian product type.
 Type createProjectType(Type[] types, String[] fieldNames)
          Creates a type which represents a projection of a set of fields.
 Type createProjectType(TypeFactory.FieldInfo fieldInfo)
          Creates a type which represents a projection of a set fields, getting the field informatation from a callback.
 Type leastRestrictive(Type[] types)
          Returns the most general of a set of types (that is, one type to which they can all be cast), or null if conversion is not possible.
 

Method Detail

createProjectType

public Type createProjectType(Type[] types,
                              String[] fieldNames)
Creates a type which represents a projection of a set of fields.

The return is canonical: if an equivalent type already exists, it is returned.

Parameters:
types - Types of the fields
fieldNames - Names of the fields
Returns:
a type
Pre-condition:
types.length == fieldNames.length
Post-condition:
return != null

createProjectType

public Type createProjectType(TypeFactory.FieldInfo fieldInfo)
Creates a type which represents a projection of a set fields, getting the field informatation from a callback.


createJoinType

public Type createJoinType(Type[] types)
Creates a cartesian product type.

Pre-condition:
types != null, types.length >= 1

leastRestrictive

public Type leastRestrictive(Type[] types)
Returns the most general of a set of types (that is, one type to which they can all be cast), or null if conversion is not possible.

Pre-condition:
types != null, types.length >= 1

createJavaType

public Type createJavaType(Class clazz)
Creates a type which encapsulates a Java class.


SourceForge.net_Logo