C# Class Fanx.Util.FanUtil

Utilites for dealing with type names in .NET.
ファイルを表示 Open project: xored/f4 Class Usage Examples

Public Methods

Method Description
box ( object obj ) : object

If the given object is a .NET primitive, make it as a Fantom type, otherwise return obj.

getPodName ( string qname ) : string

If the qualifed type name is a Fantom type, then return the pod name the type should belong to, which should also be the assembly name. If the type name does not appear to be a Fantom type, return null.

isDotnetImmutable ( Type dotnetType ) : bool

Return if the specified .NET type represents an immutable type.

isDotnetRepresentation ( Fan t ) : bool

Return if the Fantom Type is represented as a .NET class such as sys::Int as Fan.Sys.Long.

splitQName ( string qname ) : string[]

Split a qualifed type name into two strings, where s[0] is the namespace, and s[1] is the simple type name. If qname represents a nested class, then s[0] will be the qualified type name of the parent, and s[1] will simply be the nested class name. If qname represnets a generic class, then s[0] will be the qualified type name of the class, and s[1] will be the generic param.

toDotnetImplTypeName ( string ntype ) : string

Given a .NET type signature, return the implementation class signature for methods and fields:

toDotnetImplTypeName ( string podName, string typeName ) : string

Given a Fantom qname, get the .NET implementation class name:

toDotnetMethodName ( string fanName ) : string

Return the .NET method name for this Fantom method name.

toDotnetStackType ( Fan t ) : int

Given a Fantom type, get its stack type: 'A', 'I', 'J', etc

toDotnetTypeName ( Fan type ) : string

Return the .NET type name for this Fantom type.

toDotnetTypeName ( string podName, string typeName, bool nullable ) : string

Return the .NET type name for this Fantom pod and type.

toFanMethodName ( string dotnetName ) : string

Return the Fantom method name for this .NET method name.

toFanType ( Type dotnetType, bool check ) : Fan.Sys.Type

Convert .NET type to Fantom type.

upper ( string str ) : string

Return a new string, where the first letter is uppercase. If the string is a fully qualified type name, make each character following a '.' uppercase as well.

upper ( string str, bool recurse ) : string

Private Methods

Method Description
FanUtil ( ) : System

Method Details

box() public static method

If the given object is a .NET primitive, make it as a Fantom type, otherwise return obj.
public static box ( object obj ) : object
obj object
return object

getPodName() public static method

If the qualifed type name is a Fantom type, then return the pod name the type should belong to, which should also be the assembly name. If the type name does not appear to be a Fantom type, return null.
public static getPodName ( string qname ) : string
qname string
return string

isDotnetImmutable() public static method

Return if the specified .NET type represents an immutable type.
public static isDotnetImmutable ( Type dotnetType ) : bool
dotnetType System.Type
return bool

isDotnetRepresentation() public static method

Return if the Fantom Type is represented as a .NET class such as sys::Int as Fan.Sys.Long.
public static isDotnetRepresentation ( Fan t ) : bool
t Fan
return bool

splitQName() public static method

Split a qualifed type name into two strings, where s[0] is the namespace, and s[1] is the simple type name. If qname represents a nested class, then s[0] will be the qualified type name of the parent, and s[1] will simply be the nested class name. If qname represnets a generic class, then s[0] will be the qualified type name of the class, and s[1] will be the generic param.
public static splitQName ( string qname ) : string[]
qname string
return string[]

toDotnetImplTypeName() public static method

Given a .NET type signature, return the implementation class signature for methods and fields:
public static toDotnetImplTypeName ( string ntype ) : string
ntype string
return string

toDotnetImplTypeName() public static method

Given a Fantom qname, get the .NET implementation class name:
public static toDotnetImplTypeName ( string podName, string typeName ) : string
podName string
typeName string
return string

toDotnetMethodName() public static method

Return the .NET method name for this Fantom method name.
public static toDotnetMethodName ( string fanName ) : string
fanName string
return string

toDotnetStackType() public static method

Given a Fantom type, get its stack type: 'A', 'I', 'J', etc
public static toDotnetStackType ( Fan t ) : int
t Fan
return int

toDotnetTypeName() public static method

Return the .NET type name for this Fantom type.
public static toDotnetTypeName ( Fan type ) : string
type Fan
return string

toDotnetTypeName() public static method

Return the .NET type name for this Fantom pod and type.
public static toDotnetTypeName ( string podName, string typeName, bool nullable ) : string
podName string
typeName string
nullable bool
return string

toFanMethodName() public static method

Return the Fantom method name for this .NET method name.
public static toFanMethodName ( string dotnetName ) : string
dotnetName string
return string

toFanType() public static method

Convert .NET type to Fantom type.
public static toFanType ( Type dotnetType, bool check ) : Fan.Sys.Type
dotnetType System.Type
check bool
return Fan.Sys.Type

upper() public static method

Return a new string, where the first letter is uppercase. If the string is a fully qualified type name, make each character following a '.' uppercase as well.
public static upper ( string str ) : string
str string
return string

upper() public static method

public static upper ( string str, bool recurse ) : string
str string
recurse bool
return string