class DerivedFieldFunctionUtils {

    static MethodDeclaration getExpressionMethodDeclaration(final Expression expression, final DataType dataType,
                                                            final AtomicInteger arityCounter) {
        final ClassOrInterfaceType returnedType = parseClassOrInterfaceType(getBoxedClassName(dataType));
        int methodArity = arityCounter.addAndGet(1);
        if (expression instanceof Aggregate) {
            return getAggregatedMethodDeclaration((Aggregate) expression, returnedType, methodArity,
                                                  DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof Apply) {
            return getApplyMethodDeclaration((Apply) expression, returnedType, methodArity, DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof Constant) {
            return getConstantMethodDeclaration((Constant) expression, returnedType, methodArity, DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof Discretize) {
            return getDiscretizeMethodDeclaration((Discretize) expression, returnedType, methodArity,
                                                  DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof FieldRef) {
            return getFieldRefMethodDeclaration((FieldRef) expression, returnedType, methodArity, DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof Lag) {
            return getLagMethodDeclaration((Lag) expression, returnedType, methodArity, DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof MapValues) {
            return getMapValuesMethodDeclaration((MapValues) expression, returnedType, methodArity, DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof NormContinuous) {
            return getNormContinuousMethodDeclaration((NormContinuous) expression, returnedType, methodArity, DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof NormDiscrete) {
            return getNormDiscreteMethodDeclaration((NormDiscrete) expression, returnedType, methodArity, DEFAULT_PARAMETERTYPE_MAP);
        } else if (expression instanceof TextIndex) {
            return getTextIndexMethodDeclaration((TextIndex) expression, returnedType, methodArity, DEFAULT_PARAMETERTYPE_MAP);
        } else {
            throw new IllegalArgumentException(String.format("Expression %s not managed", expression.getClass()));
        }
    }

    private  DerivedFieldFunctionUtils();

}