Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The SmartComponent Library provides a utility to scan for class and class member annotations in the form of a Progress procedure which can be executed from an ANT / PCT task.

Seehttp https://jakejustus.github.iocom/Riverside-Software/pct/ for  for details on PCT.

This utility scans class files (source code) in a given directory with a given file make for annotations. For every class with given annotations the utility writes a .annotation file. This file must be available at runtime, so that the annotation data can be made accessible at runtime.

The procedure Consultingwerk/Studio/ExtractClassAnnotations/extract-class-annotations.p can be started from an PCTRun task with the following paramters:

Parameter NameDescription

directory

The directory to scan for classes

fileMask

The file mask to scan

excludeAnnotations

Comma delimited list of annotations to ignore

overwriteWriteProtected

Overwrite of write protected .annotation files

verbose

Verbose output

assemblies-assemblies Parameter
tempDir-T Parameter (session temp-directory)
cpinternal-cpinternal (iso8859-1 default)
cpstream-cpinternal (iso8859-1 default)
iniFileSession ini file

The ANT script in Consultingwerk/Studio/ExtractClassAnnotations/extract-class-annotations.xml (attached: extract-class-annotations.xml) provides a sample ANT macro script to invoke the annotation scanner. 

...

The result is a ClassAnnotationContainer instance with the following properties:

Property NameDescription

ClassName

Name of the Class File

TimeStamp

Date when Annotations have been extracted

Annotations

The List of Annotations of the class

Constructors

The List of Constructor type class members with annotations

Destructor

The Destructor type class member when it has annotations

Events

The List of Event type class members with annotations

Methods

The List of Method type class members with annotations

Properties

The List of Property type class members with annotations

For every class member a SerializableClassMemberAnnotation instance is returned as entries in one of the lists:

Property Name

Description

Name

The Name of the class member

Annotations

The List of Annotations of the class member

For every annotation a SerializableAnnotation instance is returned:

Property Name

Description

Name

The Name of the annotation

Parameters

The ListNameValuePair with the parameters of the annotation

The IClassAnnotationProvider provides caching of the annotations to improve the runtime performance when accessing the annotations of classes. To clear the cache the ClearCache() method is provided.

...