documentationfor yFiles for HTML 2.6

A trait is an interface that may or may not have default implementations of its methods, properties and fields.

Inheritance Hierarchy
Trait

Remarks

Note: This is a deprecated alias for Interface.

Traits have very specific rules in case two traits with the same member are implemented by a subtype:

  • If both method definitions are abstract, then the method is abstract.
  • If one method definition is abstract and the other concrete, then the concrete method is used.
  • If both method definitions are concrete and the traits are implemented at the same level, then the method is abstract.
  • If both method definitions are concrete and one of the traits is a sub-type of the other, then its method definition will be used.

In all of those cases, the rule is that a subtype overrides the parent types' definitions. Example: Given the traits A, B, C and D where A defines a method "a" to be abstract and B and C extending trait A with concrete implementations of "a", when D is a trait that implements both B and C, its version of "a" will be abstract, unless it defines its own implementation of "a", in which case that definition is used.

All trait types have a $class property, which contains their type, and a static isTrait method that can be used to test whether an object implements the trait.

Type Details

yfiles module
lang
yfiles-umd modules
All modules
Legacy UMD name
yfiles.lang.Trait

Static Methods