Tests if an annotation of a class, field, method or method parameter is as specified.
Tests if an annotation of a class, field, method or method parameter is as specified. The test takes the element values into consideration; if you don't want to take them into consideration use a HasAnnotation predicate.
scala> import org.opalj.br._ scala> import org.opalj.av.checking._ scala> val foo = ObjectType("java/lang/Foo") scala> val am = AnnotationPredicate("java.lang.Foo",Map("clazz" -> StringValue(""))) am: org.opalj.av.checking.AnnotationPredicate = @java.lang.Foo(clazz="") scala> am(Annotation(foo,IndexedSeq(ElementValuePair("clazz",StringValue(""))))) res: Boolean = true scala> am(Annotation(foo,IndexedSeq(ElementValuePair("clazz",StringValue("-+-"))))) res: Boolean = false scala> val am = DefaultAnnotationPredicate("java.lang.Foo",IndexedSeq.empty) am: org.opalj.av.checking.DefaultAnnotationPredicate = @java.lang.Foo() scala> am(Annotation(ObjectType("java/lang/Foo"),IndexedSeq(ElementValuePair("clazz",StringValue(" "))))) res: Boolean = false
Matches an annotation of a class, field, method or method parameter.
An architecture checker validates if the implemented architecture complies with the expected/specified one.
Helper class to mark those places where a string using binary notation (i.e., where packages are separated using "/" instead of ".") is expected.
Helper class to mark those places where a string using binary notation (i.e., where packages are separated using "/" instead of ".") is expected.
A related implicit conversion is defined in the package object.
A class level matcher matches classes and all methods and fields defined by the respective classes.
A class matcher matches classes defined by the respective classes.
Default class matcher matches classes defined by the respective classes.
A dependency checker validates if the dependencies between the elements of two ensembles comply with the expected/specified dependencies.
Used to report deviations between the specified/expected and the implemented dependencies.
Matches fields based on their name, type, annotations and declaring class.
Matches an annotation of a class, field, method or method parameter that has the specified type.
Matches an annotation of a class, field, method or method parameter that has the specified type. The annotation is matched independent of the annotation's values.
scala> import org.opalj.br._ scala> val foo = ObjectType("java/lang/Foo") scala> val aw = org.opalj.av.checking.AnnotatedWith(foo) aw: org.opalj.av.checking.AnnotatedWith = @java.lang.Foo scala> aw(Annotation(foo,IndexedSeq(ElementValuePair("clazz",StringValue(" "))))) res: Boolean = true
Matches methods based on their attributes, annotations and class.
Matches a (binary) name of a file, method or class.
Matches all classes in the specified package.
A property checker validates if the elements of an ensemble have the expected/specified properties.
Used to report source elements that have properties that deviate from the expected ones.
Matches name of class, fields and methods based on their name.
Matches name of class, fields and methods based on their name.
The name is matched against the binary notation.
A predicate related to a specific source element.
A source element matcher determines a set of source elements that matches a given query.
A specification of a project's architectural constraints.
A specification of a project's architectural constraints.
First define the ensembles, then the rules and at last specify the class files that should be analyzed. The rules will then automatically be evaluated.
The intended way to create a specification is to create a new anonymous Specification class that contains the specification of the architecture. Afterwards the specification object can be used to get the list of architectural violations.
new Specification(project) { ensemble('Number) { "mathematics.Number*" } ensemble('Rational) { "mathematics.Rational*" } ensemble('Mathematics) { "mathematics.Mathematics*" } ensemble('Example) { "mathematics.Example*" } 'Example is_only_allowed_to (USE, 'Mathematics) }
One ensemble is predefined: Specification.empty
it represents an ensemble that
contains no source elements and which can, e.g., be used to specify that no "real"
ensemble is allowed to depend on a specific ensemble.
Used to report errors in the specification itself.
Used to report deviations between the specified and the implemented architecture.
Matches all project and library classes including inner elements like methods and fields defined by the respective classes.
Defines several additional factory methods to facilitate the creation of AnnotationPredicates.
An annotation matcher that always returns true
; it matches any annotation.
Defines several additional factory methods to facilitate the creation of ClassMatchers.
Defines several additional factory methods to facilitate the creation of FieldMatchers.
Factory methods to create AnnotatedWith predicates.
Defines several additional factory methods to facilitate the creation of MethodMatchers.
A source element matcher that matches no elements.
Defines several additional factory methods to facilitate the creation of PackageMatchers.
Helper classes and functionality related to specifying architectural concerns.