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 implementation of
Trees.Template.
Use the builder to create immutable instances:
ImmutableTrees.Template.builder().
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Trees.InvokableDeclarationprivate final booleanprivate final com.google.common.collect.ImmutableList<Trees.TemplatePart> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTemplate(com.google.common.collect.ImmutableList<Trees.TemplatePart> parts, Trees.InvokableDeclaration declaration, boolean isPublic) privateTemplate(ImmutableTrees.Template.Builder builder) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forTemplate.static ImmutableTrees.TemplatecopyOf(Trees.Template instance) Creates an immutable copy of aTrees.Templatevalue.booleanThis 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()toString()Prints the immutable valueTemplatewith attribute values.final ImmutableTrees.TemplateCopy the current immutable object by setting a value for thedeclarationattribute.final ImmutableTrees.TemplatewithIsPublic(boolean value) Copy the current immutable object by setting a value for theisPublicattribute.final ImmutableTrees.TemplatewithParts(Iterable<? extends Trees.TemplatePart> elements) Copy the current immutable object with elements that replace the content ofparts.final ImmutableTrees.TemplatewithParts(Trees.TemplatePart... elements) Copy the current immutable object with elements that replace the content ofparts.
-
Field Details
-
parts
-
declaration
-
isPublic
private final boolean isPublic
-
-
Constructor Details
-
Template
-
Template
private Template(com.google.common.collect.ImmutableList<Trees.TemplatePart> parts, Trees.InvokableDeclaration declaration, boolean isPublic)
-
-
Method Details
-
parts
- Returns:
- The value of the
partsattribute
-
declaration
- Returns:
- The value of the
declarationattribute
-
isPublic
public boolean isPublic()- Overrides:
isPublicin classTrees.Template- Returns:
- The value of the
isPublicattribute
-
withParts
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
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
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
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
This instance is equal to all instances ofTemplatethat have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:parts,declaration,isPublic. -
toString
Prints the immutable valueTemplatewith attribute values. -
copyOf
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
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
-