org.ow2.mind.AbstractDelegatingVoidVisitor Maven / Gradle / Ivy
/**
* Copyright (C) 2009 STMicroelectronics
*
* This file is part of "Mind Compiler" is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Contact: [email protected]
*
* Authors: Matthieu Leclercq
* Contributors:
*/
package org.ow2.mind;
import static org.ow2.mind.BindingControllerImplHelper.checkItfName;
import static org.ow2.mind.BindingControllerImplHelper.listFcHelper;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.BindingController;
import org.objectweb.fractal.api.control.IllegalBindingException;
public abstract class AbstractDelegatingVoidVisitor
implements
VoidVisitor,
BindingController {
// --------------------------------------------------------------------------
// Client interfaces
// --------------------------------------------------------------------------
/** The name of the {@link Visitor} client interface of this component. */
public static final String CLIENT_VISITOR = "client-visitor";
public VoidVisitor clientVisitorItf;
// --------------------------------------------------------------------------
// Implementation of the BindingController interface
// --------------------------------------------------------------------------
public void bindFc(final String itfName, final Object value)
throws NoSuchInterfaceException, IllegalBindingException {
checkItfName(itfName);
if (itfName.equals(CLIENT_VISITOR)) {
clientVisitorItf = (VoidVisitor) value;
} else {
throw new NoSuchInterfaceException("No client interface named '"
+ itfName + "'");
}
}
public String[] listFc() {
return listFcHelper(CLIENT_VISITOR);
}
public Object lookupFc(final String itfName) throws NoSuchInterfaceException {
checkItfName(itfName);
if (itfName.equals(CLIENT_VISITOR)) {
return clientVisitorItf;
} else {
throw new NoSuchInterfaceException("No client interface named '"
+ itfName + "'");
}
}
public void unbindFc(final String itfName) throws NoSuchInterfaceException,
IllegalBindingException {
checkItfName(itfName);
if (itfName.equals(CLIENT_VISITOR)) {
clientVisitorItf = null;
} else {
throw new NoSuchInterfaceException("No client interface named '"
+ itfName + "'");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy