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 Object
implements Trees.ValueDeclaration
Immutable implementation of
Trees.ValueDeclaration.
Use the builder to create immutable instances:
ImmutableTrees.ValueDeclaration.builder().
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.base.Optional<Trees.TypeReference> private final Trees.Identifierprivate final com.google.common.base.Optional<Trees.TypeReference> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateValueDeclaration(Trees.Identifier name, com.google.common.base.Optional<Trees.TypeReference> type, com.google.common.base.Optional<Trees.TypeReference> containedType) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forValueDeclaration.com.google.common.base.Optional<Trees.TypeReference> copyOf(Trees.ValueDeclaration instance) Creates an immutable copy of aTrees.ValueDeclarationvalue.booleanThis 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.name()toString()Prints the immutable valueValueDeclarationwith attribute values.com.google.common.base.Optional<Trees.TypeReference> type()withContainedType(com.google.common.base.Optional<? extends Trees.TypeReference> optional) Copy the current immutable object by setting an optional value for thecontainedTypeattribute.Copy the current immutable object by setting a present value for the optionalcontainedTypeattribute.withName(Trees.Identifier value) Copy the current immutable object by setting a value for thenameattribute.withType(com.google.common.base.Optional<? extends Trees.TypeReference> optional) Copy the current immutable object by setting an optional value for thetypeattribute.withType(Trees.TypeReference value) Copy the current immutable object by setting a present value for the optionaltypeattribute.
-
Field Details
-
name
-
type
-
containedType
-
-
Constructor Details
-
ValueDeclaration
private ValueDeclaration(Trees.Identifier name, com.google.common.base.Optional<Trees.TypeReference> type, com.google.common.base.Optional<Trees.TypeReference> containedType)
-
-
Method Details
-
name
- Specified by:
namein interfaceTrees.Named- Returns:
- The value of the
nameattribute
-
type
- Specified by:
typein interfaceTrees.ValueDeclaration- Returns:
- The value of the
typeattribute
-
containedType
- Specified by:
containedTypein interfaceTrees.ValueDeclaration- Returns:
- The value of the
containedTypeattribute
-
withName
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
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
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
This instance is equal to all instances ofValueDeclarationthat have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:name,type,containedType. -
toString
Prints the immutable valueValueDeclarationwith attribute values. -
copyOf
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
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
-