Class/Object

org.opalj.fpcf.analysis

FactoryMethodAnalysis

Related Docs: object FactoryMethodAnalysis | package analysis

Permalink

class FactoryMethodAnalysis extends FPCFAnalysis

This analysis identifies a project's factory methods.

A method is no factory method if:

This information is relevant in various contexts, e.g., to determine the instantiability of a class.

Usage

Use the FPCFAnalysesManagerKey to query the analysis manager of a project. You can run the analysis afterwards as follows:

val analysisManager = project.get(FPCFAnalysisManagerKey)
analysisManager.run(FactoryMethodAnalysis)

For detailed information see the documentation of the analysis manager.

The results of this analysis are stored in the property store of the project. You can receive the results as follows:

val theProjectStore = theProject.get(SourceElementsPropertyStoreKey)
val factoryMethods = theProjectStore.entities { (p: Property) ⇒
p == IsFactoryMethod
}
Note

Native methods are considered as factory methods because they might instantiate the class.

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

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. implicit final val classHierarchy: ClassHierarchy

    Permalink
    Definition Classes
    FPCFAnalysis
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def determineProperty(method: Method): PropertyComputationResult

    Permalink

    Determines if the given method is a factory method.

    Determines if the given method is a factory method. Any native method is considered as factory method, because we have to assume, that it creates an instance of the class. This checks not for effective factory methods, since the return type of the method is ignored. A method is either native or the constructor of the declaring class is invoked.

    Possible improvements:

    • check if the method returns an instance of the class or some superclass.
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isClosedLibrary: Boolean

    Permalink
    Definition Classes
    FPCFAnalysis
  14. final def isDesktopApplication: Boolean

    Permalink
    Definition Classes
    FPCFAnalysis
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def isJEEApplication: Boolean

    Permalink
    Definition Classes
    FPCFAnalysis
  17. final def isOpenLibrary: Boolean

    Permalink
    Definition Classes
    FPCFAnalysis
  18. implicit final val logContext: LogContext

    Permalink
    Definition Classes
    FPCFAnalysis
  19. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. val project: SomeProject

    Permalink
    Definition Classes
    FactoryMethodAnalysisFPCFAnalysis
  23. implicit final val propertyStore: PropertyStore

    Permalink
    Definition Classes
    FPCFAnalysis
  24. final def ps: PropertyStore

    Permalink
    Definition Classes
    FPCFAnalysis
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from FPCFAnalysis

Inherited from AnyRef

Inherited from Any

Ungrouped