All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.odata4j.edm.EdmFunctionParameter Maven / Gradle / Ivy

The newest version!
package org.odata4j.edm;

import org.odata4j.core.ImmutableList;

/**
 * A CSDL Parameter element.
 *
 * 

A Parameter element is used to define input and output parameters for function imports that are declared in CSDL. * * @see [msdn] Parameter Element (CSDL) */ public class EdmFunctionParameter extends EdmItem { /** Parameter type: In, Out, or InOut */ public enum Mode { In, Out, InOut; }; private final String name; private final EdmType type; private final Mode mode; private final Boolean nullable; private EdmFunctionParameter(String name, EdmType type, Mode mode, Boolean nullable, EdmDocumentation doc, ImmutableList> annots) { super(doc, annots); this.name = name; this.type = type; this.mode = mode; this.nullable = nullable; } public String getName() { return name; } public EdmType getType() { return type; } public Mode getMode() { return mode; } public Boolean isNullable() { return nullable; } public static Builder newBuilder() { return new Builder(); } public static Builder newBuilder(EdmFunctionParameter functionParameter, BuilderContext context) { return context.newBuilder(functionParameter, new Builder()); } /** Mutable builder for {@link EdmFunctionParameter} objects. */ public static class Builder extends EdmItem.Builder { private String name; private EdmType type; private EdmType.Builder typeBuilder; private Mode mode; private Boolean nullable; @Override Builder newBuilder(EdmFunctionParameter functionParameter, BuilderContext context) { return new Builder().setName(functionParameter.name).setType(functionParameter.type).setMode(functionParameter.mode); } public EdmFunctionParameter build() { return new EdmFunctionParameter(name, typeBuilder != null ? typeBuilder.build() : type, mode, nullable, getDocumentation(), ImmutableList.copyOf(getAnnotations())); } public Builder setName(String name) { this.name = name; return this; } public Builder setType(EdmType type) { this.type = type; return this; } public Builder setType(EdmType.Builder typeBuilder) { this.typeBuilder = typeBuilder; return this; } public Builder setMode(Mode mode) { this.mode = mode; return this; } public Builder setNullable(Boolean nullable) { this.nullable = nullable; return this; } public Builder input(String name, EdmType type) { this.mode = Mode.In; this.name = name; this.type = type; return this; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy