ActionDecorator.java
001 /*
002  * Copyright 2008-2017 the original author or authors.
003  *
004  * Licensed under the Apache License, Version 2.0 (the "License");
005  * you may not use this file except in compliance with the License.
006  * You may obtain a copy of the License at
007  *
008  *     http://www.apache.org/licenses/LICENSE-2.0
009  *
010  * Unless required by applicable law or agreed to in writing, software
011  * distributed under the License is distributed on an "AS IS" BASIS,
012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013  * See the License for the specific language governing permissions and
014  * limitations under the License.
015  */
016 package org.codehaus.griffon.runtime.core.controller;
017 
018 import griffon.core.artifact.GriffonController;
019 import griffon.core.controller.Action;
020 import griffon.core.controller.ActionManager;
021 import griffon.core.controller.ActionMetadata;
022 
023 import javax.annotation.Nonnull;
024 import javax.annotation.Nullable;
025 
026 import static java.util.Objects.requireNonNull;
027 
028 /**
029  @author Andres Almiray
030  @since 2.2.0
031  */
032 public class ActionDecorator implements Action {
033     private final Action delegate;
034 
035     public ActionDecorator(@Nonnull Action delegate) {
036         this.delegate = requireNonNull(delegate, "Argument 'delegate' must not be null");
037     }
038 
039     @Nonnull
040     @Override
041     public ActionMetadata getActionMetadata() {
042         return delegate.getActionMetadata();
043     }
044 
045     @Nonnull
046     @Override
047     public String getActionName() {
048         return delegate.getActionName();
049     }
050 
051     @Nonnull
052     @Override
053     public String getFullyQualifiedName() {
054         return delegate.getFullyQualifiedName();
055     }
056 
057     @Nullable
058     @Override
059     public String getName() {
060         return delegate.getName();
061     }
062 
063     @Override
064     public void setName(@Nullable String name) {
065         delegate.setName(name);
066     }
067 
068     @Override
069     public boolean isEnabled() {
070         return delegate.isEnabled();
071     }
072 
073     @Override
074     public void setEnabled(boolean enabled) {
075         delegate.setEnabled(enabled);
076     }
077 
078     @Nonnull
079     @Override
080     public ActionManager getActionManager() {
081         return delegate.getActionManager();
082     }
083 
084     @Nonnull
085     @Override
086     public GriffonController getController() {
087         return delegate.getController();
088     }
089 
090     @Nonnull
091     @Override
092     public Object getToolkitAction() {
093         return delegate.getToolkitAction();
094     }
095 
096     @Override
097     public void execute(Object... args) {
098         delegate.execute(args);
099     }
100 
101     @Override
102     public void initialize() {
103         delegate.initialize();
104     }
105 }