Generated Classes
Arez generates one or more classes for every Arez component. The classes generated are:
The Generated Component Subclass
The generated component subclass extends the @ArezComponent annotated class
and adds reactive capabilities.
The class has the same name as the Arez component prefixed with Arez_. i.e. If the name of the
Arez component class is com.example.MyComponent then the generated component subclass would be named
com.example.Arez_MyComponent. If the @ArezComponent annotated class is
not a top-level type, the generated component subclass name will be include its enclosing types names,
joined with an underscore. For example, this code:
public class MyContainer
{
@ArezComponent
public static abstract class MyComponent
{
...
}
}
would generate an component subclass named MyContainer_Arez_MyComponent.
The access level of the generated component subclass is package access. If the lifecycle of the component is not managed by a dependency injection framework then it is suggested that one or more static factory methods are defined such as in the following example:
@ArezComponent
public abstract class MyComponent
{
public static MyComponent create()
{
return new Arez_MyComponent();
}
MyComponent()
{
}
...
}
The generated component subclass also implements the following interfaces; Disposable,
Identifiable} and ComponentObservable.
- The
Disposableinterface provides a mechanism to decommission the component and release any resources associated with the component. - The
Identifiable} interface exposes the underlying identifier used by the Arez system to uniquely identify the component instance of this particular type. - The
ComponentObservableallows observers to observe the component without observing a particular property of the component. This is typically used in conjunction with the@ArezComponent.disposeOnDeactivateparameter to ensure a component is kept alive while it is in use.