paralleldomain.model.annotation.common¶
- class AnnotationIdentifier(annotation_type, name=None)¶
- Used to identify annotations. In case there are multiple annotations of the same type you’ll be able
to differentiate them through their name. For backwards compatibility reasons, a name with some annotation_type T and name None is equal to the type T, also having the same hash.
- Parameters:
- annotation_type¶
The annotation type
- name¶
The name of the annotation
- static resolve_annotation_identifier(available_annotation_identifiers, annotation_type=None, annotation_identifier=None, name=None)¶
- Resolves the given arguments into a valid annotation identifier, throws a ValueError if that’s not possible.
This method is used to be backwards compatible in most cases: Specifying the annotation_type is enough to resolve an identifier, unless there are multiple identifiers of the same annotation type in available_annotation_identifiers. Either annotation_type or annotation_identifier has to be not None.
- Parameters:
available_annotation_identifiers (
List
[AnnotationIdentifier
]) – List of identifiers that the result is selected fromannotation_type (
Optional
[Type
[TypeVar
(T
, bound=Annotation
)]]) – Annotation Type of the identifierannotation_identifier (
Optional
[AnnotationIdentifier
]) – An annotation identifier, specifying the type + optionally the name.
- Return type:
- Returns:
The resolved annotation identifier.