org.faktorips.fl.DefaultFunctionResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of faktorips-fl Show documentation
Show all versions of faktorips-fl Show documentation
Formula language for the Faktor-IPS design time tools
/*******************************************************************************
* Copyright (c) Faktor Zehn GmbH - faktorzehn.org
*
* This source code is available under the terms of the AGPL Affero General Public License version
* 3.
*
* Please see LICENSE.txt for full license terms, including the additional permissions and
* restrictions as well as the possibility of alternative license terms.
*******************************************************************************/
package org.faktorips.fl;
import java.util.ArrayList;
import java.util.List;
import org.faktorips.codegen.CodeFragment;
import org.faktorips.util.ArgumentCheck;
/**
* A default {@link FunctionResolver}.
*
* @param a {@link CodeFragment} implementation for a specific target language
*/
public class DefaultFunctionResolver implements FunctionResolver {
// list of supported FlFunction
private List> functions = new ArrayList<>();
/**
* Creates a new resolver.
*/
public DefaultFunctionResolver() {
// nothing to do
}
/**
* Adds the {@link FlFunction}.
*
* @throws IllegalArgumentException if function is {@code null}.
*/
public void add(FlFunction function) {
ArgumentCheck.notNull(function);
functions.add(function);
}
/**
* Removes the {@link FlFunction} from the resolver. Does nothing if the function hasn't been
* added before.
*
* @throws IllegalArgumentException if function is {@code null}.
*/
public void remove(FlFunction function) {
ArgumentCheck.notNull(function);
functions.remove(function);
}
@Override
public FlFunction[] getFunctions() {
@SuppressWarnings("unchecked")
FlFunction[] flFunctions = new FlFunction[functions.size()];
return functions.toArray(flFunctions);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy