api / org.gradle.api.attributes / AttributesSchema

AttributesSchema

@Incubating interface AttributesSchema

An attributes schema stores information about Attribute and how they can be matched together.

Since
3.3

Functions

attribute

abstract fun <T : Any> attribute(attribute: Attribute<T>): AttributeMatchingStrategy<T>

Declares a new attribute in the schema and configures it with the default strategy. If the attribute was already declared it will simply return the existing strategy.

abstract fun <T : Any> attribute(attribute: Attribute<T>, configureAction: Action<in AttributeMatchingStrategy<T>>): AttributeMatchingStrategy<T>

Configures the matching strategy for an attribute. The first call to this method for a specific attribute will create a new matching strategy, whereas subsequent calls will configure the existing one.

getAttributes

abstract fun getAttributes(): MutableSet<Attribute<*>>

Returns the set of attributes known to this schema.

getMatchingStrategy

abstract fun <T : Any> getMatchingStrategy(attribute: Attribute<T>): AttributeMatchingStrategy<T>

Returns the matching strategy for a given attribute.

hasAttribute

abstract fun hasAttribute(key: Attribute<*>): Boolean

Returns true when this schema contains the given attribute.