Class ImmutableTrees.Template
- java.lang.Object
-
- org.immutables.generator.processor.Trees.Template
-
- org.immutables.generator.processor.ImmutableTrees.Template
-
- All Implemented Interfaces:
Trees.Block,Trees.Directive,Trees.InvokableStatement,Trees.TemplatePart,Trees.UnitPart
- Enclosing class:
- ImmutableTrees
@Immutable public static final class ImmutableTrees.Template extends Trees.Template
Immutable implementation ofTrees.Template.Use the builder to create immutable instances:
ImmutableTrees.Template.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableTrees.Template.BuilderBuilds instances of typeTemplate.
-
Field Summary
Fields Modifier and Type Field Description private Trees.InvokableDeclarationdeclarationprivate booleanisPublicprivate com.google.common.collect.ImmutableList<Trees.TemplatePart>parts
-
Constructor Summary
Constructors Modifier Constructor Description privateTemplate(com.google.common.collect.ImmutableList<Trees.TemplatePart> parts, Trees.InvokableDeclaration declaration, boolean isPublic)privateTemplate(ImmutableTrees.Template.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableTrees.Template.Builderbuilder()Creates a builder forTemplate.static ImmutableTrees.TemplatecopyOf(Trees.Template instance)Creates an immutable copy of aTrees.Templatevalue.Trees.InvokableDeclarationdeclaration()booleanequals(java.lang.Object another)This instance is equal to all instances ofTemplatethat have equal attribute values.private booleanequalTo(int synthetic, ImmutableTrees.Template another)inthashCode()Computes a hash code from attributes:parts,declaration,isPublic.booleanisPublic()com.google.common.collect.ImmutableList<Trees.TemplatePart>parts()java.lang.StringtoString()Prints the immutable valueTemplatewith attribute values.ImmutableTrees.TemplatewithDeclaration(Trees.InvokableDeclaration value)Copy the current immutable object by setting a value for thedeclarationattribute.ImmutableTrees.TemplatewithIsPublic(boolean value)Copy the current immutable object by setting a value for theisPublicattribute.ImmutableTrees.TemplatewithParts(java.lang.Iterable<? extends Trees.TemplatePart> elements)Copy the current immutable object with elements that replace the content ofparts.ImmutableTrees.TemplatewithParts(Trees.TemplatePart... elements)Copy the current immutable object with elements that replace the content ofparts.
-
-
-
Field Detail
-
parts
private final com.google.common.collect.ImmutableList<Trees.TemplatePart> parts
-
declaration
private final Trees.InvokableDeclaration declaration
-
isPublic
private final boolean isPublic
-
-
Constructor Detail
-
Template
private Template(ImmutableTrees.Template.Builder builder)
-
Template
private Template(com.google.common.collect.ImmutableList<Trees.TemplatePart> parts, Trees.InvokableDeclaration declaration, boolean isPublic)
-
-
Method Detail
-
parts
public com.google.common.collect.ImmutableList<Trees.TemplatePart> parts()
- Returns:
- The value of the
partsattribute
-
declaration
public Trees.InvokableDeclaration declaration()
- Returns:
- The value of the
declarationattribute
-
isPublic
public boolean isPublic()
- Overrides:
isPublicin classTrees.Template- Returns:
- The value of the
isPublicattribute
-
withParts
public final ImmutableTrees.Template withParts(Trees.TemplatePart... elements)
Copy the current immutable object with elements that replace the content ofparts.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withParts
public final ImmutableTrees.Template withParts(java.lang.Iterable<? extends Trees.TemplatePart> elements)
Copy the current immutable object with elements that replace the content ofparts. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of parts elements to set- Returns:
- A modified copy of
thisobject
-
withDeclaration
public final ImmutableTrees.Template withDeclaration(Trees.InvokableDeclaration value)
Copy the current immutable object by setting a value for thedeclarationattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for declaration- Returns:
- A modified copy of the
thisobject
-
withIsPublic
public final ImmutableTrees.Template withIsPublic(boolean value)
Copy the current immutable object by setting a value for theisPublicattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for isPublic- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofTemplatethat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
equalTo
private boolean equalTo(int synthetic, ImmutableTrees.Template another)
-
hashCode
public int hashCode()
Computes a hash code from attributes:parts,declaration,isPublic.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueTemplatewith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableTrees.Template copyOf(Trees.Template instance)
Creates an immutable copy of aTrees.Templatevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Template instance
-
builder
public static ImmutableTrees.Template.Builder builder()
Creates a builder forTemplate.ImmutableTrees.Template.builder() .addParts|addAllParts(org.immutables.generator.processor.Trees.TemplatePart) //partselements .declaration(org.immutables.generator.processor.Trees.InvokableDeclaration) // requireddeclaration.isPublic(boolean) // optionalisPublic.build();- Returns:
- A new Template builder
-
-