C# Class Fan.Sys.Type

Type models a static type definition for an Obj class. A Type lifecycle: 1) Hollow: in this state we know basic identity of the type, and it's inheritance hierarchy. A type is setup to be hollow during Pod.load(). 2) Reflected: in this state we read all the slot definitions from the fcode to populate the slot tables used to for reflection. At this point clients can discover the signatures of the Type. 3) Emitted: the final state of loading a Type is to emit to a Java class called "fan.{pod}.{type}". Once emitted we can instantiate the type or call it's methods. 4) Finished: once we have reflected the slots into memory and emitted the Java class, the last stage is to bind the all the java.lang.reflect representations to the Slots for dynamic dispatch. We delay this until needed by Method or Field for a reflection invocation Type models sys::Type. Implementation classes are: - ClassType - GenericType (ListType, MapType, FuncType) - NullableType
Inheritance: FanObj, Literal
Show file Open project: xored/f4 Class Usage Examples

Public Methods

Method Description
@base ( ) : Type
@is ( Type type ) : bool
@params ( ) : Map
@typeof ( ) : Type
common ( object objs, int n ) : Type

Given a list of objects, compute the most specific type which they all share,or at worst return sys::Obj. This method does not take into account interfaces, only extends class inheritance.

doc ( ) : string
dotnetRepr ( ) : bool
emptyList ( ) : List
encode ( ObjEncoder @out ) : void
facet ( Type t ) : Facet
facet ( Type t, bool c ) : Facet
facets ( ) : List
field ( string name ) : Field
field ( string name, bool check ) : Field
fields ( ) : List
find ( string sig ) : Type
find ( string sig, bool check ) : Type
finish ( ) : void
fits ( Type type ) : bool
getRawType ( ) : Type

If this type is a generic parameter (V, L, etc), then return the actual type used in the Java method. For example V is Obj, and L is List. This is the type we actually use when constructing a signature for the invoke opcode.

hasFacet ( Type t ) : bool
inheritance ( ) : List
isAbstract ( ) : bool
isClass ( ) : bool
isConst ( ) : bool
isEnum ( ) : bool
isFacet ( ) : bool
isFinal ( ) : bool
isGeneric ( ) : bool
isGenericInstance ( ) : bool

A generic instance is a type which has "instantiated" a generic type and replaced all the generic parameter types with generic argument types. The type string[] is a generic instance of the generic type List (V is replaced with string). A generic instance always has a signature which different from the qname.

isGenericParameter ( ) : bool

Return if this type is a generic parameter (such as V or K) in a generic type (List, Map, or Method). Generic parameters serve as place holders for the parameterization of the generic type. Fantom has a predefined set of generic parameters which are always defined in the sys pod with a one character name.

isGenericType ( ) : bool

A generic type means that one or more of my slots contain signatures using a generic parameter (such as V or K). Fantom supports three built-in generic types: List, Map, and Method. A generic instance (such as string[]) is NOT a generic type (all of its generic parameters have been filled in). User defined generic types are not supported in Fan.

isInternal ( ) : bool
isMixin ( ) : bool
isNullable ( ) : bool
isPublic ( ) : bool
isSynthetic ( ) : bool
isVal ( ) : bool
make ( ) : object
make ( List args ) : object
method ( string name ) : Method
method ( string name, bool check ) : Method
methods ( ) : List
mixins ( ) : List
name ( ) : string
of ( object obj ) : Type
parameterize ( Map pars ) : Type
pod ( ) : Pod
qname ( ) : string
reflect ( ) : Type
signature ( ) : string
slot ( string name ) : Slot
slot ( string name, bool check ) : Slot
slots ( ) : List
toLocale ( ) : string
toNonNullable ( ) : Type
toNullable ( ) : Type
toStr ( ) : string
trap ( string name, List args ) : object

Private Methods

Method Description
flags ( ) : int
toListOf ( ) : Type

Method Details

@base() public abstract method

public abstract @base ( ) : Type
return Type

@is() public abstract method

public abstract @is ( Type type ) : bool
type Type
return bool

@params() public method

public @params ( ) : Map
return Map

@typeof() public method

public @typeof ( ) : Type
return Type

common() public static method

Given a list of objects, compute the most specific type which they all share,or at worst return sys::Obj. This method does not take into account interfaces, only extends class inheritance.
public static common ( object objs, int n ) : Type
objs object
n int
return Type

doc() public abstract method

public abstract doc ( ) : string
return string

dotnetRepr() public abstract method

