MVCAware.java
01 /*
02  * Copyright 2009-2012 the original author or authors.
03  *
04  * Licensed under the Apache License, Version 2.0 (the "License");
05  * you may not use this file except in compliance with the License.
06  * You may obtain a copy of the License at
07  *
08  *     http://www.apache.org/licenses/LICENSE-2.0
09  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package griffon.transform;
18 
19 import org.codehaus.groovy.transform.GroovyASTTransformationClass;
20 
21 import java.lang.annotation.ElementType;
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.RetentionPolicy;
24 import java.lang.annotation.Target;
25 
26 /**
27  * <p>Annotates a class.</p>
28  * <p/>
29  * <p>When annotating a class it indicates that it will be able to
30  * handle MVC groups, that is, instantiate them. The class will have
31  * the ability to create new instances of MVC groups, including short-lived
32  * ones.</p>
33  * <p/>
34  * The following methods will be added to classes annotated with &#064;MVCAware
35  * <ul>
36  * <p/>
37  * <li><code>public Map&lt;String, Object&gt; buildMVCGroup(String mvcType)</code></li>
38  * <li><code>public Map&lt;String, Object&gt; buildMVCGroup(String mvcType, String mvcName)</code></li>
39  * <li><code>public Map&lt;String, Object&gt; buildMVCGroup(Map&lt;String, Object&gt; args, String mvcType)</code></li>
40  * <li><code>public Map&lt;String, Object&gt; buildMVCGroup(String mvcType, Map&lt;String, Object&gt; args)</code></li>
41  * <li><code>public Map&lt;String, Object&gt; buildMVCGroup(Map&lt;String, Object&gt; args, String mvcType, String mvcName)</code></li>
42  * <li><code>public Map&lt;String, Object&gt; buildMVCGroup(String mvcType, String mvcName, Map&lt;String, Object&gt; args)</code></li>
43  * <li><code>public List&lt;? extends GriffonMvcArtifact&gt; createMVCGroup(String mvcType)</code></li>
44  * <li><code>public List&lt;? extends GriffonMvcArtifact&gt; createMVCGroup(Map&lt;String, Object&gt; args, String mvcType)</code></li>
45  * <li><code>public List&lt;? extends GriffonMvcArtifact&gt; createMVCGroup(String mvcType, Map&lt;String, Object&gt; args)</code></li>
46  * <li><code>public List&lt;? extends GriffonMvcArtifact&gt; createMVCGroup(String mvcType, String mvcName)</code></li>
47  * <li><code>public List&lt;? extends GriffonMvcArtifact&gt; createMVCGroup(Map&lt;String, Object&gt; args, String mvcType, String mvcName)</code></li>
48  * <li><code>public List&lt;? extends GriffonMvcArtifact&gt; createMVCGroup(String mvcType, String mvcName, Map&lt;String, Object&gt; args)</code></li>
49  * <li><code>public void destroyMVCGroup(String mvcName)</code></li>
50  * <li><code>public void withMVCGroup(String mvcType, Closure handler)</code></li>
51  * <li><code>public void withMVCGroup(String mvcType, String mvcName, Closure handler)</code></li>
52  * <li><code>public void withMVCGroup(String mvcType, String mvcName, Map&lt;String, Object&gt; args, Closure handler)</code></li>
53  * <li><code>public void withMVCGroup(Map&lt;String, Object&gt; args, String mvcType, String mvcName, Closure handler)</code></li>
54  * <li><code>public void withMVCGroup(String mvcType, Map&lt;String, Object&gt; args, Closure handler)</code></li>
55  * <li><code>public void withMVCGroup( Object&gt; args, String mvcType, Map&lt;String,Closure handler)</code></li>
56  * <li><code>public &lt;M extends GriffonModel, V extends GriffonView, C extends GriffonController&gt; void withMVCGroup(String mvcType, MVCClosure&lt;M, V, C&gt; handler)</code></li>
57  * <li><code>public &lt;M extends GriffonModel, V extends GriffonView, C extends GriffonController&gt; void withMVCGroup(String mvcType, String mvcName, MVCClosure&lt;M, V, C&gt; handler)</code></li>
58  * <li><code>public &lt;M extends GriffonModel, V extends GriffonView, C extends GriffonController&gt; void withMVCGroup(String mvcType, String mvcName, Map&lt;String, Object&gt; args, MVCClosure&lt;M, V, C&gt; handler)</code></li>
59  * <li><code>public &lt;M extends GriffonModel, V extends GriffonView, C extends GriffonController&gt; void withMVCGroup(Map&lt;String, Object&gt; args, String mvcType, String mvcName, MVCClosure&lt;M, V, C&gt; handler)</code></li>
60  * <li><code>public &lt;M extends GriffonModel, V extends GriffonView, C extends GriffonController&gt; void withMVCGroup(String mvcType, Map&lt;String, Object&gt; args, MVCClosure&lt;M, V, C&gt; handler)</code></li>
61  * <p/>
62  * <li><code>public &lt;M extends GriffonModel, V extends GriffonView, C extends GriffonController&gt; void withMVCGroup(Map&lt;String, Object&gt; args, String mvcType, MVCClosure&lt;M, V, C&gt; handler)</code></li>
63  * <p/>
64  * </ul>
65  *
66  * @author Andres Almiray
67  * @see griffon.core.MVCHandler
68  * @see org.codehaus.griffon.ast.MVCAwareASTTransformation
69  * @since 0.9.3
70  */
71 @Retention(RetentionPolicy.SOURCE)
72 @Target({ElementType.TYPE})
73 @GroovyASTTransformationClass("org.codehaus.griffon.ast.MVCAwareASTTransformation")
74 public @interface MVCAware {
75 }