java.nonstandard.RuntimeTraits

Provides runtime traits, which provide much of the functionality of tango.core.Traits and is-expressions, as well as some functionality that is only available at runtime, using runtime type information. *

Members

Functions

asClass
ConstClassInfo asClass(in TypeInfo type)

If the given type represents a class, return its ClassInfo; else return null;

baseClasses
ConstClassInfo[] baseClasses(in ClassInfo type)
baseInterfaces
ConstClassInfo[] baseInterfaces(in ClassInfo type)

Returns a list of all interfaces that this type implements, directly or indirectly. This includes base interfaces of types the class implements, and interfaces that base classes implement, and base interfaces of interfaces that base classes implement. This is an expensive operation.

baseTypes
ConstClassInfo[] baseTypes(in ClassInfo type)
derivedTypes
ConstClassInfo[] derivedTypes(in ClassInfo type)

Returns a list of all types that are derived from the given type. This does not count interfaces; that is, if type is an interface, you will only get derived interfaces back. It is an expensive operations.

directInterfaces
ConstClassInfo[] directInterfaces(in ClassInfo type)

Returns a list of interfaces that this class directly implements.

implements
bool implements(in ClassInfo implementor, in ClassInfo iface)

Returns true iff implementor implements the interface described by iface. This is an expensive operation (linear in the number of interfaces and base classes).

interfaceGraph
ConstClassInfo[] interfaceGraph(in ClassInfo type)

Returns all the interfaces that this type directly implements, including inherited interfaces. This is an expensive operation. *

isArray
bool isArray(in TypeInfo type)

Returns true iff the given type is a dynamic or static array (false for associative arrays and non-arrays).

isAssociativeArray
bool isAssociativeArray(in TypeInfo type)
isBool
bool isBool(in TypeInfo type)
isCharacter
bool isCharacter(in TypeInfo type)
isClass
bool isClass(in TypeInfo type)

Returns true iff the type represents a class (false for interfaces).

isDerived
bool isDerived(in ClassInfo derived, in ClassInfo base)

Returns true iff one type is an ancestor of the other, or if the types are the same. If either is null, returns false.

isDynamicArray
bool isDynamicArray(in TypeInfo type)
isFloat
bool isFloat(in TypeInfo type)
isFunction
bool isFunction(in TypeInfo type)
isImplicitly
bool isImplicitly(in ClassInfo test, in ClassInfo target)

Returns true iff an instance of class test is implicitly castable to target. This is an expensive operation (isDerived + implements).

isImplicitly
bool isImplicitly(in TypeInfo test, in TypeInfo target)

Returns true iff an instance of type test is implicitly castable to target. If the types describe classes or interfaces, this is an expensive operation.

isInteger
bool isInteger(in TypeInfo type)
isInterface
bool isInterface(in TypeInfo type)

Returns true iff the given type represents an interface.

isPointer
bool isPointer(in TypeInfo type)
isPrimitive
bool isPrimitive(in TypeInfo type)
isReferenceType
bool isReferenceType(in TypeInfo type)

Returns true iff the given type is a reference type.

isSignedInteger
bool isSignedInteger(in TypeInfo type)
isStaticArray
bool isStaticArray(in TypeInfo type)
isString
bool isString(in TypeInfo type)
isStruct
bool isStruct(in TypeInfo type)
isUnsignedInteger
bool isUnsignedInteger(in TypeInfo type)
isUserDefined
bool isUserDefined(in TypeInfo type)

Returns true iff the given type represents a user-defined type. This does not include functions, delegates, aliases, or typedefs.

isValueType
bool isValueType(in TypeInfo type)

Returns true for all value types, false for all reference types. For functions and delegates, returns false (is this the way it should be?).

keyType
ConstTypeInfo keyType(in TypeInfo type)

The key type of the given type. For an array, size_t; for an associative array TU, U.

moduleOf
ModuleInfo moduleOf(in ClassInfo type)
realType
ConstTypeInfo realType(in TypeInfo type)

If the given type represents a typedef, return the actual type.

returnType
ConstTypeInfo returnType(in TypeInfo type)

If the given type represents a delegate or function, the return type of that function. Otherwise, null.

valueType
ConstTypeInfo valueType(in TypeInfo type)

The value type of the given type -- given T[] or Tn, T; given TU, T; given T*, T; anything else, null.

Structs

applyInterfaces
struct applyInterfaces

Iterate through all interfaces that type implements, directly or indirectly, including base interfaces.

Meta

Authors

Chris Wright (dhasenan) <dhasenan@gmail.com>

License

tango license, apache 2.0 Copyright (c) 2009, CHRISTOPHER WRIGHT