|
Carrot2 v3.6.0-SNAPSHOT
API Documentation |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.util.attribute.BindableDescriptor
public class BindableDescriptor
Provides a full description of a 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).
BindableDescriptorBuilder.buildDescriptor(Object)| Nested Class Summary | |
|---|---|
static class |
BindableDescriptor.GroupingMethod
The supported AttributeDescriptor grouping methods. |
| Field Summary | |
|---|---|
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. |
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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.
| Method Detail |
|---|
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 applied
BindableDescriptor 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 used
public 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);
}
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||