Config property type: composite class type (supporting simple inheritance).
class
|
ClassType
|
extends
|
ConfigType
|
Class fields (declared ones and inherited ones) are grouped into required, optional and virtual fields. The order of fields in each group is the same as the order in which the fields has been added to the class type during building (see ClassTypeBuilder ):
[0..a[
[a..b[
[b..c[
a
is
the
count
of
required
fields
(see
FieldCountRequired),
b
is
the
count
of
regular
fields
(see
FieldCountRegular),
b-a
is
the
count
of
optional
fields,
b-c
is
the
number
of
virtual
fields
and
c
is
the
field
count
(see
FieldCount).
A
subclass
may
declare
a
required
or
optional
field
using
the
same
name
as
an
inherited
virtual
field;
the
inherited
field
is
then
overridden
and
does
no
longer
count
for
the
virtual
fields
group.
Void type (i.e. no value).
public
static
readonly
field
|
Invalid
|
||
type
|
ClassType
|
Object type.
public
static
readonly
field
|
Obj
|
||
type
|
ClassType
|
Remarks:
This is the implicit super class of all class types.
Can
instances
of
this
config
type
be
null
?
public
override
property
|
CanBeNull
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
instances
of
this
type
can
have
the
value
null ,
false
if
not.
|
||
implements
|
ConfigType.CanBeNull
|
Optional object configurator for this config type.
public
property
|
Configurator
{
get
}
|
||
type
|
IConfiguratorObject
|
||
value
|
The
object
configurator
or
null . |
Returns the documentation of this config type.
public
property
|
Documentation
{
get
}
|
||
type
|
ITypeDocNode
|
||
value
|
The
documentation
or
null
if
not
found. |
||
inherited
|
ConfigType.Documentation
|
Returns the number of fields this class type has (including inherited ones).
public
property
|
FieldCount
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of fields. |
Remarks:
Class fields (declared ones and inherited ones) are grouped into required, optional and virtual fields. The order of fields in each group is the same as the order in which the fields has been added to the class type during building (see ClassTypeBuilder):
[0..a[
[a..b[
[b..c[
a
is
the
count
of
required
fields,
b-a
is
the
count
of
optional
fields,
b-c
is
the
number
of
virtual
fields
and
c
is
the
field
count
(see
FieldCount).
A
subclass
may
declare
a
required
or
optional
field
using
the
same
name
as
an
inherited
virtual
field;
the
inherited
field
is
then
overridden
and
does
no
longer
count
for
the
virtual
fields
group.
The number of regular (required and optional) class fields.
public
property
|
FieldCountRegular
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of required class fields. |
The number of required class fields.
public
property
|
FieldCountRequired
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of required class fields. |
Does this class have virtual fields?
public
property
|
HasVirtual
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
class
has
virtual
fields,
false
if
not. |
Is this an abstract type?
public
override
property
|
IsAbstract
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
an
abstract
type,
false
if
not. |
||
overrides
|
ConfigType.IsAbstract
|
Remarks:
Abstract types cannot be instantiated via New.
Is this an array type?
public
virtual
property
|
IsArray
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
an
array
type,
false
if
not. |
||
inherited
|
ConfigType.IsArray
|
See also:
ArrayTypeIs
this
the
type
boolean
?
public
virtual
property
|
IsBoolean
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
the
type
boolean ,
false
if
not. |
||
inherited
|
ConfigType.IsBoolean
|
See also:
ConfigTypeIs this a class type?
public
override
property
|
IsClass
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
a
class
type,
false
if
not. |
||
overrides
|
ConfigType.IsClass
|
See also:
ClassTypeIs this an enum type?
public
virtual
property
|
IsEnum
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
an
enum
type,
false
if
not. |
||
inherited
|
ConfigType.IsEnum
|
See also:
EnumTypeIs this type invalid?
public
virtual
property
|
IsInvalid
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
type
is
invalid,
false
if
not. |
||
inherited
|
ConfigType.IsInvalid
|
Is this config type lazy?
public
virtual
property
|
IsLazy
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
a
lazy
config
type,
false
if
it
is
a
regular
one.
|
||
inherited
|
ConfigType.IsLazy
|
Remarks:
Lazy config types are created by calling Lazy; they refer to a config type by its fully-qualified name. Lazy config types are not present in the global config type registry (see Get). A lazy type can be converted into a regular type by calling ResolveLazy. This will throw a TinmanException if the referred config type does not exist (yet).
Is
this
the
type
number
?
public
virtual
property
|
IsNumber
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
the
type
number ,
false
if
not. |
||
inherited
|
ConfigType.IsNumber
|
See also:
ConfigTypeIs
this
the
type
path
?
public
virtual
property
|
IsPath
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
the
type
string ,
false
if
not. |
||
inherited
|
ConfigType.IsPath
|
See also:
ConfigTypeIs this a simple type?
public
property
|
IsSimple
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
a
simple
type,
false
if
not. |
||
inherited
|
ConfigType.IsSimple
|
See also:
ConfigType.BoolIs
this
the
type
string
?
public
virtual
property
|
IsString
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
the
type
string ,
false
if
not. |
||
inherited
|
ConfigType.IsString
|
See also:
ConfigTypeIs this a structure type?
public
override
property
|
IsStruct
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
is
a
structure
type,
false
if
not. |
||
overrides
|
ConfigType.IsStruct
|
Remarks:
A struct is a non-abstract class type that has no subclasses and no super class.
Is this type valid?
public
property
|
IsValid
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
type
is
valid,
false
if
not. |
||
inherited
|
ConfigType.IsValid
|
Returns the type members.
[EmptyBody]
|
||||
public
override
property
|
Members
{
get
}
|
|||
type
|
ConfigMember[]
|
|||
value
|
|
The type members. | ||
overrides
|
ConfigType.Members
|
The module that owns this config type.
public
property
|
Module
{
get
}
|
||
type
|
TinmanModule
|
||
value
|
|
The module. | |
inherited
|
ConfigType.Module
|
The human-readable name of this config type.
public
override
property
|
Name
{
get
}
|
||
type
|
string
|
||
value
|
|
The type name. | |
implements
|
ConfigType.Name
|
Returns source code range of this object.
public
property
|
Range
{
get
}
|
||
type
|
RangeI
|
||
value
|
The source code character range or Inv if none. | ||
inherited
|
ConfigNode.Range
|
Returns the number of classes that are derived from this class.
public
property
|
SubClassCount
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of subclasses. |
The super class of this class type.
public
property
|
SuperClass
{
get
}
|
||
type
|
ClassType
|
||
value
|
The
super
class
type
or
null . |
Casts this config type to ArrayType.
public
virtual
method
|
AsArray
()
|
||
type
|
ArrayType
|
||
returns
|
|
The cast type. | |
inherited
|
ConfigType.AsArray
|
See also:
ConfigType.IsArrayCasts this config type to ClassType.
public
virtual
method
|
AsClass
()
|
||
type
|
ClassType
|
||
returns
|
|
The cast type. | |
inherited
|
ConfigType.AsClass
|
See also:
ConfigType.IsClassCasts this config type to EnumType.
public
virtual
method
|
AsEnum
()
|
||
type
|
EnumType
|
||
returns
|
|
The cast type. | |
inherited
|
ConfigType.AsEnum
|
See also:
ConfigType.IsEnumReturns a builder for creating a new class type.
public
static
method
|
Builder
(string name,
TinmanModule module)
|
||
type
|
ClassTypeBuilder
|
||
params
|
name
|
[not-empty]
|
The class name. |
module
|
[not-null]
|
The module that owns the new class type. | |
returns
|
|
The builder object. |
Clears the source code range.
public
method
|
ClearRange
()
|
||
inherited
|
ConfigNode.ClearRange
|
See also:
ConfigNode.RangeConfigures an object from the given config value, using this class type as base.
[OwnerReturn]
|
||||
public
method
|
ConfigureDelegate
(ConfigValue value)
|
|||
type
|
IConfigurable
|
|||
params
|
value
|
[not-null]
|
The config value. | |
returns
|
The configured object. |
Remarks:
The use of this class types Configurator is prohibited.
Exceptions:
Compares this object with the given one.
[Pure]
|
||||
public
method
|
Equals
(ConfigType other)
|
|||
type
|
bool
|
|||
params
|
other
|
The object to compare to. | ||
returns
|
true
if
this
object
is
equal
to
other,
false
if
not.
|
|||
inherited
|
ConfigType.Equals
|
Finds all config nodes which code range (see Range) intersects with the given range (see Intersects).
public
virtual
method
|
FindAt
(RangeI range,
ICollector<ConfigNode> nodes)
|
||
params
|
range
|
The code range to intersect with. | |
nodes
|
[not-null]
|
The output nodes. | |
inherited
|
ConfigNode.FindAt
|
Tries to fix the given expression.
public
method
|
FixTry
(ConfigExpression expr)
|
||
type
|
ConfigExpression
|
||
params
|
expr
|
[not-null]
|
The expression to fix. |
returns
|
|
The fixed expression or expr if fixing is not possible. | |
inherited
|
ConfigType.FixTry
|
Remarks:
This class type is used as the expected type. The method tries to find a distinct sequence of syntactic fixes so that the expression type becomes convertible to this class type.
Checks if the given config value can be fixed so that its type becomes convertible to this config type.
public
method
|
FixTry
(ConfigValue value,
ConfigType superType = null)
|
||
type
|
bool
|
||
params
|
value
|
[not-null]
|
The config value to fix. |
superType
|
Optional
super
type
to
which
the
fixed
value
must
be
assignable
to.
Defaults
to
null .
|
||
returns
|
true
if
value
can
be
fixed,
false
if
not.
|
||
inherited
|
ConfigType.FixTry
|
Returns a field of this class type.
public
method
|
GetField
(int32 idx)
|
||
type
|
ConfigMember
|
||
params
|
idx
|
[0..FieldCount-1]
|
Index of field to return. |
returns
|
|
The ConfigMember object. |
Returns a field of this class type by its name.
public
method
|
GetField
(string name,
bool includeVirtual = false)
|
||
type
|
ConfigMember
|
||
params
|
name
|
[not-null]
|
The field name. |
includeVirtual
|
Return virtual fields? | ||
returns
|
|
The ConfigMember object. |
Exceptions:
Returns a field of this class type by its name.
public
method
|
GetFieldNull
(string name,
bool includeVirtual = false)
|
||
type
|
ConfigMember
|
||
params
|
name
|
[not-null]
|
The field name. |
includeVirtual
|
Return virtual fields? | ||
returns
|
The
ConfigMember
object
or
null . |
Returns a subclass of this class.
public
method
|
GetSubClass
(int32 index)
|
||
type
|
ClassType
|
||
params
|
index
|
[0..SubClassCount-1]
|
Index of subclass to return. |
returns
|
|
The subclass. |
Checks if this config type is assignable to the given type.
public
override
method
|
IsAssignableTo
(ConfigType other)
|
||
type
|
bool
|
||
params
|
other
|
[not-null]
|
The other type. |
returns
|
true
if
this
type
is
assignable
to
the
given
one,
false
if
not.
|
||
overrides
|
ConfigType.IsAssignableTo
|
Remarks:
Equal
types
are
always
assignable
to
each
other
(see
Equals).
Additionally,
a
type
A
is
assignable
to
a
type
B
if
one
of
these
conditions
are
met:
A
is
assignable
to
an
array
type
B
iff
the
element
type
of
A
is
assignable
to
the
element
type
of
B
.
A
is
assignable
to
a
class
type
B
iff
B
is
an
ancestor
of
A
in
the
inheritance
chain.
Checks if this config type is convertible to the given type (i.e. possibly failing, possibly lossy implicit conversion).
[EmptyBody]
|
||||
public
override
method
|
IsConvertibleTo
(ConfigType other,
bool always = false)
|
|||
type
|
bool
|
|||
params
|
other
|
[not-null]
|
The other config type. | |
always
|
When
set
to
true ,
the
method
will
return
true
iff
this
type
is
always
convertible
to
other.
When
set
to
false ,
this
method
will
return
true
even
if
a
conversion
might
fail
at
runtime,
causing
a
ConfigException
to
be
thrown
(e.g.
invalid
string
to
number).
Defaults
to
false .
|
|||
returns
|
true
if
this
type
is
convertible
to
the
given
one,
false
if
not.
|
|||
overrides
|
ConfigType.IsConvertibleTo
|
Remarks:
The
following
table
shows
the
types
A
that
are
convertible
to
the
types
B
:
A \ B | Array | Bool | Class | Enum | Num | Path | Str | ------+-------+-------+-------+-------+-------+-------+-------+ Array | (1) | (2) | | | | | (3) | ------+-------+-------+-------+-------+-------+-------+-------+ Bool | | (17) | | | (4) | | (5) | ------+-------+-------+-------+-------+-------+-------+-------+ Class | | (2) | (17) | | | | | ------+-------+-------+-------+-------+-------+-------+-------+ Enum | | | | (17) | (6) | | (7) | ------+-------+-------+-------+-------+-------+-------+-------+ Num | | (8) | | (9) | (17) | | (10) | ------+-------+-------+-------+-------+-------+-------+-------+ Path | | (11) | | | | (17) | (12) | ------+-------+-------+-------+-------+-------+-------+-------+ Str | | (13) | | (14) | (15) | (16) | (17) |Two types that are assignable will always be convertible. A failed conversion attempt will yield Invalid values.
A
is
convertible
to
an
array
type
B
iff
the
element
type
of
A
is
convertible
to
the
element
type
of
B
.
Str
and
the
resulting
tokens
are
concatenated
using
','
as
the
glue.
If
one
or
more
array
elements
cannot
be
converted,
the
result
will
be
Invalid.
true
=>1
,
false
=>0
true
=>'true'
,
false
=>'false'
0
=>false
,
all
other
values
yield
true
.123.45
=>'123.45'
.
true
iff
the
path
value
refers
to
an
existing
file
or
directory
(depending
on
IsTrailing).
false
if
the
string
is
null
,
empty
or
consists
only
of
whitespaces
(see
IsEmptyOrWhitespace).
Resolves all references in this PSI node.
public
override
sealed
method
|
Resolve
()
|
||
type
|
ResolveResult
|
||
returns
|
The result of the resolver cycle. | ||
inherited
|
ConfigType.Resolve
|
Resolves this config type into a non-lazy one.
public
virtual
method
|
ResolveLazy
()
|
||
type
|
ConfigType
|
||
returns
|
|
The non-lazy config type. | |
inherited
|
ConfigType.ResolveLazy
|
Provides additional information about the parsing process.
public
method
|
SetParseInfo
(RangeI range)
|
||
params
|
range
|
The source code range. | |
inherited
|
ConfigNode.SetParseInfo
|
Returns the shortest non-ambiguous name for this config type.
public
virtual
method
|
ShortName
(IVectorConst<string> prefixes = null,
ClassType superClass = null)
|
||
type
|
string
|
||
params
|
prefixes
|
The
name
prefixes
or
null . |
|
superClass
|
The class hierarchy root to use for finding name clashes. | ||
returns
|
|
The short name. | |
inherited
|
ConfigType.ShortName
|
Uses this type as the element type and returns the corresponding array type.
public
virtual
method
|
ToArray
()
|
||
type
|
ArrayType
|
||
returns
|
|
The array type. | |
inherited
|
ConfigType.ToArray
|
[Pure]
|
||||
public
override
method
|
ToString
()
|
|||
type
|
string
|
|||
inherited
|
ConfigType.ToString
|
Validates the state of this object.
public
override
method
|
Validate
(Validator validator)
|
||
params
|
validator
|
[not-null]
|
The validator object. |
overrides
|
ConfigType.Validate
|
Creates a new value object for this config property type.
public
override
method
|
Value
()
|
||
type
|
ConfigValue
|
||
returns
|
|
The created value object. | |
implements
|
ConfigType.Value
|
Remarks:
The returned value object will have the default value for its type. A class type value must be initialized to a concrete type before its fields can be accessed. This is done by calling New.
Produces source code by feeding the given source code writer.
public
override
method
|
WriteSourceCode
(SourceCodeWriter writer,
Context context)
|
||
params
|
writer
|
[not-null]
|
The source code writer to use. |
context
|
[not-null]
|
Context information. | |
implements
|
ConfigNode.WriteSourceCode
|
The source code range of this PSI node.
protected
field
|
range
|
||
type
|
RangeI
|
||
inherited
|
ConfigNode.range
|
Creates a new instance of ClassType.
protected
constructor
|
ClassType
(string name,
ConfigMember[] fields = null,
ClassType superClass = null,
bool isAbstract = false,
IConfiguratorObject configurator = null)
|
||
params
|
name
|
The class name. | |
fields
|
The
class
fields
or
null
if
this
class
has
no
fields.
Defaults
to
null .
|
||
superClass
|
The
super
class
of
this
class
type,
or
null .
Defaults
to
null .
|
||
isAbstract
|
Is
the
class
abstract?
Defaults
to
false . |
||
configurator
|
The
object
configurator.
Defaults
to
null . |