io.github.cdklabs.awscdk.appsync.utils.FieldOptions Maven / Gradle / Ivy
Show all versions of awscdk-appsync-utils Show documentation
package io.github.cdklabs.awscdk.appsync.utils;
/**
* Properties for configuring a field.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-28T00:18:00.291Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.awscdk.appsync.utils.$Module.class, fqn = "awscdk-appsync-utils.FieldOptions")
@software.amazon.jsii.Jsii.Proxy(FieldOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface FieldOptions extends software.amazon.jsii.JsiiSerializable {
/**
* The return type for this field.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull io.github.cdklabs.awscdk.appsync.utils.GraphqlType getReturnType();
/**
* The arguments for this field.
*
* i.e. type Example (first: String second: String) {}
*
*
* - where 'first' and 'second' are key values for args
* and 'String' is the GraphqlType
*
*
* Default: - no arguments
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.Map getArgs() {
return null;
}
/**
* the directives for this field.
*
* Default: - no directives
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getDirectives() {
return null;
}
/**
* @return a {@link Builder} of {@link FieldOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link FieldOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
io.github.cdklabs.awscdk.appsync.utils.GraphqlType returnType;
java.util.Map args;
java.util.List directives;
/**
* Sets the value of {@link FieldOptions#getReturnType}
* @param returnType The return type for this field. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder returnType(io.github.cdklabs.awscdk.appsync.utils.GraphqlType returnType) {
this.returnType = returnType;
return this;
}
/**
* Sets the value of {@link FieldOptions#getArgs}
* @param args The arguments for this field.
* i.e. type Example (first: String second: String) {}
*
*
* - where 'first' and 'second' are key values for args
* and 'String' is the GraphqlType
*
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder args(java.util.Map args) {
this.args = (java.util.Map)args;
return this;
}
/**
* Sets the value of {@link FieldOptions#getDirectives}
* @param directives the directives for this field.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder directives(java.util.List extends io.github.cdklabs.awscdk.appsync.utils.Directive> directives) {
this.directives = (java.util.List)directives;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link FieldOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public FieldOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link FieldOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements FieldOptions {
private final io.github.cdklabs.awscdk.appsync.utils.GraphqlType returnType;
private final java.util.Map args;
private final java.util.List directives;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.returnType = software.amazon.jsii.Kernel.get(this, "returnType", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.awscdk.appsync.utils.GraphqlType.class));
this.args = software.amazon.jsii.Kernel.get(this, "args", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.awscdk.appsync.utils.GraphqlType.class)));
this.directives = software.amazon.jsii.Kernel.get(this, "directives", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.awscdk.appsync.utils.Directive.class)));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.returnType = java.util.Objects.requireNonNull(builder.returnType, "returnType is required");
this.args = (java.util.Map)builder.args;
this.directives = (java.util.List)builder.directives;
}
@Override
public final io.github.cdklabs.awscdk.appsync.utils.GraphqlType getReturnType() {
return this.returnType;
}
@Override
public final java.util.Map getArgs() {
return this.args;
}
@Override
public final java.util.List getDirectives() {
return this.directives;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("returnType", om.valueToTree(this.getReturnType()));
if (this.getArgs() != null) {
data.set("args", om.valueToTree(this.getArgs()));
}
if (this.getDirectives() != null) {
data.set("directives", om.valueToTree(this.getDirectives()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("awscdk-appsync-utils.FieldOptions"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FieldOptions.Jsii$Proxy that = (FieldOptions.Jsii$Proxy) o;
if (!returnType.equals(that.returnType)) return false;
if (this.args != null ? !this.args.equals(that.args) : that.args != null) return false;
return this.directives != null ? this.directives.equals(that.directives) : that.directives == null;
}
@Override
public final int hashCode() {
int result = this.returnType.hashCode();
result = 31 * result + (this.args != null ? this.args.hashCode() : 0);
result = 31 * result + (this.directives != null ? this.directives.hashCode() : 0);
return result;
}
}
}