GriffonMvcArtifact.java
01 /*
02  * Copyright 2008-2016 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 package griffon.core.artifact;
17 
18 import griffon.core.mvc.MVCGroup;
19 
20 import javax.annotation.Nonnull;
21 import java.util.Map;
22 
23 /**
24  * Identifies an artifact that belongs to an MVC group.<p>
25  *
26  @author Andres Almiray
27  @since 2.0.0
28  */
29 public interface GriffonMvcArtifact extends GriffonArtifact {
30     /**
31      * Post initialization callback.<p>
32      * This callback is called for all artifacts that belong to the
33      * same MVC group right after each instance has been created.
34      * Each entry on the <tt>args</tt> Map points either to an MVC
35      * member or a variable that was defined using any of the {@code createMVCGroup}
36      * and/or {@code createMVC} methods that can take a Map as parameter.
37      *
38      @param args a Map of MVC instances or variables keyed by type.
39      */
40     void mvcGroupInit(@Nonnull Map<String, Object> args);
41 
42     /**
43      * Callback for when the group is destroyed and disposed from the application.<p>
44      * Once an artifact has been "destroyed" it should not be used anymore. The application
45      * will remove any references to the group on its cache.
46      */
47     void mvcGroupDestroy();
48 
49     @Nonnull
50     MVCGroup getMvcGroup();
51 }