public class BindableDescriptor extends Object
Bindable type, including
AttributeDescriptors for all attributes defined by the type. Also provides
some human-readable metadata for the Bindable type itself.
BindableDescriptors are immutable.
BindableDescriptors can be obtained from
BindableDescriptorBuilder.buildDescriptor(Object).
| Modifier and Type | Class and Description |
|---|---|
static class |
BindableDescriptor.GroupingMethod
The supported
AttributeDescriptor grouping methods. |
| Modifier and Type | Field and Description |
|---|---|
Map<String,AttributeDescriptor> |
attributeDescriptors
Descriptors without any group assignment.
|
Map<Object,Map<String,AttributeDescriptor>> |
attributeGroups
Grouped descriptors.
|
BindableDescriptor.GroupingMethod |
groupedBy
The method by which this
BindableDescriptor is grouped. |
BindableMetadata |
metadata
Human-readable metadata about this
Bindable type. |
String |
prefix
Prefix of the
Bindable this descriptor refers to, as returned by
BindableUtils.getPrefix(Class). |
Class<?> |
type
The type this
BindableDescriptor refers to. |
| Modifier and Type | Method and Description |
|---|---|
BindableDescriptor |
flatten()
Returns a flattened structure of attribute descriptors.
|
HashMap<String,Object> |
getDefaultValues()
Returns a map of default values of attributes associated with this bindable.
|
BindableDescriptor |
group(BindableDescriptor.GroupingMethod groupingMethod)
Returns a grouped structure of attribute descriptors.
|
BindableDescriptor |
not(Class<? extends Annotation>... annotationClasses)
Preserves descriptors that have none of the specified
annotations.
|
BindableDescriptor |
only(Class<? extends Annotation>... annotationClasses)
Preserves descriptors that have all of the specified annotations.
|
BindableDescriptor |
only(com.google.common.base.Predicate<AttributeDescriptor> predicate)
Preserves attribute descriptors for which the provided
predicate returns
true. |
public final BindableDescriptor.GroupingMethod groupedBy
BindableDescriptor is grouped.public final Class<?> type
BindableDescriptor refers to.public final String prefix
Bindable this descriptor refers to, as returned by
BindableUtils.getPrefix(Class).public final Map<String,AttributeDescriptor> attributeDescriptors
Attribute.key().BindableDescriptor.GroupingMethodpublic final Map<Object,Map<String,AttributeDescriptor>> attributeGroups
BindableDescriptor.GroupingMethod.NONE, to get them grouped, use
group(GroupingMethod). The iterator returns values of this map in the
natural order of keys. For the exact type of the key of this map, see
BindableDescriptor.GroupingMethod.public final BindableMetadata metadata
Bindable type.public BindableDescriptor only(com.google.common.base.Predicate<AttributeDescriptor> predicate)
predicate returns
true. Notice that BindableDescriptors are immutable, so
the filtered descriptor set is returned rather than filtering being applied to the
receiver.predicate - predicate to the appliedBindableDescriptor with the descriptors filtered.public BindableDescriptor only(Class<? extends Annotation>... annotationClasses)
BindableDescriptors are immutable, so the filtered descriptor
set is returned rather than filtering being applied to the receiver.annotationClasses - binding time and direction annotation classes to be
matched.BindableDescriptor with the descriptors filtered.public BindableDescriptor not(Class<? extends Annotation>... annotationClasses)
BindableDescriptors are immutable, so the
filtered descriptor set is returned rather than filtering being applied to the
receiver.annotationClasses - binding time and direction annotation classes to be
matched.BindableDescriptor with the descriptors filtered.public BindableDescriptor flatten()
attributeDescriptors contains descriptors of all attributes and
attributeGroups is empty. Notice that BindableDescriptors are
immutable, so the flattened descriptor set is returned rather than flattening being
applied to the receiver.public BindableDescriptor group(BindableDescriptor.GroupingMethod groupingMethod)
BindableDescriptors are immutable, so the grouped descriptor set is
returned rather than grouping being applied to the receiver.groupingMethod - the grouping method to be usedpublic HashMap<String,Object> getDefaultValues()
for (AttributeDescriptor d : only(Input.class).flatten().attributeDescriptors.values())
{
if (d.defaultValue != null || d.requiredAttribute)
values.put(d.key, d.defaultValue);
}
Copyright © 2013 Carrot2.org. All Rights Reserved.