Package

org.opalj.av

checking

Permalink

package checking

Helper classes and functionality related to specifying architectural concerns.

Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. checking
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class AccessFlags(accessFlags: AccessFlagsMatcher) extends SourceElementPredicate[ConcreteSourceElement] with Product with Serializable

    Permalink
  2. case class AnnotatedWith(annotationType: FieldType, elementValuePairs: Seq[ElementValuePair]) extends AnnotationPredicate with Product with Serializable

    Permalink

    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
  3. trait AnnotationPredicate extends SourceElementPredicate[ConcreteSourceElement]

    Permalink

    Matches an annotation of a class, field, method or method parameter.

  4. trait AnnotationsPredicate extends (Traversable[Annotation]) ⇒ Boolean

    Permalink

  5. sealed trait ArchitectureChecker extends AnyRef

    Permalink

    An architecture checker validates if the implemented architecture complies with the expected/specified one.

  6. case class Attributes(attributes: br.Attributes) extends SourceElementPredicate[ConcreteSourceElement] with Product with Serializable

    Permalink

  7. final class BinaryString extends AnyRef

    Permalink

    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.

  8. trait ClassLevelMatcher extends SourceElementsMatcher

    Permalink

    A class level matcher matches classes and all methods and fields defined by the respective classes.

  9. trait ClassMatcher extends ClassLevelMatcher

    Permalink

    A class matcher matches classes defined by the respective classes.

  10. case class DefaultClassMatcher(accessFlagsMatcher: AccessFlagsMatcher = AccessFlagsMatcher.ANY, namePredicate: NamePredicate = RegexNamePredicate(""".*""".r), annotationsPredicate: AnnotationsPredicate = AnyAnnotations, matchSubclasses: Boolean = false, matchImplementingclasses: Boolean = false, matchMethods: Boolean = true, matchFields: Boolean = true) extends ClassMatcher with Product with Serializable

    Permalink

    Default class matcher matches classes defined by the respective classes.

  11. trait DependencyChecker extends ArchitectureChecker

    Permalink

    A dependency checker validates if the dependencies between the elements of two ensembles comply with the expected/specified dependencies.

  12. case class DependencyViolation(project: SomeProject, dependencyChecker: DependencyChecker, source: VirtualSourceElement, target: VirtualSourceElement, dependencyType: DependencyType, description: String) extends SpecificationViolation with Product with Serializable

    Permalink

    Used to report deviations between the specified/expected and the implemented dependencies.

  13. case class Equals(name: BinaryString) extends NamePredicate with Product with Serializable

    Permalink

  14. case class FieldMatcher(declaringClass: ClassLevelMatcher, annotations: AnnotationsPredicate, theType: Option[FieldType], theName: Option[NamePredicate]) extends SourceElementsMatcher with Product with Serializable

    Permalink

    Matches fields based on their name, type, annotations and declaring class.

  15. case class HasAnnotation(annotationType: FieldType) extends AnnotationPredicate with Product with Serializable

    Permalink

    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.

    Example

    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
  16. case class HasAtLeastOneAnnotation(annotationPredicates: Set[_ <: AnnotationPredicate]) extends AnnotationsPredicate with Product with Serializable

    Permalink

  17. case class HasAtLeastTheAnnotations(annotationPredicates: Set[_ <: AnnotationPredicate]) extends AnnotationsPredicate with Product with Serializable

    Permalink

  18. case class HasTheAnnotations(annotationPredicates: Set[_ <: AnnotationPredicate]) extends AnnotationsPredicate with Product with Serializable

    Permalink

  19. case class MethodMatcher(classLevelMatcher: ClassLevelMatcher = AllClasses, annotationsPredicate: AnnotationsPredicate = AnyAnnotations, methodPredicate: SourceElementPredicate[Method] = AnyMethod) extends SourceElementsMatcher with Product with Serializable

    Permalink

    Matches methods based on their attributes, annotations and class.

  20. case class MethodWithName(name: String) extends SourceElementPredicate[Method] with Product with Serializable

    Permalink

  21. case class MethodWithSignature(name: String, descriptor: MethodDescriptor) extends SourceElementPredicate[Method] with Product with Serializable

    Permalink

  22. trait NamePredicate extends (String) ⇒ Boolean

    Permalink

    Matches a (binary) name of a file, method or class.

  23. case class PackageMatcher(namePredicate: NamePredicate, classMatcher: ClassMatcher) extends ClassLevelMatcher with Product with Serializable

    Permalink

    Matches all classes in the specified package.

  24. trait PropertyChecker extends ArchitectureChecker

    Permalink

    A property checker validates if the elements of an ensemble have the expected/specified properties.

  25. case class PropertyViolation(project: SomeProject, propertyChecker: PropertyChecker, source: VirtualSourceElement, propertyType: String, description: String) extends SpecificationViolation with Product with Serializable

    Permalink

    Used to report source elements that have properties that deviate from the expected ones.

  26. case class RegexNamePredicate(matcher: Regex) extends NamePredicate with Product with Serializable

    Permalink

    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.

  27. trait SourceElementPredicate[-S <: ConcreteSourceElement] extends (S) ⇒ Boolean

    Permalink

    A predicate related to a specific source element.

  28. trait SourceElementsMatcher extends (SomeProject) ⇒ Set[VirtualSourceElement]

    Permalink

    A source element matcher determines a set of source elements that matches a given query.

  29. class Specification extends AnyRef

    Permalink

    A specification of a project's architectural constraints.

    A specification of a project's architectural constraints.

    Usage

    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)
          }
    Note

    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.

  30. case class SpecificationError(description: String) extends Exception with Product with Serializable

    Permalink

    Used to report errors in the specification itself.

  31. sealed trait SpecificationViolation extends AnyRef

    Permalink

    Used to report deviations between the specified and the implemented architecture.

  32. case class StartsWith(name: BinaryString) extends NamePredicate with Product with Serializable

    Permalink

