net.sf.staccatocommons.restrictions
Annotation Type Conditionally


@Documented
@Inherited
@Restriction
@Retention(value=SOURCE)
@Target(value={TYPE,METHOD})
public @interface Conditionally

Conditionally is a restriction modifier that indicates that an objects may meet set of restrictions depending on some condition. There are two standard scenarios:

  1. When the object's class has generic type parameter, and the set of restrictions depend on the concrete type used
  2. When the object has as configurable attributes - subject to dependency injection - and the type of such attributes does not make any assumptions about such restrictions, perhaps they are specified in its subtypes or it depends on instances

Types annotated as Conditionally denote that all their instances grant to conditionally meet the set constraints, depending on the attributes injected by constructor or setters, or in its constructor type parameters. Methods annotated as Unmodifiable denote that all the objects returned by them conditionally meet the set constraints, depending on the method type parametrization, the receptor object this and arguments.

Typical example of @Conditionally(Immutable.class) objects are Lists returned by Collections.singletonList(Object), which are immutable as long as its argument is immutable too.

Author:
flbulgarelli

Required Element Summary
 Class[] value
          An array with interfaces and/or restriction annotations
 

Element Detail

value

public abstract Class[] value
An array with interfaces and/or restriction annotations



Copyright © 2010-2012 StaccatoCommons. All Rights Reserved.