All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.hilling.junit.cdi.scope.ImmutableReplaceable Maven / Gradle / Ivy

The newest version!
package de.hilling.junit.cdi.scope;

import java.lang.annotation.Annotation;
import java.util.Objects;
import org.immutables.value.Generated;

/**
 * Immutable implementation of {@link Replaceable}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableReplaceable.builder()}. */ @Generated(from = "Replaceable", generator = "Immutables") @SuppressWarnings({"all"}) @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableReplaceable implements Replaceable { private ImmutableReplaceable(ImmutableReplaceable.Builder builder) { } /** {@inheritDoc} */ @Override public Class annotationType() { return Replaceable.class; } /** * This instance is equal to any implementation of the {@link ImmutableReplaceable} type with equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(Object another) { if (this == another) return true; return another instanceof Replaceable && equalTo(0, (Replaceable) another); } @SuppressWarnings("MethodCanBeStatic") private boolean equalTo(int synthetic, Replaceable another) { return true; } /** * Returns a constant hash code value. * @return hashCode value */ @Override public int hashCode() { return -1753216301; } /** * Prints the immutable value {@code Replaceable}. * @return A string representation of the value */ @Override public String toString() { return "@Replaceable"; } /** * Creates an immutable copy of a {@link Replaceable} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable Replaceable instance */ public static ImmutableReplaceable copyOf(Replaceable instance) { if (instance instanceof ImmutableReplaceable) { return (ImmutableReplaceable) instance; } return ImmutableReplaceable.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableReplaceable ImmutableReplaceable}. *

   * ImmutableReplaceable.builder()
   *    .build();
   * 
* @return A new ImmutableReplaceable builder */ public static ImmutableReplaceable.Builder builder() { return new ImmutableReplaceable.Builder(); } /** * Builds instances of type {@link ImmutableReplaceable ImmutableReplaceable}. * Initialize attributes and then invoke the {@link #build()} method to create an * immutable instance. *

{@code Builder} is not thread-safe and generally should not be stored in a field or collection, * but instead used immediately to create instances. */ @Generated(from = "Replaceable", generator = "Immutables") public static final class Builder { private Builder() { } /** * Fill a builder with attribute values from the provided {@code Replaceable} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(Replaceable instance) { Objects.requireNonNull(instance, "instance"); return this; } /** * Builds a new {@link ImmutableReplaceable ImmutableReplaceable}. * @return An immutable instance of Replaceable * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableReplaceable build() { return new ImmutableReplaceable(this); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy