| 
01 /*02  * Copyright 2008-2015 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 org.codehaus.griffon.runtime.core.mvc;
 17
 18 import griffon.core.mvc.MVCGroup;
 19 import griffon.core.mvc.MVCGroupManager;
 20
 21 import javax.annotation.Nonnull;
 22 import javax.annotation.Nullable;
 23 import javax.inject.Inject;
 24 import java.util.Map;
 25
 26 import static java.util.Objects.requireNonNull;
 27
 28 /**
 29  * Default implementation of the {@code MVCGroupConfiguration} interface
 30  *
 31  * @author Andres Almiray
 32  * @since 2.0.0
 33  */
 34 public class DefaultMVCGroupConfiguration extends AbstractMVCGroupConfiguration {
 35     private final MVCGroupManager mvcGroupManager;
 36
 37     @Inject
 38     public DefaultMVCGroupConfiguration(@Nonnull MVCGroupManager mvcGroupManager, @Nonnull String mvcType, @Nonnull Map<String, String> members, @Nonnull Map<String, Object> config) {
 39         super(mvcType, members, config);
 40         this.mvcGroupManager = requireNonNull(mvcGroupManager, "Argument 'mvcGroupManager' must not be null");
 41     }
 42
 43     public MVCGroupManager getMvcGroupManager() {
 44         return mvcGroupManager;
 45     }
 46
 47     @Nonnull
 48     @Override
 49     protected MVCGroup instantiateMVCGroup(@Nullable String mvcId, @Nonnull Map<String, Object> args) {
 50         return getMvcGroupManager().createMVCGroup(getMvcType(), mvcId, args);
 51     }
 52 }
 |