org.immutables.fixture.annotation.AbstractDeeplyImmutable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of value-fixture Show documentation
Show all versions of value-fixture Show documentation
Module that contains all tests for the code generation capability
package org.immutables.fixture.annotation;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.errorprone.annotations.Immutable;
import org.immutables.value.Value;
/**
* An abstract type which triggers the generation of an immutable type with hidden mutable state.
*
*
* - {@code @JsonDeserialize} causes a private secondary mutable subclass to be generated.
*
- {@code @Value.Default} causes the temporary storage of an {@code InitShim} in a field.
*
- {@code @Value.Lazy} causes the annotated property to be computed lazily, requiring it to be
* stored in a non-final field. Its initialization state is tracked using a mutable bitmap.
*
*
* This type is annotated with Error Prone's {@code @Immutable} annotation. The Error Prone
* checker would normally complain about the mutable constructs enumerated above. The generated
* code must thus take care to suppress such complaints.
*/
@Immutable
@JsonDeserialize
@Value.Immutable
@Value.Style(passAnnotations = Immutable.class)
abstract class AbstractDeeplyImmutable {
public abstract String getA();
@Value.Default
public String getB() {
return "";
}
@Value.Lazy
public String getC() {
return "";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy