public class UnitsRelationsTools extends Object
Constructor and Description |
---|
UnitsRelationsTools() |
Modifier and Type | Method and Description |
---|---|
static @Nullable AnnotationMirror |
buildAnnoMirrorWithDefaultPrefix(ProcessingEnvironment env,
Class<? extends Annotation> annoClass)
Creates an AnnotationMirror representing a unit defined by annoClass, with the default Prefix of Prefix.one
|
static @Nullable AnnotationMirror |
buildAnnoMirrorWithNoPrefix(ProcessingEnvironment env,
Class<? extends Annotation> annoClass)
Creates an AnnotationMirror representing a unit defined by annoClass, with no prefix
|
static @Nullable AnnotationMirror |
buildAnnoMirrorWithSpecificPrefix(ProcessingEnvironment env,
Class<? extends Annotation> annoClass,
Prefix p)
Creates an AnnotationMirror representing a unit defined by annoClass, with the specific Prefix p
|
static @Nullable Prefix |
getPrefix(AnnotatedTypeMirror annoType)
Retrieves the SI Prefix of an Annotated Type
|
static @Nullable Prefix |
getPrefix(@Nullable AnnotationMirror unitsAnnotation)
Retrieves the SI Prefix of an Annotation
|
static boolean |
hasNoPrefix(@Nullable AnnotatedTypeMirror annoType)
Checks to see if an Annotated Type has no prefix
|
static boolean |
hasNoPrefix(@Nullable AnnotationMirror unitsAnnotation)
Checks to see if an Annotation has no prefix
|
static boolean |
hasNoUnits(@Nullable AnnotatedTypeMirror annoType)
Checks to see if a particular Annotated Type has no units, such as scalar constants in calculations.
|
static boolean |
hasSpecificUnit(@Nullable AnnotatedTypeMirror annoType,
@Nullable AnnotationMirror unitsAnnotation)
Checks to see if a particular Annotated Type has a specific unit (represented by its Annotation)
|
static boolean |
hasSpecificUnitIgnoringPrefix(@Nullable AnnotatedTypeMirror annoType,
@Nullable AnnotationMirror unitsAnnotation)
Checks to see if a particular Annotated Type has a particular base unit (represented by its Annotation)
|
static AnnotatedTypeMirror |
removePrefix(@Nullable Elements elements,
@Nullable AnnotatedTypeMirror annoType)
Removes the Prefix value from an Annotated Type, by constructing and returning a copy of the Annotated Type without the prefix
|
static @Nullable AnnotationMirror |
removePrefix(@Nullable Elements elements,
@Nullable AnnotationMirror unitsAnnotation)
Removes the Prefix value from an Annotation, by constructing and returning a copy of its base SI unit's Annotation
|
public static @Nullable AnnotationMirror buildAnnoMirrorWithDefaultPrefix(ProcessingEnvironment env, Class<? extends Annotation> annoClass)
env
- Checker Processing Environment, provided as a parameter in init() of a UnitsRelations implementationannoClass
- The Class of an Annotation representing a Unit (eg m.class for meters)public static @Nullable AnnotationMirror buildAnnoMirrorWithSpecificPrefix(ProcessingEnvironment env, Class<? extends Annotation> annoClass, Prefix p)
env
- Checker Processing Environment, provided as a parameter in init() of a UnitsRelations implementationannoClass
- The Class of an Annotation representing a Unit (eg m.class for meters)p
- A Prefix valuepublic static @Nullable AnnotationMirror buildAnnoMirrorWithNoPrefix(ProcessingEnvironment env, Class<? extends Annotation> annoClass)
env
- Checker Processing Environment, provided as a parameter in init() of a UnitsRelations implementationannoClass
- The Class of an Annotation representing a Unit (eg m.class for meters)public static @Nullable Prefix getPrefix(AnnotatedTypeMirror annoType)
annoType
- An AnnotatedTypeMirror representing a Units Annotated Typepublic static @Nullable Prefix getPrefix(@Nullable AnnotationMirror unitsAnnotation)
unitsAnnotation
- An AnnotationMirror representing a Units Annotationpublic static boolean hasNoPrefix(@Nullable AnnotatedTypeMirror annoType)
annoType
- An AnnotatedTypeMirror representing a Units Annotated Typepublic static boolean hasNoPrefix(@Nullable AnnotationMirror unitsAnnotation)
unitsAnnotation
- An AnnotationMirror representing a Units Annotationpublic static @Nullable AnnotationMirror removePrefix(@Nullable Elements elements, @Nullable AnnotationMirror unitsAnnotation)
elements
- Element Utilities from a checker's processing environment,
typically obtained by calling env.getElementUtils() in init()
of a Units Relations implementationunitsAnnotation
- An AnnotationMirror representing a Units Annotationpublic static AnnotatedTypeMirror removePrefix(@Nullable Elements elements, @Nullable AnnotatedTypeMirror annoType)
elements
- Element Utilities from a checker's processing environment,
typically obtained by calling env.getElementUtils() in init()
of a Units Relations implementationannoType
- An AnnotatedTypeMirror representing a Units Annotated Typepublic static boolean hasNoUnits(@Nullable AnnotatedTypeMirror annoType)
annoType
- An AnnotatedTypeMirror representing a Units Annotated Typepublic static boolean hasSpecificUnit(@Nullable AnnotatedTypeMirror annoType, @Nullable AnnotationMirror unitsAnnotation)
annoType
- An AnnotatedTypeMirror representing a Units Annotated TypeunitsAnnotation
- An AnnotationMirror representing a Units Annotation of a specific unitpublic static boolean hasSpecificUnitIgnoringPrefix(@Nullable AnnotatedTypeMirror annoType, @Nullable AnnotationMirror unitsAnnotation)
annoType
- An AnnotatedTypeMirror representing a Units Annotated TypeunitsAnnotation
- An AnnotationMirror representing a Units Annotation of the base unit