public class AttributeDescriptor extends Object
key,
type, defaultValue and constraints. Also contains
human-readable metadata about the attribute such as title, label or
description.
AttributeDescriptors can be obtained from BindableDescriptors, which in
turn are built by BindableDescriptorBuilder.buildDescriptor(Object);
| Modifier and Type | Class | Description |
|---|---|---|
static class |
AttributeDescriptor.AttributeDescriptorToKey |
Transforms
AttributeDescriptors into their keys. |
| Modifier and Type | Field | Description |
|---|---|---|
List<Annotation> |
constraints |
Constraints defined for the attribute.
|
Object |
defaultValue |
Default value of the attribute.
|
boolean |
inputAttribute |
True if the attribute is an Input attribute. |
String |
key |
Type of the attribute as defined by
Attribute.key(). |
AttributeMetadata |
metadata |
Human-readable metadata describing the attribute.
|
boolean |
outputAttribute |
True if the attribute is an Output attribute. |
boolean |
requiredAttribute |
True if the attribute is a Required attribute. |
Class<?> |
type |
Type of the attribute.
|
| Modifier and Type | Method | Description |
|---|---|---|
<T extends Annotation> |
getAnnotation(Class<T> annotationClass) |
Returns an annotation specified for the attribute.
|
boolean |
isValid(Object value) |
Returns
true if the given value is valid for the attribute described
by this descriptor (non-null for Required attributes and
fulfilling all other constraints). |
String |
toString() |
public final AttributeMetadata metadata
public final String key
Attribute.key().public final Class<?> type
public final Object defaultValue
public final List<Annotation> constraints
public final boolean inputAttribute
True if the attribute is an Input attribute.public final boolean outputAttribute
True if the attribute is an Output attribute.public final boolean requiredAttribute
True if the attribute is a Required attribute.public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
annotationClass - type of annotation to be returnednull is annotation of the
provided type is not defined for the attributepublic final boolean isValid(Object value)
true if the given value is valid for the attribute described
by this descriptor (non-null for Required attributes and
fulfilling all other constraints).Copyright © 2018 Carrot2.org. All rights reserved.