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

de.hilling.junit.cdi.annotations.ImmutableActivatableTestImplementation Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package de.hilling.junit.cdi.annotations;

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

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

* Use the builder to create immutable instances: * {@code ImmutableActivatableTestImplementation.builder()}. * Use the static factory method to create immutable instances: * {@code ImmutableActivatableTestImplementation.of()}. */ @Generated(from = "ActivatableTestImplementation", generator = "Immutables") @SuppressWarnings({"all"}) @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableActivatableTestImplementation implements ActivatableTestImplementation { private static final java.lang.Class[] DEFAULT_VALUE_VALUE; static { try { DEFAULT_VALUE_VALUE = cast(ActivatableTestImplementation.class.getDeclaredMethod("value").getDefaultValue()); } catch(Exception e) { throw new ExceptionInInitializerError(e); } } @SuppressWarnings("unchecked") private static T cast(Object object) { return (T) object; } private final java.lang.Class[] value; private ImmutableActivatableTestImplementation(java.lang.Class[] value) { this.value = value.clone(); } private ImmutableActivatableTestImplementation(ImmutableActivatableTestImplementation.Builder builder) { this.value = builder.value != null ? builder.value : DEFAULT_VALUE_VALUE; } private ImmutableActivatableTestImplementation(ImmutableActivatableTestImplementation original, java.lang.Class[] value) { this.value = value; } /** {@inheritDoc} */ @Override public Class annotationType() { return ActivatableTestImplementation.class; } /** * Enumerates the classes and/or interfaces that should be replaced by the injected bean. * @return activatable beans. */ @Override public java.lang.Class[] value() { return value.clone(); } /** * Copy the current immutable object with elements that replace the content of {@link ActivatableTestImplementation#value() value}. * The array is cloned before being saved as attribute values. * @param elements The non-null elements for value * @return A modified copy of {@code this} object */ @SafeVarargs @SuppressWarnings("varargs") public final ImmutableActivatableTestImplementation withValue(java.lang.Class... elements) { java.lang.Class[] newValue = elements.clone(); return new ImmutableActivatableTestImplementation(this, newValue); } /** * This instance is equal to any implementation of the {@link ImmutableActivatableTestImplementation} 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 ActivatableTestImplementation && equalTo(0, (ActivatableTestImplementation) another); } private boolean equalTo(int synthetic, ActivatableTestImplementation another) { return Arrays.equals(value, another.value()); } /** * Computes a hash code from attributes: {@code value}. * @return hashCode value */ @Override public int hashCode() { int h = 0; h += 127 * "value".hashCode() ^ Arrays.hashCode(value); return h; } /** * Prints the immutable value {@code ActivatableTestImplementation} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "@ActivatableTestImplementation(" + "value=" + Arrays.toString(value) + ")"; } /** * Construct a new immutable {@code ActivatableTestImplementation} instance. * @param value The value for the {@code value} attribute * @return An immutable ActivatableTestImplementation instance */ public static ImmutableActivatableTestImplementation of(java.lang.Class[] value) { return new ImmutableActivatableTestImplementation(value); } /** * Creates an immutable copy of a {@link ActivatableTestImplementation} 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 ActivatableTestImplementation instance */ public static ImmutableActivatableTestImplementation copyOf(ActivatableTestImplementation instance) { if (instance instanceof ImmutableActivatableTestImplementation) { return (ImmutableActivatableTestImplementation) instance; } return ImmutableActivatableTestImplementation.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableActivatableTestImplementation ImmutableActivatableTestImplementation}. *

   * ImmutableActivatableTestImplementation.builder()
   *    .value(Class<?>) // optional {@link ActivatableTestImplementation#value() value}
   *    .build();
   * 
* @return A new ImmutableActivatableTestImplementation builder */ public static ImmutableActivatableTestImplementation.Builder builder() { return new ImmutableActivatableTestImplementation.Builder(); } /** * Builds instances of type {@link ImmutableActivatableTestImplementation ImmutableActivatableTestImplementation}. * 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 = "ActivatableTestImplementation", generator = "Immutables") public static final class Builder { private java.lang.Class[] value; private Builder() { } /** * Fill a builder with attribute values from the provided {@code ActivatableTestImplementation} 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(ActivatableTestImplementation instance) { Objects.requireNonNull(instance, "instance"); value(instance.value()); return this; } /** * Initializes the value for the {@link ActivatableTestImplementation#value() value} attribute. *

If not set, this attribute will have a default value as defined by {@link ActivatableTestImplementation#value() value}. * @param value The elements for value * @return {@code this} builder for use in a chained invocation */ @SafeVarargs @SuppressWarnings("varargs") public final Builder value(java.lang.Class... value) { this.value = value.clone(); return this; } /** * Builds a new {@link ImmutableActivatableTestImplementation ImmutableActivatableTestImplementation}. * @return An immutable instance of ActivatableTestImplementation * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableActivatableTestImplementation build() { return new ImmutableActivatableTestImplementation(this); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy