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

org.glowroot.local.ui.MBeanTreeRequest Maven / Gradle / Ivy

The newest version!
package org.glowroot.local.ui;

import org.glowroot.shaded.fasterxml.jackson.annotation.JsonCreator;
import org.glowroot.shaded.fasterxml.jackson.annotation.JsonProperty;
import org.glowroot.shaded.google.common.base.MoreObjects;
import org.glowroot.shaded.google.common.collect.ImmutableList;
import java.util.List;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;

/**
 * Immutable implementation of {@link JvmJsonService.MBeanTreeRequestBase}.
 * 

* Use builder to create immutable instances: * {@code MBeanTreeRequest.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "JvmJsonService.MBeanTreeRequestBase"}) @Immutable final class MBeanTreeRequest extends JvmJsonService.MBeanTreeRequestBase { private final ImmutableList expanded; private MBeanTreeRequest(ImmutableList expanded) { this.expanded = expanded; } /** * {@inheritDoc} * @return value of {@code expanded} attribute */ @JsonProperty("expanded") @Override public ImmutableList expanded() { return expanded; } /** * Copy current immutable object with elements that replace content of {@link JvmJsonService.MBeanTreeRequestBase#expanded() expanded}. * @param elements elements to set * @return modified copy of {@code this} object */ public final MBeanTreeRequest withExpanded(String... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new MBeanTreeRequest(newValue); } /** * Copy current immutable object with elements that replace content of {@link JvmJsonService.MBeanTreeRequestBase#expanded() expanded}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements iterable of expanded elements to set * @return modified copy of {@code this} object */ public final MBeanTreeRequest withExpanded(Iterable elements) { if (this.expanded == elements) { return this; } ImmutableList newValue = ImmutableList.copyOf(elements); return new MBeanTreeRequest(newValue); } /** * This instance is equal to instances of {@code MBeanTreeRequest} with equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { return this == another || (another instanceof MBeanTreeRequest && equalTo((MBeanTreeRequest) another)); } private boolean equalTo(MBeanTreeRequest another) { return expanded.equals(another.expanded); } /** * Computes hash code from attributes: {@code expanded}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + expanded.hashCode(); return h; } /** * Prints immutable value {@code MBeanTreeRequest{...}} with attribute values, * excluding any non-generated and auxiliary attributes. * @return string representation of value */ @Override public String toString() { return MoreObjects.toStringHelper("MBeanTreeRequest") .add("expanded", expanded) .toString(); } @JsonCreator public static MBeanTreeRequest fromAllAttributes( @JsonProperty("expanded") @Nullable List expanded) { MBeanTreeRequest.Builder builder = MBeanTreeRequest.builder(); if (expanded != null) { builder.addAllExpanded(expanded); } return builder.build(); } /** * Creates immutable copy of {@link JvmJsonService.MBeanTreeRequestBase}. * Uses accessors to get values to initialize immutable instance. * If an instance is already immutable, it is returned as is. * @param instance instance to copy * @return copied immutable MBeanTreeRequest instance */ static MBeanTreeRequest copyOf(JvmJsonService.MBeanTreeRequestBase instance) { if (instance instanceof MBeanTreeRequest) { return (MBeanTreeRequest) instance; } return MBeanTreeRequest.builder() .addAllExpanded(instance.expanded()) .build(); } /** * Creates builder for {@link org.glowroot.local.ui.MBeanTreeRequest}. * @return new MBeanTreeRequest builder */ static MBeanTreeRequest.Builder builder() { return new MBeanTreeRequest.Builder(); } /** * Builds instances of {@link org.glowroot.local.ui.MBeanTreeRequest}. * Initialized attributes and then invoke {@link #build()} method to create * immutable instance. *

Builder is not thread safe and generally should not be stored in field or collection, * but used immediately to create instances. */ @NotThreadSafe static final class Builder { private ImmutableList.Builder expandedBuilder = ImmutableList.builder(); private Builder() {} /** * Adds one element to {@link JvmJsonService.MBeanTreeRequestBase#expanded() expanded} list. * @param element expanded element * @return {@code this} builder for chained invocation */ public final Builder addExpanded(String element) { expandedBuilder.add(element); return this; } /** * Adds elements to {@link JvmJsonService.MBeanTreeRequestBase#expanded() expanded} list. * @param elements array of expanded elements * @return {@code this} builder for chained invocation */ public final Builder addExpanded(String... elements) { expandedBuilder.add(elements); return this; } /** * Adds elements to {@link JvmJsonService.MBeanTreeRequestBase#expanded() expanded} list. * @param elements iterable of expanded elements * @return {@code this} builder for chained invocation */ public final Builder addAllExpanded(Iterable elements) { expandedBuilder.addAll(elements); return this; } /** * Builds new {@link org.glowroot.local.ui.MBeanTreeRequest}. * @return immutable instance of MBeanTreeRequest */ public org.glowroot.local.ui.MBeanTreeRequest build() { return new MBeanTreeRequest(expandedBuilder.build()); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy