/*
* Copyright 2008-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.griffon.runtime.core.artifact;
import griffon.core.GriffonApplication;
import griffon.core.artifact.GriffonController;
import griffon.core.artifact.GriffonModel;
import griffon.core.artifact.GriffonMvcArtifact;
import griffon.core.artifact.GriffonView;
import griffon.core.mvc.MVCFunction;
import griffon.core.mvc.MVCGroup;
import griffon.core.mvc.MVCGroupFunction;
import griffon.inject.MVCMember;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.List;
import java.util.Map;
import static java.util.Objects.requireNonNull;
/**
* Base implementation of the GriffonMvcArtifact interface.
*
* @author Andres Almiray
* @since 2.0.0
*/
public abstract class AbstractGriffonMvcArtifact extends AbstractGriffonArtifact implements GriffonMvcArtifact {
private MVCGroup group;
public AbstractGriffonMvcArtifact() {
}
/**
* Creates a new instance of this class.
*
* @param application the GriffonApplication that holds this artifact.
*
* @deprecated Griffon prefers field injection over constructor injector for artifacts as of 2.1.0
*/
@Inject
@Deprecated
public AbstractGriffonMvcArtifact(@Nonnull GriffonApplication application) {
super(application);
}
@MVCMember
public void setMvcGroup(@Nonnull MVCGroup group) {
this.group = requireNonNull(group, "Argument 'group' must not be null");
}
@Nonnull
@Override
public MVCGroup getMvcGroup() {
return group;
}
public void mvcGroupInit(@Nonnull Map<String, Object> args) {
// empty
}
public void mvcGroupDestroy() {
// empty
}
@Nonnull
@Override
public MVCGroup createMVCGroup(@Nonnull Map<String, Object> args, @Nonnull String mvcType) {
return group.createMVCGroup(args, mvcType);
}
@Nonnull
@Override
public MVCGroup createMVCGroup(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull String mvcId) {
return group.createMVCGroup(args, mvcType, mvcId);
}
@Nonnull
@Override
public MVCGroup createMVCGroup(@Nonnull String mvcType) {
return group.createMVCGroup(mvcType);
}
@Nonnull
@Override
public MVCGroup createMVCGroup(@Nonnull String mvcType, @Nonnull Map<String, Object> args) {
return group.createMVCGroup(mvcType, args);
}
@Nonnull
@Override
public MVCGroup createMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId) {
return group.createMVCGroup(mvcType, mvcId);
}
@Nonnull
@Override
public MVCGroup createMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args) {
return group.createMVCGroup(mvcType, mvcId, args);
}
@Nonnull
@Override
public List<? extends GriffonMvcArtifact> createMVC(@Nonnull Map<String, Object> args, @Nonnull String mvcType) {
return group.createMVC(args, mvcType);
}
@Nonnull
@Override
public List<? extends GriffonMvcArtifact> createMVC(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull String mvcId) {
return group.createMVC(args, mvcType, mvcId);
}
@Nonnull
@Override
public List<? extends GriffonMvcArtifact> createMVC(@Nonnull String mvcType) {
return group.createMVC(mvcType);
}
@Nonnull
@Override
public List<? extends GriffonMvcArtifact> createMVC(@Nonnull String mvcType, @Nonnull Map<String, Object> args) {
return group.createMVC(mvcType, args);
}
@Nonnull
@Override
public List<? extends GriffonMvcArtifact> createMVC(@Nonnull String mvcType, @Nonnull String mvcId) {
return group.createMVC(mvcType, mvcId);
}
@Nonnull
@Override
public List<? extends GriffonMvcArtifact> createMVC(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args) {
return group.createMVC(mvcType, mvcId, args);
}
@Override
public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull MVCFunction<M, V, C> handler) {
group.withMVC(args, mvcType, handler);
}
@Override
public void withMVCGroup(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull MVCGroupFunction handler) {
group.withMVCGroup(args, mvcType, handler);
}
@Override
public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCFunction<M, V, C> handler) {
group.withMVC(args, mvcType, mvcId, handler);
}
@Override
public void withMVCGroup(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCGroupFunction handler) {
group.withMVCGroup(args, mvcType, mvcId, handler);
}
@Override
public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull Map<String, Object> args, @Nonnull MVCFunction<M, V, C> handler) {
group.withMVC(mvcType, args, handler);
}
@Override
public void withMVCGroup(@Nonnull String mvcType, @Nonnull Map<String, Object> args, @Nonnull MVCGroupFunction handler) {
group.withMVCGroup(mvcType, args, handler);
}
@Override
public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull MVCFunction<M, V, C> handler) {
group.withMVC(mvcType, handler);
}
@Override
public void withMVCGroup(@Nonnull String mvcType, @Nonnull MVCGroupFunction handler) {
group.withMVCGroup(mvcType, handler);
}
@Override
public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args, @Nonnull MVCFunction<M, V, C> handler) {
group.withMVC(mvcType, mvcId, args, handler);
}
@Override
public void withMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args, @Nonnull MVCGroupFunction handler) {
group.withMVCGroup(mvcType, mvcId, args, handler);
}
@Override
public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCFunction<M, V, C> handler) {
group.withMVC(mvcType, mvcId, handler);
}
@Override
public void withMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCGroupFunction handler) {
group.withMVCGroup(mvcType, mvcId, handler);
}
}