
com.sap.cds.reflect.impl.CdsFunctionBuilder Maven / Gradle / Ivy
/**************************************************************************
* (C) 2020-2023 SAP SE or an SAP affiliate company. All rights reserved. *
**************************************************************************/
package com.sap.cds.reflect.impl;
import java.util.Collection;
import java.util.List;
import com.sap.cds.reflect.CdsAnnotation;
import com.sap.cds.reflect.CdsBoundFunction;
import com.sap.cds.reflect.CdsFunction;
import com.sap.cds.reflect.CdsParameter;
import com.sap.cds.reflect.CdsType;
public class CdsFunctionBuilder extends CdsOperationBuilder {
CdsFunctionBuilder(boolean isBound, List> annotations, String qualifiedName, String name, String doc) {
super(isBound, annotations, qualifiedName, name, doc);
}
@Override
protected CdsFunction createBound(String doc, List parameters, CdsType returnType, CdsParameter bindingParameter) {
return new CdsBoundFunctionImpl(annotations, qualifiedName, getName(), doc, parameters, returnType, bindingParameter);
}
@Override
protected CdsFunction createUnbound(String doc, List parameters, CdsType returnType) {
return new CdsFunctionImpl(annotations, qualifiedName, getName(), doc, parameters, returnType);
}
private static class CdsFunctionImpl extends CdsOperationImpl implements CdsFunction {
private CdsFunctionImpl(Collection> annotations, String qualifiedName, String name, String doc, List parameters, CdsType returnType) {
super(annotations, qualifiedName, name, doc, parameters, returnType);
}
@Override
public CdsType getReturnType() {
return returnType;
}
}
private static class CdsBoundFunctionImpl extends CdsFunctionImpl implements CdsBoundFunction {
private final CdsParameter bindingParameter;
private CdsBoundFunctionImpl(Collection> annotations, String qualifiedName, String name, String doc, List parameters, CdsType returnType, CdsParameter bindingParameter) {
super(annotations, qualifiedName, name, doc, parameters, returnType);
this.bindingParameter = bindingParameter;
}
@Override
public CdsParameter getBindingParameter() {
return bindingParameter;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy