
software.constructs.MetadataEntry Maven / Gradle / Ivy
package software.constructs;
/**
* An entry in the construct metadata table.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.36.0 (build a0cd080)", date = "2021-10-05T20:12:35.904Z")
@software.amazon.jsii.Jsii(module = software.constructs.$Module.class, fqn = "constructs.MetadataEntry")
@software.amazon.jsii.Jsii.Proxy(MetadataEntry.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface MetadataEntry extends software.amazon.jsii.JsiiSerializable {
/**
* The data.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.Object getData();
/**
* The metadata entry type.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getType();
/**
* Stack trace at the point of adding the metadata.
*
* Only available if addMetadata()
is called with stackTrace: true
.
*
* Default: - no trace information
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getTrace() {
return null;
}
/**
* @return a {@link Builder} of {@link MetadataEntry}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link MetadataEntry}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
private java.lang.Object data;
private java.lang.String type;
private java.util.List trace;
/**
* Sets the value of {@link MetadataEntry#getData}
* @param data The data. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder data(java.lang.Object data) {
this.data = data;
return this;
}
/**
* Sets the value of {@link MetadataEntry#getType}
* @param type The metadata entry type. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder type(java.lang.String type) {
this.type = type;
return this;
}
/**
* Sets the value of {@link MetadataEntry#getTrace}
* @param trace Stack trace at the point of adding the metadata.
* Only available if addMetadata()
is called with stackTrace: true
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder trace(java.util.List trace) {
this.trace = trace;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link MetadataEntry}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public MetadataEntry build() {
return new Jsii$Proxy(data, type, trace);
}
}
/**
* An implementation for {@link MetadataEntry}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements MetadataEntry {
private final java.lang.Object data;
private final java.lang.String type;
private final java.util.List trace;
/**
* 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.data = software.amazon.jsii.Kernel.get(this, "data", software.amazon.jsii.NativeType.forClass(java.lang.Object.class));
this.type = software.amazon.jsii.Kernel.get(this, "type", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.trace = software.amazon.jsii.Kernel.get(this, "trace", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final java.lang.Object data, final java.lang.String type, final java.util.List trace) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.data = java.util.Objects.requireNonNull(data, "data is required");
this.type = java.util.Objects.requireNonNull(type, "type is required");
this.trace = trace;
}
@Override
public final java.lang.Object getData() {
return this.data;
}
@Override
public final java.lang.String getType() {
return this.type;
}
@Override
public final java.util.List getTrace() {
return this.trace;
}
@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("data", om.valueToTree(this.getData()));
data.set("type", om.valueToTree(this.getType()));
if (this.getTrace() != null) {
data.set("trace", om.valueToTree(this.getTrace()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("constructs.MetadataEntry"));
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;
MetadataEntry.Jsii$Proxy that = (MetadataEntry.Jsii$Proxy) o;
if (!data.equals(that.data)) return false;
if (!type.equals(that.type)) return false;
return this.trace != null ? this.trace.equals(that.trace) : that.trace == null;
}
@Override
public final int hashCode() {
int result = this.data.hashCode();
result = 31 * result + (this.type.hashCode());
result = 31 * result + (this.trace != null ? this.trace.hashCode() : 0);
return result;
}
}
}