classafIoc::TypeCoercer

sys::Obj
  afIoc::TypeCoercer

Coerces an Obj to a given type via Fantom's fromXXX() / toXXX() ctors and methods. This is mainly useful for convert to and from Strs.

As a lot of repetition of types is expected for each TypeCoercer the conversion methods are cached.

@since 1.3.8

canCoerce

Source

Bool canCoerce(Type fromType, Type toType)

Returns true if fromType can be coerced to the given toType.

coerce

Source

Obj coerce(Obj value, Type toType)

Coerces the Obj to the given type. Coercion methods are looked up in the following order:

  1. toXXX()
  2. fromXXX()
  3. makeFromXXX()