Value Members

  1. object AllClasses extends ClassMatcher with Product with Serializable

    Permalink

    Matches all project and library classes including inner elements like methods and fields defined by the respective classes.

  2. object AnnotatedWith extends Serializable

    Permalink

    Defines several additional factory methods to facilitate the creation of AnnotationPredicates.

  3. object AnyAnnotation extends AnnotationPredicate with Product with Serializable

    Permalink

    An annotation matcher that always returns true; it matches any annotation.

  4. object AnyAnnotations extends AnnotationsPredicate with Product with Serializable

    Permalink

  5. object AnyMethod extends SourceElementPredicate[Method] with Product with Serializable

    Permalink

  6. object BinaryString

    Permalink
  7. object ClassMatcher

    Permalink

    Defines several additional factory methods to facilitate the creation of ClassMatchers.

  8. object FieldMatcher extends Serializable

    Permalink

    Defines several additional factory methods to facilitate the creation of FieldMatchers.

  9. object HasAnnotation extends Serializable

    Permalink

    Factory methods to create AnnotatedWith predicates.

  10. object HasAtLeastTheAnnotations extends Serializable

    Permalink
  11. object HasTheAnnotations extends Serializable

    Permalink
  12. object MethodMatcher extends Serializable

    Permalink

    Defines several additional factory methods to facilitate the creation of MethodMatchers.

  13. object NoAnnotations extends AnnotationsPredicate with Product with Serializable

    Permalink

  14. object NoSourceElementsMatcher extends SourceElementsMatcher with Product with Serializable

    Permalink

    A source element matcher that matches no elements.

  15. object PackageMatcher extends Serializable

    Permalink

    Defines several additional factory methods to facilitate the creation of PackageMatchers.

  16. object Specification

    Permalink
  17. implicit def StringToBinaryString(string: String): BinaryString

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped