Package cdc.enums
Class AbstractListDynamicEnum<V extends AbstractListDynamicEnum<V>>
java.lang.Object
cdc.enums.AbstractListDynamicEnum<V>
- Type Parameters:
V- The dynamic enum concrete type.
- All Implemented Interfaces:
DynamicEnum,ListDynamicEnum<V>,Comparable<V>
public abstract class AbstractListDynamicEnum<V extends AbstractListDynamicEnum<V>>
extends Object
implements ListDynamicEnum<V>, Comparable<V>
Dynamic enumeration of independent values.
Each value has a unique name.
This implementation supports these features:
DagFeature.LOCKINGDagFeature.CREATIONtill locked.DagFeature.REMOVALif allowed at creation time and till locked.DagFeature.CONTENT_CHANGEif allowed at creation time and till locked.
A typical implementation should look like this:
public final class Foo extends AbstractListDynamicEnum<Foo> {
public static final Support<Foo> SUPPORT = support(Foo.class, Foo::new, Feature.RENAMING, ...);
protected Foo(String value) {
super(value);
}
}
- Author:
- Damien Carbonne
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAbstractListDynamicEnum.Creator<V extends ListDynamicEnum<V>>Interface used to create new instances of a dynamic enum.static interfaceAbstractListDynamicEnum.Modifier<V extends ListDynamicEnum<V>>static interfaceAbstractListDynamicEnum.Support<V extends ListDynamicEnum<V>>Support interface describing standard methods expected for a dynamic enum. -
Field Summary
Fields inherited from interface cdc.enums.DynamicEnum
NAME_COMPARATOR, QNAME_COMPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanfinal StringgetName()getQName()inthashCode()protected final voidprotected static <E extends AbstractListDynamicEnum<E>>
AbstractListDynamicEnum.Support<E>support(Class<E> cls, AbstractListDynamicEnum.Creator<E> creator, DagFeature... features) static <E extends ListDynamicEnum<E>>
AbstractListDynamicEnum.Support<E>support(Class<E> cls, Predicate<String> nameValidator, AbstractListDynamicEnum.Creator<E> creator, AbstractListDynamicEnum.Modifier<E> modifier, DagFeature... features) protected static <E extends AbstractListDynamicEnum<E>>
AbstractListDynamicEnum.Support<E>support(Class<E> cls, Predicate<String> nameValidator, AbstractListDynamicEnum.Creator<E> creator, DagFeature... features) Creates a support instance.toString()
-
Constructor Details
-
AbstractListDynamicEnum
-
-
Method Details
-
setName
-
getName
- Specified by:
getNamein interfaceDynamicEnum- Returns:
- The enumeration name.
-
getQName
- Specified by:
getQNamein interfaceDynamicEnum- Returns:
- The enumeration qualified name.
-
toString
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<V extends AbstractListDynamicEnum<V>>
-
support
public static <E extends ListDynamicEnum<E>> AbstractListDynamicEnum.Support<E> support(Class<E> cls, Predicate<String> nameValidator, AbstractListDynamicEnum.Creator<E> creator, AbstractListDynamicEnum.Modifier<E> modifier, DagFeature... features) -
support
protected static <E extends AbstractListDynamicEnum<E>> AbstractListDynamicEnum.Support<E> support(Class<E> cls, Predicate<String> nameValidator, AbstractListDynamicEnum.Creator<E> creator, DagFeature... features) Creates a support instance.- Type Parameters:
E- The dynamic enum type.- Parameters:
cls- The dynamic enum class.nameValidator- The predicate to check names validity.creator- The dynamic enum factoryfeatures- The features to enable.- Returns:
- A new instance of Support for
<E>
-
support
protected static <E extends AbstractListDynamicEnum<E>> AbstractListDynamicEnum.Support<E> support(Class<E> cls, AbstractListDynamicEnum.Creator<E> creator, DagFeature... features)
-