Framework JPA

for JavaEE environment

Julia will translate the JPA annotations into its own, marking new methods as entry points and keeping trace of which fields may be read or injected from the external environment.

Required libraries: javax.persistence.jar

Applicability

This specification gets automatically applied when:

  • the framework of the analysis contains the word java (case insensitive)
  • there exists an annotation that starts with javax.persistence


Implications between annotations

Some annotations of this framework get translated automatically into standard Julia annotations, such that the analysis engine can react accordingly. Namely:

  • if an element is annotated with javax.persistence.PostLoad, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with javax.persistence.PostPersist, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with javax.persistence.PostRemove, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with javax.persistence.PostUpdate, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with javax.persistence.PrePersist, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with javax.persistence.PreRemove, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with javax.persistence.PreUpdate, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint


Predicates

Predicates are named conditions that can be used inside other conditions. This framework defines the following predicates:

  • predicate isAccessor is defined as follows:
      (satisfies predicate isGetter or satisfies predicate isSetter)
  • predicate isClassAnnotatedWithFieldAccess is defined as follows:
      is defined in a class that has an annotation (whose name is equal to javax.persistence.Access and whose value of option value is equal to javax.persistence.AccessType.FIELD)
  • predicate isClassAnnotatedWithMethodAccess is defined as follows:
      that is defined in a class that has an annotation (whose name is equal to javax.persistence.Access and whose value of option value is equal to javax.persistence.AccessType.PROPERTY)
  • predicate isFieldAnnotatedWithFieldAccess is defined as follows:
      has an annotation (whose name is equal to javax.persistence.Access and whose value of option value is equal to javax.persistence.AccessType.FIELD)
  • predicate isGetter is defined as follows:
      (whose name starts with get and (whose return type (not is equal to void) and that has a number of parameters is equal to 0))
  • predicate isMethodAnnotatedWithMethodAccess is defined as follows:
      that has an annotation (whose name is equal to javax.persistence.Access and whose value of option value is equal to javax.persistence.AccessType.PROPERTY)
  • predicate isSetter is defined as follows:
      (whose name starts with set and (whose return type is equal to void and that has a number of parameters is equal to 1))


Specifications on application code

These are conditions that, if satisfied on a given program component, will cause the specified annotations to be placed on such component. These will annotate only program components coming from the application under analysis, and not the libraries. This framework defines the following specifications:

  • annotate any method that satisfies the following:
      ((satisfies predicate isClassAnnotatedWithMethodAccess or satisfies predicate isMethodAnnotatedWithMethodAccess) and satisfies predicate isAccessor)
    with:
    • com.juliasoft.julia.extraction.EntryPoint
  • annotate any field that satisfies the following:
      (satisfies predicate isClassAnnotatedWithFieldAccess or satisfies predicate isFieldAnnotatedWithFieldAccess)
    with:
    • com.juliasoft.julia.extraction.ExternallyRead
    • com.juliasoft.julia.extraction.Injected