of

open fun <T> of(name: String, type: Class<T>): Attribute<T>(source)

Creates a new attribute of the given name with the given type. There's no guarantee that subsequent calls to this method with the same attributes would either return the same instance or different instances of Attribute, so consumers are required to compare the attributes with the equals method.

Return

an attribute with the given name and type

Parameters

name

the name of the attribute

type

the class of the attribute

<T>

the type of the attribute


open fun <T> of(type: Class<T>): Attribute<T>(source)

Creates a new attribute of the given type, inferring the name of the attribute from the simple type name. This method is useful when there's supposedly only one attribute of a specific type in a container, so there's no need to distinguish by name (but the returned type doesn't enforce it_. There's no guarantee that subsequent calls to this method with the same attributes would either return the same instance or different instances of Attribute, so consumers are required to compare the attributes with the equals method.

Return

an attribute with the given name and type

Parameters

type

the class of the attribute

<T>

the type of the attribute