public abstract dotnetRepr ( ) : bool
return bool

emptyList() public method

public emptyList ( ) : List
return List

encode() public method

public encode ( ObjEncoder @out ) : void
@out Fanx.Serial.ObjEncoder
return void

facet() public method

public facet ( Type t ) : Facet
t Type
return Facet

facet() public abstract method

public abstract facet ( Type t, bool c ) : Facet
t Type
c bool
return Facet

facets() public abstract method

public abstract facets ( ) : List
return List

field() public method

public field ( string name ) : Field
name string
return Field

field() public method

public field ( string name, bool check ) : Field
name string
check bool
return Field

fields() public abstract method

public abstract fields ( ) : List
return List

find() public static method

public static find ( string sig ) : Type
sig string
return Type

find() public static method

public static find ( string sig, bool check ) : Type
sig string
check bool
return Type

finish() public method

public finish ( ) : void
return void

fits() public method

public fits ( Type type ) : bool
type Type
return bool

getRawType() public method

If this type is a generic parameter (V, L, etc), then return the actual type used in the Java method. For example V is Obj, and L is List. This is the type we actually use when constructing a signature for the invoke opcode.
public getRawType ( ) : Type
return Type

hasFacet() public method

public hasFacet ( Type t ) : bool
t Type
return bool

inheritance() public abstract method

public abstract inheritance ( ) : List
return List

isAbstract() public method

public isAbstract ( ) : bool
return bool

isClass() public method

public isClass ( ) : bool
return bool

isConst() public method

public isConst ( ) : bool
return bool

isEnum() public method

public isEnum ( ) : bool
return bool

isFacet() public method

public isFacet ( ) : bool
return bool

isFinal() public method

public isFinal ( ) : bool
return bool

isGeneric() public method

public isGeneric ( ) : bool
return bool

isGenericInstance() public method

A generic instance is a type which has "instantiated" a generic type and replaced all the generic parameter types with generic argument types. The type string[] is a generic instance of the generic type List (V is replaced with string). A generic instance always has a signature which different from the qname.
public isGenericInstance ( ) : bool
return bool

isGenericParameter() public method

Return if this type is a generic parameter (such as V or K) in a generic type (List, Map, or Method). Generic parameters serve as place holders for the parameterization of the generic type. Fantom has a predefined set of generic parameters which are always defined in the sys pod with a one character name.
public isGenericParameter ( ) : bool
return bool

isGenericType() public method

A generic type means that one or more of my slots contain signatures using a generic parameter (such as V or K). Fantom supports three built-in generic types: List, Map, and Method. A generic instance (such as string[]) is NOT a generic type (all of its generic parameters have been filled in). User defined generic types are not supported in Fan.
public isGenericType ( ) : bool
return bool

isInternal() public method

public isInternal ( ) : bool
return bool

isMixin() public method

public isMixin ( ) : bool
return bool

isNullable() public method

public isNullable ( ) : bool
return bool

isPublic() public method

public isPublic ( ) : bool
return bool

isSynthetic() public method

public isSynthetic ( ) : bool
return bool

isVal() public method

public isVal ( ) : bool
return bool

make() public method

public make ( ) : object
return object

make() public method

public make ( List args ) : object
args List
return object

method() public method

public method ( string name ) : Method
name string
return Method

method() public method

public method ( string name, bool check ) : Method
name string
check bool
return Method

methods() public abstract method

public abstract methods ( ) : List
return List

mixins() public abstract method

public abstract mixins ( ) : List
return List

name() public abstract method

public abstract name ( ) : string
return string

of() public static method

public static of ( object obj ) : Type
obj object
return Type

parameterize() public method

public parameterize ( Map pars ) : Type
pars Map
return Type

pod() public abstract method

public abstract pod ( ) : Pod
return Pod

qname() public abstract method

public abstract qname ( ) : string
return string

reflect() public method

public reflect ( ) : Type
return Type

signature() public abstract method

public abstract signature ( ) : string
return string

slot() public method

public slot ( string name ) : Slot
name string
return Slot

slot() public abstract method

public abstract slot ( string name, bool check ) : Slot
name string
check bool
return Slot

slots() public abstract method

public abstract slots ( ) : List
return List

toLocale() public method

public toLocale ( ) : string
return string

toNonNullable() public method

public toNonNullable ( ) : Type
return Type

toNullable() public abstract method

public abstract toNullable ( ) : Type
return Type

toStr() public method

public toStr ( ) : string
return string

trap() public method

public trap ( string name, List args ) : object
name string
args List
return object