object Annotations
Utility methods for dealing with java.lang.annotation.Annotation
- Alphabetic
- By Inheritance
- Annotations
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals[A <: Annotation](annotation: Annotation)(implicit arg0: ClassTag[A]): Boolean
Determines if the given Annotation has an annotation type of the given type param.
Determines if the given Annotation has an annotation type of the given type param.
- A
the type to match against.
- annotation
the Annotation to match.
- returns
true if the given Annotation is of type A, false otherwise.
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filterAnnotations(filterSet: Set[Class[_ <: Annotation]], annotations: Array[Annotation]): Array[Annotation]
Filters a list of annotations by annotation type discriminated by the set of given annotations.
Filters a list of annotations by annotation type discriminated by the set of given annotations.
- filterSet
the Set of Annotation classes by which to filter.
- annotations
the list Annotation instances to filter.
- returns
the filtered list of matching annotations.
- def filterIfAnnotationPresent[A <: Annotation](annotations: Array[Annotation])(implicit arg0: ClassTag[A]): Array[Annotation]
Filter a list of annotations discriminated on whether the annotation is itself annotated with the passed annotation.
Filter a list of annotations discriminated on whether the annotation is itself annotated with the passed annotation.
- A
the type of the annotation by which to filter.
- annotations
the list of Annotation instances to filter.
- returns
the filtered list of matching annotations.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def findAnnotation[A <: Annotation](annotations: Array[Annotation])(implicit arg0: ClassTag[A]): Option[A]
Find an Annotation within a given list of annotations annotated by the given type param.
Find an Annotation within a given list of annotations annotated by the given type param.
- A
the type of the Annotation to find.
- annotations
the list of Annotation instances to search.
- returns
the matching Annotation instance if found, otherwise None.
- def findAnnotation(target: Class[_ <: Annotation], annotations: Array[Annotation]): Option[Annotation]
Find an Annotation within a given list of annotations of the given target.
Find an Annotation within a given list of annotations of the given target. annotation type.
- target
the class of the Annotation to find.
- annotations
the list of Annotation instances to search.
- returns
the matching Annotation instance if found, otherwise None.
- def findAnnotations(clazz: Class[_], parameterTypes: Seq[Class[_]] = Seq.empty): Map[String, Array[Annotation]]
Attempts to map fields to array of annotations.
Attempts to map fields to array of annotations. This is intended to work around the Scala default of not carrying annotation information on annotated constructor fields annotated without also specifying a @meta annotation (e.g.,
@field
). Thus, this method scans the constructor and then all declared fields in order to build up the mapping of field name toArray[java.lang.Annotation]
. When the given class has a single constructor, that constructor will be used. Otherwise, the given parameter types are used to locate a constructor. Steps:- walk the constructor and collect annotations on all parameters.
- for each declared field in the class, collect declared annotations. If a constructor parameter is overridden as a declared field, the annotations on the declared field take precedence.
- for each super interface, walk each declared method, collect declared method annotations IF the declared method is the same name of a declared field from step two. That is find only super interface methods which are implemented by declared fields in the given class in order to locate inherited annotations for the declared field.
- clazz
the
Class
to inspect. This should represent a Scala case class.- parameterTypes
an optional list of parameter class types in order to locate the appropriate case class constructor when the class has multiple constructors. If a class has multiple constructors and parameter types are not specified, an IllegalArgumentException is thrown. Likewise, if a suitable constructor cannot be located by the given parameter types an IllegalArgumentException is thrown.
- returns
a map of field name to associated annotations. An entry in the map only occurs if the associated annotations are non-empty. That is fields without any found annotations are not returned.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getValue(annotation: Annotation, method: String = "value"): Option[String]
Attempts to return the result of invoking
method()
of a given Annotation.Attempts to return the result of invoking
method()
of a given Annotation. If theAnnotation#method
cannot be invoked then None is returned.- annotation
the Annotation to process.
- method
the method of the Annotation to invoke to obtain a value.
- returns
the result of invoking
annotation#method()
or None.
- def getValueIfAnnotatedWith[A <: Annotation](annotation: Annotation, method: String = "value")(implicit arg0: ClassTag[A]): Option[String]
Attempts to return the result of invoking
method()
of a given Annotation which should be annotated by an Annotation of type A.Attempts to return the result of invoking
method()
of a given Annotation which should be annotated by an Annotation of type A.If the given Annotation is not annotated by an Annotation of type A or if the
Annotation#method
cannot be invoked then None is returned.- A
the Annotation type to match against before trying to invoke
annotation#method
.- annotation
the Annotation to process.
- method
the method of the Annotation to invoke to obtain a value.
- returns
the result of invoking
annotation#method()
or None.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def isAnnotationPresent[ToFindAnnotation <: Annotation, A <: Annotation](implicit arg0: ClassTag[ToFindAnnotation], arg1: ClassTag[A]): Boolean
Determines if the given A is annotated by an Annotation of the given type param ToFindAnnotation.
Determines if the given A is annotated by an Annotation of the given type param ToFindAnnotation.
- ToFindAnnotation
the Annotation to match.
- A
the type of the Annotation to determine if is annotated on the A.
- returns
true if the given Annotation is annotated with an Annotation of type ToFindAnnotation, false otherwise.
- def isAnnotationPresent[A <: Annotation](annotation: Annotation)(implicit arg0: ClassTag[A]): Boolean
Determines if the given Annotation is annotated by an Annotation of the given type param.
Determines if the given Annotation is annotated by an Annotation of the given type param.
- A
the type of the Annotation to determine if is annotated on the Annotation.
- annotation
the Annotation to match.
- returns
true if the given Annotation is annotated with an Annotation of type A, false otherwise.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()