Class ImmutableTrees.ValueDeclaration
- java.lang.Object
-
- org.immutables.generator.processor.ImmutableTrees.ValueDeclaration
-
- All Implemented Interfaces:
Trees.Named,Trees.ValueDeclaration
- Enclosing class:
- ImmutableTrees
@Immutable public static final class ImmutableTrees.ValueDeclaration extends java.lang.Object implements Trees.ValueDeclaration
Immutable implementation ofTrees.ValueDeclaration.Use the builder to create immutable instances:
ImmutableTrees.ValueDeclaration.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableTrees.ValueDeclaration.BuilderBuilds instances of typeValueDeclaration.
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.base.Optional<Trees.TypeReference>containedTypeprivate Trees.Identifiernameprivate com.google.common.base.Optional<Trees.TypeReference>type
-
Constructor Summary
Constructors Modifier Constructor Description privateValueDeclaration(Trees.Identifier name, com.google.common.base.Optional<Trees.TypeReference> type, com.google.common.base.Optional<Trees.TypeReference> containedType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableTrees.ValueDeclaration.Builderbuilder()Creates a builder forValueDeclaration.com.google.common.base.Optional<Trees.TypeReference>containedType()static ImmutableTrees.ValueDeclarationcopyOf(Trees.ValueDeclaration instance)Creates an immutable copy of aTrees.ValueDeclarationvalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofValueDeclarationthat have equal attribute values.private booleanequalTo(int synthetic, ImmutableTrees.ValueDeclaration another)inthashCode()Computes a hash code from attributes:name,type,containedType.Trees.Identifiername()java.lang.StringtoString()Prints the immutable valueValueDeclarationwith attribute values.com.google.common.base.Optional<Trees.TypeReference>type()ImmutableTrees.ValueDeclarationwithContainedType(com.google.common.base.Optional<? extends Trees.TypeReference> optional)Copy the current immutable object by setting an optional value for thecontainedTypeattribute.ImmutableTrees.ValueDeclarationwithContainedType(Trees.TypeReference value)Copy the current immutable object by setting a present value for the optionalcontainedTypeattribute.ImmutableTrees.ValueDeclarationwithName(Trees.Identifier value)Copy the current immutable object by setting a value for thenameattribute.ImmutableTrees.ValueDeclarationwithType(com.google.common.base.Optional<? extends Trees.TypeReference> optional)Copy the current immutable object by setting an optional value for thetypeattribute.ImmutableTrees.ValueDeclarationwithType(Trees.TypeReference value)Copy the current immutable object by setting a present value for the optionaltypeattribute.
-
-
-
Field Detail
-
name
private final Trees.Identifier name
-
type
private final com.google.common.base.Optional<Trees.TypeReference> type
-
containedType
private final com.google.common.base.Optional<Trees.TypeReference> containedType
-
-
Constructor Detail
-
ValueDeclaration
private ValueDeclaration(Trees.Identifier name, com.google.common.base.Optional<Trees.TypeReference> type, com.google.common.base.Optional<Trees.TypeReference> containedType)
-
-
Method Detail
-
name
public Trees.Identifier name()
- Specified by:
namein interfaceTrees.Named- Returns:
- The value of the
nameattribute
-
type
public com.google.common.base.Optional<Trees.TypeReference> type()
- Specified by:
typein interfaceTrees.ValueDeclaration- Returns:
- The value of the
typeattribute
-
containedType
public com.google.common.base.Optional<Trees.TypeReference> containedType()
- Specified by:
containedTypein interfaceTrees.ValueDeclaration- Returns:
- The value of the
containedTypeattribute
-
withName
public final ImmutableTrees.ValueDeclaration withName(Trees.Identifier value)
Copy the current immutable object by setting a value for thenameattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withType
public final ImmutableTrees.ValueDeclaration withType(Trees.TypeReference value)
Copy the current immutable object by setting a present value for the optionaltypeattribute.- Specified by:
withTypein interfaceTrees.ValueDeclaration- Parameters:
value- The value for type- Returns:
- A modified copy of
thisobject
-
withType
public final ImmutableTrees.ValueDeclaration withType(com.google.common.base.Optional<? extends Trees.TypeReference> optional)
Copy the current immutable object by setting an optional value for thetypeattribute. A shallow reference equality check on the optional value is used to prevent copying of the same value by returningthis.- Parameters:
optional- A value for type- Returns:
- A modified copy of
thisobject
-
withContainedType
public final ImmutableTrees.ValueDeclaration withContainedType(Trees.TypeReference value)
Copy the current immutable object by setting a present value for the optionalcontainedTypeattribute.- Specified by:
withContainedTypein interfaceTrees.ValueDeclaration- Parameters:
value- The value for containedType- Returns:
- A modified copy of
thisobject
-
withContainedType
public final ImmutableTrees.ValueDeclaration withContainedType(com.google.common.base.Optional<? extends Trees.TypeReference> optional)
Copy the current immutable object by setting an optional value for thecontainedTypeattribute. A shallow reference equality check on the optional value is used to prevent copying of the same value by returningthis.- Parameters:
optional- A value for containedType- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofValueDeclarationthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
equalTo
private boolean equalTo(int synthetic, ImmutableTrees.ValueDeclaration another)
-
hashCode
public int hashCode()
Computes a hash code from attributes:name,type,containedType.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueValueDeclarationwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableTrees.ValueDeclaration copyOf(Trees.ValueDeclaration instance)
Creates an immutable copy of aTrees.ValueDeclarationvalue. 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 ValueDeclaration instance
-
builder
public static ImmutableTrees.ValueDeclaration.Builder builder()
Creates a builder forValueDeclaration.ImmutableTrees.ValueDeclaration.builder() .name(org.immutables.generator.processor.Trees.Identifier) // requiredname.type(org.immutables.generator.processor.Trees.TypeReference) // optionaltype.containedType(org.immutables.generator.processor.Trees.TypeReference) // optionalcontainedType.build();- Returns:
- A new ValueDeclaration builder
-
-