com.surelogic
Annotation Type Region


@Documented
@Target(value=TYPE)
public @interface Region

Declares a new abstract region of state for the class to which this annotation is applied. To declare more than one region for a class use the Regions annotation.

It is a modeling error for a class to have both a Regions and a Region annotation.

Examples:

A region, named ObserverRegion, that includes the contents of the set observers.
 @Region("private ObserverRegion")
 class Observer {
   @Unique
   @Aggregate("Instance into ObserverRegion")
   private final Set<Callback> observers = new HashSet<Callback>()
   ...
 }
 
A region, named AircraftState, that contains three long fields use to represent the position of the object.
 @Region("private AircraftState")
 public class Aircraft {
   @InRegion("AircraftState")
   private long x, y;
   
   @InRegion("AircraftState")
   private long altitude;
   ...
 }
 
A region, named ThingState, that contains two long fields use to represent the position of a subclass. ThingState is empty in the parent class Thing but has state added into it in the subclass Player.
 @Region("protected ThingState")
 class Thing {
   ...
 }
 
 class Player extends Thing {
   @InRegion("ThingState")
   private long x, y;
   ...
 }
 

Javadoc usage notes:

This annotation may placed in Javadoc, which can be useful for Java 1.4 code which does not include language support for annotations, via the @annotate tag.
 /**
  * @annotate Region("private AircraftState")
  */
 public class Aircraft {
   /**
    * @annotate InRegion("AircraftState")
    */
   private long x, y;
   
   /**
    * @annotate InRegion("AircraftState")
    */
   private long altitude;
   ...
 }
 

See Also:
Aggregate, AggregateInRegion, InRegion, Regions

Required Element Summary
 String value
          The value of this attribute must conform to the following grammar (in Augmented Backus–Naur Form):
 

Element Detail

value

public abstract String value
The value of this attribute must conform to the following grammar (in Augmented Backus–Naur Form):
 value = accessModifiers IDENTIFIER ["extends" regionSpecification]
   
 accessModifiers = ["public" / "protected" / "private"] [static]
 
 regionSpecification = simpleRegionSpecificaion / qualifiedRegionName
 
 simpleRegionSpecification = IDENTIFIER / "[" "]"  ; Region of the class being annotated
 
 qualifedRegionName = IDENTIFIER *("." IDENTIFIER) : IDENTIFER  ; Static region from the named, optionally qualified, class

 IDENTIFIER = Legal Java Identifier
 

As in Java, if neither public, protected, or private is declared then the region has default visibility; if static is not declared the region is an instance region.

If no explicit "extends" clause is provided the region extends from region Instance if it is an instance region, or All if it is a static region.



Copyright © 2010 Surelogic, Inc.. All Rights Reserved.