public class AnnotationTypeRegistry extends Object
Modifier and Type | Field and Description |
---|---|
private Map<Integer,AnnotationType> |
idMap |
private Map<String,AnnotationType> |
nameMap |
Constructor and Description |
---|
AnnotationTypeRegistry()
Creates a new empty registry.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all registered annotation types.
|
AnnotationType |
getType(int id)
Returns an annotation type with the given id.
|
AnnotationType |
getType(String name)
Returns an annotation type with the given name.
|
Map<String,AnnotationType> |
getTypes()
Returns an unmodifiable
Map of all types registered. |
void |
register(AnnotationType type)
Register a new annotation type. WARNING! Only to be used by the configuration system and in unit tests. Not to be used in production code.
|
boolean |
unregister(AnnotationType type)
Unregisters the type given by the argument. WARNING! Only to be used by the configuration system and in unit tests. Not to be used in production code.
|
boolean |
unregister(int id)
Unregisters the type given by the argument. WARNING! Only to be used by the configuration system and in unit tests. Not to be used in production code.
|
boolean |
unregister(String name)
Unregisters the type given by the argument. WARNING! Only to be used by the configuration system and in unit tests. Not to be used in production code.
|
private Map<Integer,AnnotationType> idMap
private Map<String,AnnotationType> nameMap
public AnnotationTypeRegistry()
public void register(AnnotationType type)
type
- the type to registerIllegalArgumentException
- if a type is already registered with this name or this id, and it is non-equal to the argument.public boolean unregister(String name)
name
- the name of the type to unregister.public boolean unregister(int id)
id
- the id of the type to unregister.public boolean unregister(AnnotationType type)
type
- the AnnotationType to unregister.IllegalArgumentException
- if the ID and name of this annotation type are present, but they do not belong together.public AnnotationType getType(String name)
name
- the name of the annotation type to returnAnnotationType
with the given name, or null if it is not registeredpublic AnnotationType getType(int id)
id
- the id of the annotation type to returnAnnotationType
with the given id, or null if it is not registeredpublic Map<String,AnnotationType> getTypes()
Map
of all types registered.Map
of all types registered.public void clear()
Copyright © 2017. All rights reserved.