Packages

t

org.opalj.br.analyses

ProjectInformationKey

trait ProjectInformationKey[T <: AnyRef, I <: AnyRef] extends AnyRef

ProjecInformationKey objects are used to get/associate some (immutable) information with a project that should be computed on demand. For example, imagine that you write an analysis that requires – as a foundation – the project's call graph. In this case, to get the call graph it is sufficient to pass the respective key to the Project object. If the call graph was already computed that one will be returned, otherwise the computation will be performed and the result will be cached for future usage before it is returned.

Using Project Information

If access to some project information is required, it is sufficient to use the (singleton) instance of the respective ProjectInformationKey to get the respective project information.

For example, let's assume that an index of all fields and methods is needed. In this case the code to get the index would be:

import ...{ProjectIndex,ProjectIndexKey}
val project : Project = ???
val projectIndex = project.get(ProjectIndexKey)
// do something with the index

Providing Project Information/Implementing ProjectInformationKey

Making project wide information available on demand is done as follows.

  1. Implement the base analysis that computes the information given some project.
  2. Implement your ProjectInformationKey class that inherits from this trait and which calls the base analysis. It is recommended that the factory method (compute) is side-effect free.
Threading

Project takes care of threading related issues. The methods requirements and compute will never be called concurrently w.r.t. the same project object. However, concurrent calls may happen w.r.t. two different project objects.

Caching

Project takes care of the caching of the result of the computation of the information.

T

The type of the information object that is derived.

I

The type of information used at initialization time.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ProjectInformationKey
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def compute(project: SomeProject): T

    Computes the information for the given project.

    Computes the information for the given project.

    Attributes
    protected
    Note

    Classes that inherit from this trait are not expected to make this method public. This method is only expected to be called by an instance of a Project.

  2. abstract def requirements: ProjectInformationKeys

    Returns the information which other project information need to be available before this analysis can be performed.

    Returns the information which other project information need to be available before this analysis can be performed.

    If the analysis has no special requirements Nil can be returned.

    Attributes
    protected
    Note

    All requirements must be listed; failing to specify a requirement can result in a deadlock.

    ,

    Classes/Objects that implement this trait should not make the method public to avoid that this method is called accidentally by regular user code.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final val uniqueId: Int

    The unique id of this key.

    The unique id of this key. The key is used to enable efficient access and is automatically assigned by OPAL and will not change after that.

  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped