io.github.cdklabs.projen.Rule Maven / Gradle / Ivy
Show all versions of projen Show documentation
package io.github.cdklabs.projen;
/**
* (experimental) A Make rule.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T17:03:54.842Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.projen.$Module.class, fqn = "projen.Rule")
@software.amazon.jsii.Jsii.Proxy(Rule.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface Rule extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Files to be created or updated by this rule.
*
* If the rule is phony then instead this represents the command's name(s).
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.util.List getTargets();
/**
* (experimental) Marks whether the target is phony.
*
* Default: false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getPhony() {
return null;
}
/**
* (experimental) Files that are used as inputs to create a target.
*
* Default: []
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getPrerequisites() {
return null;
}
/**
* (experimental) Commands that are run (using prerequisites as inputs) to create a target.
*
* Default: []
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getRecipe() {
return null;
}
/**
* @return a {@link Builder} of {@link Rule}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link Rule}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.List targets;
java.lang.Boolean phony;
java.util.List prerequisites;
java.util.List recipe;
/**
* Sets the value of {@link Rule#getTargets}
* @param targets Files to be created or updated by this rule. This parameter is required.
* If the rule is phony then instead this represents the command's name(s).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder targets(java.util.List targets) {
this.targets = targets;
return this;
}
/**
* Sets the value of {@link Rule#getPhony}
* @param phony Marks whether the target is phony.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder phony(java.lang.Boolean phony) {
this.phony = phony;
return this;
}
/**
* Sets the value of {@link Rule#getPrerequisites}
* @param prerequisites Files that are used as inputs to create a target.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder prerequisites(java.util.List prerequisites) {
this.prerequisites = prerequisites;
return this;
}
/**
* Sets the value of {@link Rule#getRecipe}
* @param recipe Commands that are run (using prerequisites as inputs) to create a target.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder recipe(java.util.List recipe) {
this.recipe = recipe;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link Rule}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public Rule build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link Rule}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Rule {
private final java.util.List targets;
private final java.lang.Boolean phony;
private final java.util.List prerequisites;
private final java.util.List recipe;
/**
* 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.targets = software.amazon.jsii.Kernel.get(this, "targets", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.phony = software.amazon.jsii.Kernel.get(this, "phony", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.prerequisites = software.amazon.jsii.Kernel.get(this, "prerequisites", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.recipe = software.amazon.jsii.Kernel.get(this, "recipe", 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 Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.targets = java.util.Objects.requireNonNull(builder.targets, "targets is required");
this.phony = builder.phony;
this.prerequisites = builder.prerequisites;
this.recipe = builder.recipe;
}
@Override
public final java.util.List getTargets() {
return this.targets;
}
@Override
public final java.lang.Boolean getPhony() {
return this.phony;
}
@Override
public final java.util.List getPrerequisites() {
return this.prerequisites;
}
@Override
public final java.util.List getRecipe() {
return this.recipe;
}
@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("targets", om.valueToTree(this.getTargets()));
if (this.getPhony() != null) {
data.set("phony", om.valueToTree(this.getPhony()));
}
if (this.getPrerequisites() != null) {
data.set("prerequisites", om.valueToTree(this.getPrerequisites()));
}
if (this.getRecipe() != null) {
data.set("recipe", om.valueToTree(this.getRecipe()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("projen.Rule"));
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;
Rule.Jsii$Proxy that = (Rule.Jsii$Proxy) o;
if (!targets.equals(that.targets)) return false;
if (this.phony != null ? !this.phony.equals(that.phony) : that.phony != null) return false;
if (this.prerequisites != null ? !this.prerequisites.equals(that.prerequisites) : that.prerequisites != null) return false;
return this.recipe != null ? this.recipe.equals(that.recipe) : that.recipe == null;
}
@Override
public final int hashCode() {
int result = this.targets.hashCode();
result = 31 * result + (this.phony != null ? this.phony.hashCode() : 0);
result = 31 * result + (this.prerequisites != null ? this.prerequisites.hashCode() : 0);
result = 31 * result + (this.recipe != null ? this.recipe.hashCode() : 0);
return result;
}
}
}