--- /dev/null
+/**\r
+* Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*/\r
+\r
+package org.openo.msb.wrapper.consul.option;\r
+\r
+import com.google.common.base.MoreObjects;\r
+import com.google.common.base.Optional;\r
+import com.google.common.base.Preconditions;\r
+import javax.annotation.Generated;\r
+\r
+/**\r
+ * Immutable implementation of {@link CatalogOptions}.\r
+ * <p>\r
+ * Use the builder to create immutable instances:\r
+ * {@code ImmutableCatalogOptions.builder()}.\r
+ */\r
+@SuppressWarnings("all")\r
+@Generated({"Immutables.generator", "CatalogOptions"})\r
+public final class ImmutableCatalogOptions extends CatalogOptions {\r
+ private final Optional<String> datacenter;\r
+ private final Optional<String> tag;\r
+\r
+ private ImmutableCatalogOptions(\r
+ Optional<String> datacenter,\r
+ Optional<String> tag) {\r
+ this.datacenter = datacenter;\r
+ this.tag = tag;\r
+ }\r
+\r
+ /**\r
+ * @return The value of the {@code datacenter} attribute\r
+ */\r
+ @Override\r
+ public Optional<String> getDatacenter() {\r
+ return datacenter;\r
+ }\r
+\r
+ /**\r
+ * @return The value of the {@code tag} attribute\r
+ */\r
+ @Override\r
+ public Optional<String> getTag() {\r
+ return tag;\r
+ }\r
+\r
+ /**\r
+ * Copy the current immutable object by setting a <i>present</i> value for the optional {@link CatalogOptions#getDatacenter() datacenter} attribute.\r
+ * @param value The value for datacenter\r
+ * @return A modified copy of {@code this} object\r
+ */\r
+ public final ImmutableCatalogOptions withDatacenter(String value) {\r
+ Optional<String> newValue = Optional.of(value);\r
+ return new ImmutableCatalogOptions(newValue, this.tag);\r
+ }\r
+\r
+ /**\r
+ * Copy the current immutable object by setting an optional value for the {@link CatalogOptions#getDatacenter() datacenter} attribute.\r
+ * A shallow reference equality check on the optional value is used to prevent copying of the same value by returning {@code this}.\r
+ * @param optional A value for datacenter\r
+ * @return A modified copy of {@code this} object\r
+ */\r
+ public final ImmutableCatalogOptions withDatacenter(Optional<String> optional) {\r
+ Optional<String> value = Preconditions.checkNotNull(optional, "datacenter");\r
+ if (this.datacenter == value) return this;\r
+ return new ImmutableCatalogOptions(value, this.tag);\r
+ }\r
+\r
+ /**\r
+ * Copy the current immutable object by setting a <i>present</i> value for the optional {@link CatalogOptions#getTag() tag} attribute.\r
+ * @param value The value for tag\r
+ * @return A modified copy of {@code this} object\r
+ */\r
+ public final ImmutableCatalogOptions withTag(String value) {\r
+ Optional<String> newValue = Optional.of(value);\r
+ return new ImmutableCatalogOptions(this.datacenter, newValue);\r
+ }\r
+\r
+ /**\r
+ * Copy the current immutable object by setting an optional value for the {@link CatalogOptions#getTag() tag} attribute.\r
+ * A shallow reference equality check on the optional value is used to prevent copying of the same value by returning {@code this}.\r
+ * @param optional A value for tag\r
+ * @return A modified copy of {@code this} object\r
+ */\r
+ public final ImmutableCatalogOptions withTag(Optional<String> optional) {\r
+ Optional<String> value = Preconditions.checkNotNull(optional, "tag");\r
+ if (this.tag == value) return this;\r
+ return new ImmutableCatalogOptions(this.datacenter, value);\r
+ }\r
+\r
+ /**\r
+ * This instance is equal to all instances of {@code ImmutableCatalogOptions} that have equal attribute values.\r
+ * @return {@code true} if {@code this} is equal to {@code another} instance\r
+ */\r
+ @Override\r
+ public boolean equals(Object another) {\r
+ if (this == another) return true;\r
+ return another instanceof ImmutableCatalogOptions\r
+ && equalTo((ImmutableCatalogOptions) another);\r
+ }\r
+\r
+ private boolean equalTo(ImmutableCatalogOptions another) {\r
+ return datacenter.equals(another.datacenter)\r
+ && tag.equals(another.tag);\r
+ }\r
+\r
+ /**\r
+ * Computes a hash code from attributes: {@code datacenter}, {@code tag}.\r
+ * @return hashCode value\r
+ */\r
+ @Override\r
+ public int hashCode() {\r
+ int h = 31;\r
+ h = h * 17 + datacenter.hashCode();\r
+ h = h * 17 + tag.hashCode();\r
+ return h;\r
+ }\r
+\r
+ /**\r
+ * Prints the immutable value {@code CatalogOptions...} with all non-generated\r
+ * and non-auxiliary attribute values.\r
+ * @return A string representation of the value\r
+ */\r
+ @Override\r
+ public String toString() {\r
+ return MoreObjects.toStringHelper("CatalogOptions")\r
+ .add("datacenter", datacenter)\r
+ .add("tag", tag)\r
+ .toString();\r
+ }\r
+\r
+ /**\r
+ * Creates an immutable copy of a {@link CatalogOptions} value.\r
+ * Uses accessors to get values to initialize the new immutable instance.\r
+ * If an instance is already immutable, it is returned as is.\r
+ * @param instance The instance to copy\r
+ * @return A copied immutable CatalogOptions instance\r
+ */\r
+ public static ImmutableCatalogOptions copyOf(CatalogOptions instance) {\r
+ if (instance instanceof ImmutableCatalogOptions) {\r
+ return (ImmutableCatalogOptions) instance;\r
+ }\r
+ return ImmutableCatalogOptions.builder()\r
+ .from(instance)\r
+ .build();\r
+ }\r
+\r
+ /**\r
+ * Creates a builder for {@link ImmutableCatalogOptions ImmutableCatalogOptions}.\r
+ * @return A new ImmutableCatalogOptions builder\r
+ */\r
+ public static ImmutableCatalogOptions.Builder builder() {\r
+ return new ImmutableCatalogOptions.Builder();\r
+ }\r
+\r
+ /**\r
+ * Builds instances of type {@link ImmutableCatalogOptions ImmutableCatalogOptions}.\r
+ * Initialize attributes and then invoke the {@link #build()} method to create an\r
+ * immutable instance.\r
+ * <p><em>{@code Builder} is not thread-safe and generally should not be stored in a field or collection,\r
+ * but instead used immediately to create instances.</em>\r
+ */\r
+ public static final class Builder {\r
+ private Optional<String> datacenter = Optional.absent();\r
+ private Optional<String> tag = Optional.absent();\r
+\r
+ private Builder() {\r
+ }\r
+\r
+ /**\r
+ * Fill a builder with attribute values from the provided {@code CatalogOptions} instance.\r
+ * Regular attribute values will be replaced with those from the given instance.\r
+ * Absent optional values will not replace present values.\r
+ * @param instance The instance from which to copy values\r
+ * @return {@code this} builder for use in a chained invocation\r
+ */\r
+ public final Builder from(CatalogOptions instance) {\r
+ Preconditions.checkNotNull(instance, "instance");\r
+ Optional<String> datacenterOptional = instance.getDatacenter();\r
+ if (datacenterOptional.isPresent()) {\r
+ datacenter(datacenterOptional);\r
+ }\r
+ Optional<String> tagOptional = instance.getTag();\r
+ if (tagOptional.isPresent()) {\r
+ tag(tagOptional);\r
+ }\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Initializes the optional value {@link CatalogOptions#getDatacenter() datacenter} to datacenter.\r
+ * @param datacenter The value for datacenter\r
+ * @return {@code this} builder for chained invocation\r
+ */\r
+ public final Builder datacenter(String datacenter) {\r
+ this.datacenter = Optional.of(datacenter);\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Initializes the optional value {@link CatalogOptions#getDatacenter() datacenter} to datacenter.\r
+ * @param datacenter The value for datacenter\r
+ * @return {@code this} builder for use in a chained invocation\r
+ */\r
+ public final Builder datacenter(Optional<String> datacenter) {\r
+ this.datacenter = Preconditions.checkNotNull(datacenter, "datacenter");\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Initializes the optional value {@link CatalogOptions#getTag() tag} to tag.\r
+ * @param tag The value for tag\r
+ * @return {@code this} builder for chained invocation\r
+ */\r
+ public final Builder tag(String tag) {\r
+ this.tag = Optional.of(tag);\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Initializes the optional value {@link CatalogOptions#getTag() tag} to tag.\r
+ * @param tag The value for tag\r
+ * @return {@code this} builder for use in a chained invocation\r
+ */\r
+ public final Builder tag(Optional<String> tag) {\r
+ this.tag = Preconditions.checkNotNull(tag, "tag");\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Builds a new {@link ImmutableCatalogOptions ImmutableCatalogOptions}.\r
+ * @return An immutable instance of CatalogOptions\r
+ * @throws java.lang.IllegalStateException if any required attributes are missing\r
+ */\r
+ public ImmutableCatalogOptions build() throws IllegalStateException {\r
+ return new ImmutableCatalogOptions(datacenter, tag);\r
+ }\r
+ }\r
+}\r