// Autogenerated code. Do not modify.
package org.inferred.freebuilder.processor;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.inferred.freebuilder.processor.BuilderFactory;
import org.inferred.freebuilder.processor.Metadata;
import org.inferred.freebuilder.processor.util.Excerpt;
import org.inferred.freebuilder.processor.util.ParameterizedType;
import org.inferred.freebuilder.processor.util.QualifiedName;
/**
* Auto-generated superclass of {@link Metadata.Builder},
* derived from the API of {@link Metadata}.
*/
@Generated("org.inferred.freebuilder.processor.CodeGenerator")
abstract class Metadata_Builder {
/**
* Creates a new builder using {@code value} as a template.
*/
public static Metadata.Builder from(Metadata value) {
return new Metadata.Builder().mergeFrom(value);
}
private static final Joiner COMMA_JOINER = Joiner.on(", ").skipNulls();
private enum Property {
TYPE("type"),
INTERFACE_TYPE("interfaceType"),
GENERATED_BUILDER("generatedBuilder"),
VALUE_TYPE("valueType"),
PARTIAL_TYPE("partialType"),
PROPERTY_ENUM("propertyEnum"),
BUILDER_SERIALIZABLE("builderSerializable"),
HAS_TO_BUILDER_METHOD("hasToBuilderMethod"),
VALUE_TYPE_VISIBILITY("valueTypeVisibility"),
;
private final String name;
private Property(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}
private ParameterizedType type;
private boolean interfaceType;
// Store a nullable object instead of an Optional. Escape analysis then
// allows the JVM to optimize away the Optional objects created by and
// passed to our API.
private ParameterizedType optionalBuilder = null;
// Store a nullable object instead of an Optional. Escape analysis then
// allows the JVM to optimize away the Optional objects created by and
// passed to our API.
private BuilderFactory builderFactory = null;
private ParameterizedType generatedBuilder;
private ParameterizedType valueType;
private ParameterizedType partialType;
private final LinkedHashSet<QualifiedName> visibleNestedTypes =
new LinkedHashSet<QualifiedName>();
private ParameterizedType propertyEnum;
private final ArrayList<Metadata.Property> properties = new ArrayList<Metadata.Property>();
private final LinkedHashMap<Metadata.StandardMethod, Metadata.UnderrideLevel>
standardMethodUnderrides =
new LinkedHashMap<Metadata.StandardMethod, Metadata.UnderrideLevel>();
private boolean builderSerializable;
private boolean hasToBuilderMethod;
private final ArrayList<Excerpt> generatedBuilderAnnotations = new ArrayList<Excerpt>();
private final ArrayList<Excerpt> valueTypeAnnotations = new ArrayList<Excerpt>();
private Metadata.Visibility valueTypeVisibility;
private final ArrayList<Function<Metadata, Excerpt>> nestedClasses =
new ArrayList<Function<Metadata, Excerpt>>();
private final EnumSet<Metadata_Builder.Property> _unsetProperties =
EnumSet.allOf(Metadata_Builder.Property.class);
/**
* Sets the value to be returned by {@link Metadata#getType()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code type} is null
*/
public Metadata.Builder setType(ParameterizedType type) {
this.type = Preconditions.checkNotNull(type);
_unsetProperties.remove(Metadata_Builder.Property.TYPE);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getType()}.
*
* @throws IllegalStateException if the field has not been set
*/
public ParameterizedType getType() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.TYPE), "type not set");
return type;
}
/**
* Sets the value to be returned by {@link Metadata#isInterfaceType()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder setInterfaceType(boolean interfaceType) {
this.interfaceType = interfaceType;
_unsetProperties.remove(Metadata_Builder.Property.INTERFACE_TYPE);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#isInterfaceType()}.
*
* @throws IllegalStateException if the field has not been set
*/
public boolean isInterfaceType() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.INTERFACE_TYPE),
"interfaceType not set");
return interfaceType;
}
/**
* Sets the value to be returned by {@link Metadata#getOptionalBuilder()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code optionalBuilder} is null
*/
public Metadata.Builder setOptionalBuilder(ParameterizedType optionalBuilder) {
this.optionalBuilder = Preconditions.checkNotNull(optionalBuilder);
return (Metadata.Builder) this;
}
/**
* Sets the value to be returned by {@link Metadata#getOptionalBuilder()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder setOptionalBuilder(
Optional<? extends ParameterizedType> optionalBuilder) {
if (optionalBuilder.isPresent()) {
return setOptionalBuilder(optionalBuilder.get());
} else {
return clearOptionalBuilder();
}
}
/**
* Sets the value to be returned by {@link Metadata#getOptionalBuilder()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder setNullableOptionalBuilder(@Nullable ParameterizedType optionalBuilder) {
if (optionalBuilder != null) {
return setOptionalBuilder(optionalBuilder);
} else {
return clearOptionalBuilder();
}
}
/**
* Sets the value to be returned by {@link Metadata#getOptionalBuilder()}
* to {@link Optional#absent() Optional.absent()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder clearOptionalBuilder() {
this.optionalBuilder = null;
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getOptionalBuilder()}.
*/
public Optional<ParameterizedType> getOptionalBuilder() {
return Optional.fromNullable(optionalBuilder);
}
/**
* Sets the value to be returned by {@link Metadata#getBuilderFactory()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code builderFactory} is null
*/
public Metadata.Builder setBuilderFactory(BuilderFactory builderFactory) {
this.builderFactory = Preconditions.checkNotNull(builderFactory);
return (Metadata.Builder) this;
}
/**
* Sets the value to be returned by {@link Metadata#getBuilderFactory()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder setBuilderFactory(Optional<? extends BuilderFactory> builderFactory) {
if (builderFactory.isPresent()) {
return setBuilderFactory(builderFactory.get());
} else {
return clearBuilderFactory();
}
}
/**
* Sets the value to be returned by {@link Metadata#getBuilderFactory()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder setNullableBuilderFactory(@Nullable BuilderFactory builderFactory) {
if (builderFactory != null) {
return setBuilderFactory(builderFactory);
} else {
return clearBuilderFactory();
}
}
/**
* Sets the value to be returned by {@link Metadata#getBuilderFactory()}
* to {@link Optional#absent() Optional.absent()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder clearBuilderFactory() {
this.builderFactory = null;
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getBuilderFactory()}.
*/
public Optional<BuilderFactory> getBuilderFactory() {
return Optional.fromNullable(builderFactory);
}
/**
* Sets the value to be returned by {@link Metadata#getGeneratedBuilder()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code generatedBuilder} is null
*/
public Metadata.Builder setGeneratedBuilder(ParameterizedType generatedBuilder) {
this.generatedBuilder = Preconditions.checkNotNull(generatedBuilder);
_unsetProperties.remove(Metadata_Builder.Property.GENERATED_BUILDER);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getGeneratedBuilder()}.
*
* @throws IllegalStateException if the field has not been set
*/
public ParameterizedType getGeneratedBuilder() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.GENERATED_BUILDER),
"generatedBuilder not set");
return generatedBuilder;
}
/**
* Sets the value to be returned by {@link Metadata#getValueType()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code valueType} is null
*/
public Metadata.Builder setValueType(ParameterizedType valueType) {
this.valueType = Preconditions.checkNotNull(valueType);
_unsetProperties.remove(Metadata_Builder.Property.VALUE_TYPE);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getValueType()}.
*
* @throws IllegalStateException if the field has not been set
*/
public ParameterizedType getValueType() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE), "valueType not set");
return valueType;
}
/**
* Sets the value to be returned by {@link Metadata#getPartialType()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code partialType} is null
*/
public Metadata.Builder setPartialType(ParameterizedType partialType) {
this.partialType = Preconditions.checkNotNull(partialType);
_unsetProperties.remove(Metadata_Builder.Property.PARTIAL_TYPE);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getPartialType()}.
*
* @throws IllegalStateException if the field has not been set
*/
public ParameterizedType getPartialType() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.PARTIAL_TYPE), "partialType not set");
return partialType;
}
/**
* Adds {@code element} to the set to be returned from {@link Metadata#getVisibleNestedTypes()}.
* If the set already contains {@code element}, then {@code addVisibleNestedTypes}
* has no effect (only the previously added element is retained).
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code element} is null
*/
public Metadata.Builder addVisibleNestedTypes(QualifiedName element) {
this.visibleNestedTypes.add(Preconditions.checkNotNull(element));
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the set to be returned from
* {@link Metadata#getVisibleNestedTypes()}, ignoring duplicate elements
* (only the first duplicate element is added).
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addVisibleNestedTypes(QualifiedName... elements) {
for (QualifiedName element : elements) {
addVisibleNestedTypes(element);
}
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the set to be returned from
* {@link Metadata#getVisibleNestedTypes()}, ignoring duplicate elements
* (only the first duplicate element is added).
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addAllVisibleNestedTypes(Iterable<? extends QualifiedName> elements) {
for (QualifiedName element : elements) {
addVisibleNestedTypes(element);
}
return (Metadata.Builder) this;
}
/**
* Removes {@code element} from the set to be returned from {@link Metadata#getVisibleNestedTypes()}.
* Does nothing if {@code element} is not a member of the set.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code element} is null
*/
public Metadata.Builder removeVisibleNestedTypes(QualifiedName element) {
this.visibleNestedTypes.remove(Preconditions.checkNotNull(element));
return (Metadata.Builder) this;
}
/**
* Clears the set to be returned from {@link Metadata#getVisibleNestedTypes()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder clearVisibleNestedTypes() {
visibleNestedTypes.clear();
return (Metadata.Builder) this;
}
/**
* Returns an unmodifiable view of the set that will be returned by
* {@link Metadata#getVisibleNestedTypes()}.
* Changes to this builder will be reflected in the view.
*/
public Set<QualifiedName> getVisibleNestedTypes() {
return Collections.unmodifiableSet(visibleNestedTypes);
}
/**
* Sets the value to be returned by {@link Metadata#getPropertyEnum()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code propertyEnum} is null
*/
public Metadata.Builder setPropertyEnum(ParameterizedType propertyEnum) {
this.propertyEnum = Preconditions.checkNotNull(propertyEnum);
_unsetProperties.remove(Metadata_Builder.Property.PROPERTY_ENUM);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getPropertyEnum()}.
*
* @throws IllegalStateException if the field has not been set
*/
public ParameterizedType getPropertyEnum() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.PROPERTY_ENUM),
"propertyEnum not set");
return propertyEnum;
}
/**
* Adds {@code element} to the list to be returned from {@link Metadata#getProperties()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code element} is null
*/
public Metadata.Builder addProperties(Metadata.Property element) {
this.properties.add(Preconditions.checkNotNull(element));
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the list to be returned from
* {@link Metadata#getProperties()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addProperties(Metadata.Property... elements) {
properties.ensureCapacity(properties.size() + elements.length);
for (Metadata.Property element : elements) {
addProperties(element);
}
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the list to be returned from
* {@link Metadata#getProperties()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addAllProperties(Iterable<? extends Metadata.Property> elements) {
if (elements instanceof Collection) {
properties.ensureCapacity(properties.size() + ((Collection<?>) elements).size());
}
for (Metadata.Property element : elements) {
addProperties(element);
}
return (Metadata.Builder) this;
}
/**
* Clears the list to be returned from {@link Metadata#getProperties()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder clearProperties() {
this.properties.clear();
return (Metadata.Builder) this;
}
/**
* Returns an unmodifiable view of the list that will be returned by
* {@link Metadata#getProperties()}.
* Changes to this builder will be reflected in the view.
*/
public List<Metadata.Property> getProperties() {
return Collections.unmodifiableList(properties);
}
/**
* Associates {@code key} with {@code value} in the map to be returned from
* {@link Metadata#getStandardMethodUnderrides()}.
* If the map previously contained a mapping for the key,
* the old value is replaced by the specified value.
*
* @return this {@code Builder} object
* @throws NullPointerException if either {@code key} or {@code value} are null
*/
public Metadata.Builder putStandardMethodUnderrides(
Metadata.StandardMethod key, Metadata.UnderrideLevel value) {
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(value);
standardMethodUnderrides.put(key, value);
return (Metadata.Builder) this;
}
/**
* Copies all of the mappings from {@code map} to the map to be returned from
* {@link Metadata#getStandardMethodUnderrides()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code map} is null or contains a
* null key or value
*/
public Metadata.Builder putAllStandardMethodUnderrides(
Map<? extends Metadata.StandardMethod, ? extends Metadata.UnderrideLevel> map) {
for (Map.Entry<? extends Metadata.StandardMethod, ? extends Metadata.UnderrideLevel> entry :
map.entrySet()) {
putStandardMethodUnderrides(entry.getKey(), entry.getValue());
}
return (Metadata.Builder) this;
}
/**
* Removes the mapping for {@code key} from the map to be returned from
* {@link Metadata#getStandardMethodUnderrides()}, if one is present.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code key} is null
*/
public Metadata.Builder removeStandardMethodUnderrides(Metadata.StandardMethod key) {
Preconditions.checkNotNull(key);
standardMethodUnderrides.remove(key);
return (Metadata.Builder) this;
}
/**
* Removes all of the mappings from the map to be returned from
* {@link Metadata#getStandardMethodUnderrides()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder clearStandardMethodUnderrides() {
standardMethodUnderrides.clear();
return (Metadata.Builder) this;
}
/**
* Returns an unmodifiable view of the map that will be returned by
* {@link Metadata#getStandardMethodUnderrides()}.
* Changes to this builder will be reflected in the view.
*/
public Map<Metadata.StandardMethod, Metadata.UnderrideLevel> getStandardMethodUnderrides() {
return Collections.unmodifiableMap(standardMethodUnderrides);
}
/**
* Sets the value to be returned by {@link Metadata#isBuilderSerializable()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder setBuilderSerializable(boolean builderSerializable) {
this.builderSerializable = builderSerializable;
_unsetProperties.remove(Metadata_Builder.Property.BUILDER_SERIALIZABLE);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#isBuilderSerializable()}.
*
* @throws IllegalStateException if the field has not been set
*/
public boolean isBuilderSerializable() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.BUILDER_SERIALIZABLE),
"builderSerializable not set");
return builderSerializable;
}
/**
* Sets the value to be returned by {@link Metadata#getHasToBuilderMethod()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder setHasToBuilderMethod(boolean hasToBuilderMethod) {
this.hasToBuilderMethod = hasToBuilderMethod;
_unsetProperties.remove(Metadata_Builder.Property.HAS_TO_BUILDER_METHOD);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getHasToBuilderMethod()}.
*
* @throws IllegalStateException if the field has not been set
*/
public boolean getHasToBuilderMethod() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.HAS_TO_BUILDER_METHOD),
"hasToBuilderMethod not set");
return hasToBuilderMethod;
}
/**
* Adds {@code element} to the list to be returned from {@link Metadata#getGeneratedBuilderAnnotations()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code element} is null
*/
public Metadata.Builder addGeneratedBuilderAnnotations(Excerpt element) {
this.generatedBuilderAnnotations.add(Preconditions.checkNotNull(element));
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the list to be returned from
* {@link Metadata#getGeneratedBuilderAnnotations()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addGeneratedBuilderAnnotations(Excerpt... elements) {
generatedBuilderAnnotations.ensureCapacity(
generatedBuilderAnnotations.size() + elements.length);
for (Excerpt element : elements) {
addGeneratedBuilderAnnotations(element);
}
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the list to be returned from
* {@link Metadata#getGeneratedBuilderAnnotations()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addAllGeneratedBuilderAnnotations(Iterable<? extends Excerpt> elements) {
if (elements instanceof Collection) {
generatedBuilderAnnotations.ensureCapacity(
generatedBuilderAnnotations.size() + ((Collection<?>) elements).size());
}
for (Excerpt element : elements) {
addGeneratedBuilderAnnotations(element);
}
return (Metadata.Builder) this;
}
/**
* Clears the list to be returned from {@link Metadata#getGeneratedBuilderAnnotations()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder clearGeneratedBuilderAnnotations() {
this.generatedBuilderAnnotations.clear();
return (Metadata.Builder) this;
}
/**
* Returns an unmodifiable view of the list that will be returned by
* {@link Metadata#getGeneratedBuilderAnnotations()}.
* Changes to this builder will be reflected in the view.
*/
public List<Excerpt> getGeneratedBuilderAnnotations() {
return Collections.unmodifiableList(generatedBuilderAnnotations);
}
/**
* Adds {@code element} to the list to be returned from {@link Metadata#getValueTypeAnnotations()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code element} is null
*/
public Metadata.Builder addValueTypeAnnotations(Excerpt element) {
this.valueTypeAnnotations.add(Preconditions.checkNotNull(element));
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the list to be returned from
* {@link Metadata#getValueTypeAnnotations()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addValueTypeAnnotations(Excerpt... elements) {
valueTypeAnnotations.ensureCapacity(valueTypeAnnotations.size() + elements.length);
for (Excerpt element : elements) {
addValueTypeAnnotations(element);
}
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the list to be returned from
* {@link Metadata#getValueTypeAnnotations()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addAllValueTypeAnnotations(Iterable<? extends Excerpt> elements) {
if (elements instanceof Collection) {
valueTypeAnnotations.ensureCapacity(
valueTypeAnnotations.size() + ((Collection<?>) elements).size());
}
for (Excerpt element : elements) {
addValueTypeAnnotations(element);
}
return (Metadata.Builder) this;
}
/**
* Clears the list to be returned from {@link Metadata#getValueTypeAnnotations()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder clearValueTypeAnnotations() {
this.valueTypeAnnotations.clear();
return (Metadata.Builder) this;
}
/**
* Returns an unmodifiable view of the list that will be returned by
* {@link Metadata#getValueTypeAnnotations()}.
* Changes to this builder will be reflected in the view.
*/
public List<Excerpt> getValueTypeAnnotations() {
return Collections.unmodifiableList(valueTypeAnnotations);
}
/**
* Sets the value to be returned by {@link Metadata#getValueTypeVisibility()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code valueTypeVisibility} is null
*/
public Metadata.Builder setValueTypeVisibility(Metadata.Visibility valueTypeVisibility) {
this.valueTypeVisibility = Preconditions.checkNotNull(valueTypeVisibility);
_unsetProperties.remove(Metadata_Builder.Property.VALUE_TYPE_VISIBILITY);
return (Metadata.Builder) this;
}
/**
* Returns the value that will be returned by {@link Metadata#getValueTypeVisibility()}.
*
* @throws IllegalStateException if the field has not been set
*/
public Metadata.Visibility getValueTypeVisibility() {
Preconditions.checkState(
!_unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE_VISIBILITY),
"valueTypeVisibility not set");
return valueTypeVisibility;
}
/**
* Adds {@code element} to the list to be returned from {@link Metadata#getNestedClasses()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code element} is null
*/
public Metadata.Builder addNestedClasses(Function<Metadata, Excerpt> element) {
this.nestedClasses.add(Preconditions.checkNotNull(element));
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the list to be returned from
* {@link Metadata#getNestedClasses()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addNestedClasses(Function<Metadata, Excerpt>... elements) {
nestedClasses.ensureCapacity(nestedClasses.size() + elements.length);
for (Function<Metadata, Excerpt> element : elements) {
addNestedClasses(element);
}
return (Metadata.Builder) this;
}
/**
* Adds each element of {@code elements} to the list to be returned from
* {@link Metadata#getNestedClasses()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code elements} is null or contains a
* null element
*/
public Metadata.Builder addAllNestedClasses(
Iterable<? extends Function<Metadata, Excerpt>> elements) {
if (elements instanceof Collection) {
nestedClasses.ensureCapacity(nestedClasses.size() + ((Collection<?>) elements).size());
}
for (Function<Metadata, Excerpt> element : elements) {
addNestedClasses(element);
}
return (Metadata.Builder) this;
}
/**
* Clears the list to be returned from {@link Metadata#getNestedClasses()}.
*
* @return this {@code Builder} object
*/
public Metadata.Builder clearNestedClasses() {
this.nestedClasses.clear();
return (Metadata.Builder) this;
}
/**
* Returns an unmodifiable view of the list that will be returned by
* {@link Metadata#getNestedClasses()}.
* Changes to this builder will be reflected in the view.
*/
public List<Function<Metadata, Excerpt>> getNestedClasses() {
return Collections.unmodifiableList(nestedClasses);
}
/**
* Sets all property values using the given {@code Metadata} as a template.
*/
public Metadata.Builder mergeFrom(Metadata value) {
Metadata_Builder _defaults = new Metadata.Builder();
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.TYPE)
|| !value.getType().equals(_defaults.getType())) {
setType(value.getType());
}
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.INTERFACE_TYPE)
|| value.isInterfaceType() != _defaults.isInterfaceType()) {
setInterfaceType(value.isInterfaceType());
}
if (value.getOptionalBuilder().isPresent()) {
setOptionalBuilder(value.getOptionalBuilder().get());
}
if (value.getBuilderFactory().isPresent()) {
setBuilderFactory(value.getBuilderFactory().get());
}
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.GENERATED_BUILDER)
|| !value.getGeneratedBuilder().equals(_defaults.getGeneratedBuilder())) {
setGeneratedBuilder(value.getGeneratedBuilder());
}
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE)
|| !value.getValueType().equals(_defaults.getValueType())) {
setValueType(value.getValueType());
}
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.PARTIAL_TYPE)
|| !value.getPartialType().equals(_defaults.getPartialType())) {
setPartialType(value.getPartialType());
}
addAllVisibleNestedTypes(value.getVisibleNestedTypes());
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.PROPERTY_ENUM)
|| !value.getPropertyEnum().equals(_defaults.getPropertyEnum())) {
setPropertyEnum(value.getPropertyEnum());
}
addAllProperties(value.getProperties());
putAllStandardMethodUnderrides(value.getStandardMethodUnderrides());
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.BUILDER_SERIALIZABLE)
|| value.isBuilderSerializable() != _defaults.isBuilderSerializable()) {
setBuilderSerializable(value.isBuilderSerializable());
}
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.HAS_TO_BUILDER_METHOD)
|| value.getHasToBuilderMethod() != _defaults.getHasToBuilderMethod()) {
setHasToBuilderMethod(value.getHasToBuilderMethod());
}
addAllGeneratedBuilderAnnotations(value.getGeneratedBuilderAnnotations());
addAllValueTypeAnnotations(value.getValueTypeAnnotations());
if (_defaults._unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE_VISIBILITY)
|| !value.getValueTypeVisibility().equals(_defaults.getValueTypeVisibility())) {
setValueTypeVisibility(value.getValueTypeVisibility());
}
addAllNestedClasses(value.getNestedClasses());
return (Metadata.Builder) this;
}
/**
* Copies values from the given {@code Builder}.
* Does not affect any properties not set on the input.
*/
public Metadata.Builder mergeFrom(Metadata.Builder template) {
// Upcast to access private fields; otherwise, oddly, we get an access violation.
Metadata_Builder base = (Metadata_Builder) template;
Metadata_Builder _defaults = new Metadata.Builder();
if (!base._unsetProperties.contains(Metadata_Builder.Property.TYPE)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.TYPE)
|| !template.getType().equals(_defaults.getType()))) {
setType(template.getType());
}
if (!base._unsetProperties.contains(Metadata_Builder.Property.INTERFACE_TYPE)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.INTERFACE_TYPE)
|| template.isInterfaceType() != _defaults.isInterfaceType())) {
setInterfaceType(template.isInterfaceType());
}
if (template.getOptionalBuilder().isPresent()) {
setOptionalBuilder(template.getOptionalBuilder().get());
}
if (template.getBuilderFactory().isPresent()) {
setBuilderFactory(template.getBuilderFactory().get());
}
if (!base._unsetProperties.contains(Metadata_Builder.Property.GENERATED_BUILDER)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.GENERATED_BUILDER)
|| !template.getGeneratedBuilder().equals(_defaults.getGeneratedBuilder()))) {
setGeneratedBuilder(template.getGeneratedBuilder());
}
if (!base._unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE)
|| !template.getValueType().equals(_defaults.getValueType()))) {
setValueType(template.getValueType());
}
if (!base._unsetProperties.contains(Metadata_Builder.Property.PARTIAL_TYPE)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.PARTIAL_TYPE)
|| !template.getPartialType().equals(_defaults.getPartialType()))) {
setPartialType(template.getPartialType());
}
addAllVisibleNestedTypes(((Metadata_Builder) template).visibleNestedTypes);
if (!base._unsetProperties.contains(Metadata_Builder.Property.PROPERTY_ENUM)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.PROPERTY_ENUM)
|| !template.getPropertyEnum().equals(_defaults.getPropertyEnum()))) {
setPropertyEnum(template.getPropertyEnum());
}
addAllProperties(((Metadata_Builder) template).properties);
putAllStandardMethodUnderrides(((Metadata_Builder) template).standardMethodUnderrides);
if (!base._unsetProperties.contains(Metadata_Builder.Property.BUILDER_SERIALIZABLE)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.BUILDER_SERIALIZABLE)
|| template.isBuilderSerializable() != _defaults.isBuilderSerializable())) {
setBuilderSerializable(template.isBuilderSerializable());
}
if (!base._unsetProperties.contains(Metadata_Builder.Property.HAS_TO_BUILDER_METHOD)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.HAS_TO_BUILDER_METHOD)
|| template.getHasToBuilderMethod() != _defaults.getHasToBuilderMethod())) {
setHasToBuilderMethod(template.getHasToBuilderMethod());
}
addAllGeneratedBuilderAnnotations(((Metadata_Builder) template).generatedBuilderAnnotations);
addAllValueTypeAnnotations(((Metadata_Builder) template).valueTypeAnnotations);
if (!base._unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE_VISIBILITY)
&& (_defaults._unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE_VISIBILITY)
|| !template.getValueTypeVisibility().equals(_defaults.getValueTypeVisibility()))) {
setValueTypeVisibility(template.getValueTypeVisibility());
}
addAllNestedClasses(((Metadata_Builder) template).nestedClasses);
return (Metadata.Builder) this;
}
/**
* Resets the state of this builder.
*/
public Metadata.Builder clear() {
Metadata_Builder _defaults = new Metadata.Builder();
type = _defaults.type;
interfaceType = _defaults.interfaceType;
optionalBuilder = _defaults.optionalBuilder;
builderFactory = _defaults.builderFactory;
generatedBuilder = _defaults.generatedBuilder;
valueType = _defaults.valueType;
partialType = _defaults.partialType;
visibleNestedTypes.clear();
propertyEnum = _defaults.propertyEnum;
properties.clear();
standardMethodUnderrides.clear();
builderSerializable = _defaults.builderSerializable;
hasToBuilderMethod = _defaults.hasToBuilderMethod;
generatedBuilderAnnotations.clear();
valueTypeAnnotations.clear();
valueTypeVisibility = _defaults.valueTypeVisibility;
nestedClasses.clear();
_unsetProperties.clear();
_unsetProperties.addAll(_defaults._unsetProperties);
return (Metadata.Builder) this;
}
/**
* Returns a newly-created {@link Metadata} based on the contents of the {@code Builder}.
*
* @throws IllegalStateException if any field has not been set
*/
public Metadata build() {
Preconditions.checkState(_unsetProperties.isEmpty(), "Not set: %s", _unsetProperties);
return new Metadata_Builder.Value(this);
}
/**
* Returns a newly-created partial {@link Metadata}
* based on the contents of the {@code Builder}.
* State checking will not be performed.
* Unset properties will throw an {@link UnsupportedOperationException}
* when accessed via the partial object.
*
* <p>Partials should only ever be used in tests.
*/
@VisibleForTesting()
public Metadata buildPartial() {
return new Metadata_Builder.Partial(this);
}
private static final class Value extends Metadata {
private final ParameterizedType type;
private final boolean interfaceType;
// Store a nullable object instead of an Optional. Escape analysis then
// allows the JVM to optimize away the Optional objects created by our
// getter method.
private final ParameterizedType optionalBuilder;
// Store a nullable object instead of an Optional. Escape analysis then
// allows the JVM to optimize away the Optional objects created by our
// getter method.
private final BuilderFactory builderFactory;
private final ParameterizedType generatedBuilder;
private final ParameterizedType valueType;
private final ParameterizedType partialType;
private final ImmutableSet<QualifiedName> visibleNestedTypes;
private final ParameterizedType propertyEnum;
private final ImmutableList<Metadata.Property> properties;
private final ImmutableMap<Metadata.StandardMethod, Metadata.UnderrideLevel>
standardMethodUnderrides;
private final boolean builderSerializable;
private final boolean hasToBuilderMethod;
private final ImmutableList<Excerpt> generatedBuilderAnnotations;
private final ImmutableList<Excerpt> valueTypeAnnotations;
private final Metadata.Visibility valueTypeVisibility;
private final ImmutableList<Function<Metadata, Excerpt>> nestedClasses;
private Value(Metadata_Builder builder) {
this.type = builder.type;
this.interfaceType = builder.interfaceType;
this.optionalBuilder = builder.optionalBuilder;
this.builderFactory = builder.builderFactory;
this.generatedBuilder = builder.generatedBuilder;
this.valueType = builder.valueType;
this.partialType = builder.partialType;
this.visibleNestedTypes = ImmutableSet.copyOf(builder.visibleNestedTypes);
this.propertyEnum = builder.propertyEnum;
this.properties = ImmutableList.copyOf(builder.properties);
this.standardMethodUnderrides = ImmutableMap.copyOf(builder.standardMethodUnderrides);
this.builderSerializable = builder.builderSerializable;
this.hasToBuilderMethod = builder.hasToBuilderMethod;
this.generatedBuilderAnnotations = ImmutableList.copyOf(builder.generatedBuilderAnnotations);
this.valueTypeAnnotations = ImmutableList.copyOf(builder.valueTypeAnnotations);
this.valueTypeVisibility = builder.valueTypeVisibility;
this.nestedClasses = ImmutableList.copyOf(builder.nestedClasses);
}
@Override
public ParameterizedType getType() {
return type;
}
@Override
public boolean isInterfaceType() {
return interfaceType;
}
@Override
public Optional<ParameterizedType> getOptionalBuilder() {
return Optional.fromNullable(optionalBuilder);
}
@Override
public Optional<BuilderFactory> getBuilderFactory() {
return Optional.fromNullable(builderFactory);
}
@Override
public ParameterizedType getGeneratedBuilder() {
return generatedBuilder;
}
@Override
public ParameterizedType getValueType() {
return valueType;
}
@Override
public ParameterizedType getPartialType() {
return partialType;
}
@Override
public ImmutableSet<QualifiedName> getVisibleNestedTypes() {
return visibleNestedTypes;
}
@Override
public ParameterizedType getPropertyEnum() {
return propertyEnum;
}
@Override
public ImmutableList<Metadata.Property> getProperties() {
return properties;
}
@Override
public ImmutableMap<Metadata.StandardMethod, Metadata.UnderrideLevel>
getStandardMethodUnderrides() {
return standardMethodUnderrides;
}
@Override
public boolean isBuilderSerializable() {
return builderSerializable;
}
@Override
public boolean getHasToBuilderMethod() {
return hasToBuilderMethod;
}
@Override
public ImmutableList<Excerpt> getGeneratedBuilderAnnotations() {
return generatedBuilderAnnotations;
}
@Override
public ImmutableList<Excerpt> getValueTypeAnnotations() {
return valueTypeAnnotations;
}
@Override
public Metadata.Visibility getValueTypeVisibility() {
return valueTypeVisibility;
}
@Override
public ImmutableList<Function<Metadata, Excerpt>> getNestedClasses() {
return nestedClasses;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Metadata_Builder.Value)) {
return false;
}
Metadata_Builder.Value other = (Metadata_Builder.Value) obj;
if (!type.equals(other.type)) {
return false;
}
if (interfaceType != other.interfaceType) {
return false;
}
if (optionalBuilder != other.optionalBuilder
&& (optionalBuilder == null || !optionalBuilder.equals(other.optionalBuilder))) {
return false;
}
if (builderFactory != other.builderFactory
&& (builderFactory == null || !builderFactory.equals(other.builderFactory))) {
return false;
}
if (!generatedBuilder.equals(other.generatedBuilder)) {
return false;
}
if (!valueType.equals(other.valueType)) {
return false;
}
if (!partialType.equals(other.partialType)) {
return false;
}
if (!visibleNestedTypes.equals(other.visibleNestedTypes)) {
return false;
}
if (!propertyEnum.equals(other.propertyEnum)) {
return false;
}
if (!properties.equals(other.properties)) {
return false;
}
if (!standardMethodUnderrides.equals(other.standardMethodUnderrides)) {
return false;
}
if (builderSerializable != other.builderSerializable) {
return false;
}
if (hasToBuilderMethod != other.hasToBuilderMethod) {
return false;
}
if (!generatedBuilderAnnotations.equals(other.generatedBuilderAnnotations)) {
return false;
}
if (!valueTypeAnnotations.equals(other.valueTypeAnnotations)) {
return false;
}
if (!valueTypeVisibility.equals(other.valueTypeVisibility)) {
return false;
}
if (!nestedClasses.equals(other.nestedClasses)) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Arrays.hashCode(
new Object[] {
type,
interfaceType,
optionalBuilder,
builderFactory,
generatedBuilder,
valueType,
partialType,
visibleNestedTypes,
propertyEnum,
properties,
standardMethodUnderrides,
builderSerializable,
hasToBuilderMethod,
generatedBuilderAnnotations,
valueTypeAnnotations,
valueTypeVisibility,
nestedClasses
});
}
@Override
public String toString() {
return "Metadata{"
+ COMMA_JOINER.join(
"type=" + type,
"interfaceType=" + interfaceType,
(optionalBuilder != null ? "optionalBuilder=" + optionalBuilder : null),
(builderFactory != null ? "builderFactory=" + builderFactory : null),
"generatedBuilder=" + generatedBuilder,
"valueType=" + valueType,
"partialType=" + partialType,
"visibleNestedTypes=" + visibleNestedTypes,
"propertyEnum=" + propertyEnum,
"properties=" + properties,
"standardMethodUnderrides=" + standardMethodUnderrides,
"builderSerializable=" + builderSerializable,
"hasToBuilderMethod=" + hasToBuilderMethod,
"generatedBuilderAnnotations=" + generatedBuilderAnnotations,
"valueTypeAnnotations=" + valueTypeAnnotations,
"valueTypeVisibility=" + valueTypeVisibility,
"nestedClasses=" + nestedClasses)
+ "}";
}
}
private static final class Partial extends Metadata {
private final ParameterizedType type;
private final boolean interfaceType;
// Store a nullable object instead of an Optional. Escape analysis then
// allows the JVM to optimize away the Optional objects created by our
// getter method.
private final ParameterizedType optionalBuilder;
// Store a nullable object instead of an Optional. Escape analysis then
// allows the JVM to optimize away the Optional objects created by our
// getter method.
private final BuilderFactory builderFactory;
private final ParameterizedType generatedBuilder;
private final ParameterizedType valueType;
private final ParameterizedType partialType;
private final ImmutableSet<QualifiedName> visibleNestedTypes;
private final ParameterizedType propertyEnum;
private final ImmutableList<Metadata.Property> properties;
private final ImmutableMap<Metadata.StandardMethod, Metadata.UnderrideLevel>
standardMethodUnderrides;
private final boolean builderSerializable;
private final boolean hasToBuilderMethod;
private final ImmutableList<Excerpt> generatedBuilderAnnotations;
private final ImmutableList<Excerpt> valueTypeAnnotations;
private final Metadata.Visibility valueTypeVisibility;
private final ImmutableList<Function<Metadata, Excerpt>> nestedClasses;
private final EnumSet<Metadata_Builder.Property> _unsetProperties;
Partial(Metadata_Builder builder) {
this.type = builder.type;
this.interfaceType = builder.interfaceType;
this.optionalBuilder = builder.optionalBuilder;
this.builderFactory = builder.builderFactory;
this.generatedBuilder = builder.generatedBuilder;
this.valueType = builder.valueType;
this.partialType = builder.partialType;
this.visibleNestedTypes = ImmutableSet.copyOf(builder.visibleNestedTypes);
this.propertyEnum = builder.propertyEnum;
this.properties = ImmutableList.copyOf(builder.properties);
this.standardMethodUnderrides = ImmutableMap.copyOf(builder.standardMethodUnderrides);
this.builderSerializable = builder.builderSerializable;
this.hasToBuilderMethod = builder.hasToBuilderMethod;
this.generatedBuilderAnnotations = ImmutableList.copyOf(builder.generatedBuilderAnnotations);
this.valueTypeAnnotations = ImmutableList.copyOf(builder.valueTypeAnnotations);
this.valueTypeVisibility = builder.valueTypeVisibility;
this.nestedClasses = ImmutableList.copyOf(builder.nestedClasses);
this._unsetProperties = builder._unsetProperties.clone();
}
@Override
public ParameterizedType getType() {
if (_unsetProperties.contains(Metadata_Builder.Property.TYPE)) {
throw new UnsupportedOperationException("type not set");
}
return type;
}
@Override
public boolean isInterfaceType() {
if (_unsetProperties.contains(Metadata_Builder.Property.INTERFACE_TYPE)) {
throw new UnsupportedOperationException("interfaceType not set");
}
return interfaceType;
}
@Override
public Optional<ParameterizedType> getOptionalBuilder() {
return Optional.fromNullable(optionalBuilder);
}
@Override
public Optional<BuilderFactory> getBuilderFactory() {
return Optional.fromNullable(builderFactory);
}
@Override
public ParameterizedType getGeneratedBuilder() {
if (_unsetProperties.contains(Metadata_Builder.Property.GENERATED_BUILDER)) {
throw new UnsupportedOperationException("generatedBuilder not set");
}
return generatedBuilder;
}
@Override
public ParameterizedType getValueType() {
if (_unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE)) {
throw new UnsupportedOperationException("valueType not set");
}
return valueType;
}
@Override
public ParameterizedType getPartialType() {
if (_unsetProperties.contains(Metadata_Builder.Property.PARTIAL_TYPE)) {
throw new UnsupportedOperationException("partialType not set");
}
return partialType;
}
@Override
public ImmutableSet<QualifiedName> getVisibleNestedTypes() {
return visibleNestedTypes;
}
@Override
public ParameterizedType getPropertyEnum() {
if (_unsetProperties.contains(Metadata_Builder.Property.PROPERTY_ENUM)) {
throw new UnsupportedOperationException("propertyEnum not set");
}
return propertyEnum;
}
@Override
public ImmutableList<Metadata.Property> getProperties() {
return properties;
}
@Override
public ImmutableMap<Metadata.StandardMethod, Metadata.UnderrideLevel>
getStandardMethodUnderrides() {
return standardMethodUnderrides;
}
@Override
public boolean isBuilderSerializable() {
if (_unsetProperties.contains(Metadata_Builder.Property.BUILDER_SERIALIZABLE)) {
throw new UnsupportedOperationException("builderSerializable not set");
}
return builderSerializable;
}
@Override
public boolean getHasToBuilderMethod() {
if (_unsetProperties.contains(Metadata_Builder.Property.HAS_TO_BUILDER_METHOD)) {
throw new UnsupportedOperationException("hasToBuilderMethod not set");
}
return hasToBuilderMethod;
}
@Override
public ImmutableList<Excerpt> getGeneratedBuilderAnnotations() {
return generatedBuilderAnnotations;
}
@Override
public ImmutableList<Excerpt> getValueTypeAnnotations() {
return valueTypeAnnotations;
}
@Override
public Metadata.Visibility getValueTypeVisibility() {
if (_unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE_VISIBILITY)) {
throw new UnsupportedOperationException("valueTypeVisibility not set");
}
return valueTypeVisibility;
}
@Override
public ImmutableList<Function<Metadata, Excerpt>> getNestedClasses() {
return nestedClasses;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Metadata_Builder.Partial)) {
return false;
}
Metadata_Builder.Partial other = (Metadata_Builder.Partial) obj;
if (type != other.type && (type == null || !type.equals(other.type))) {
return false;
}
if (interfaceType != other.interfaceType) {
return false;
}
if (optionalBuilder != other.optionalBuilder
&& (optionalBuilder == null || !optionalBuilder.equals(other.optionalBuilder))) {
return false;
}
if (builderFactory != other.builderFactory
&& (builderFactory == null || !builderFactory.equals(other.builderFactory))) {
return false;
}
if (generatedBuilder != other.generatedBuilder
&& (generatedBuilder == null || !generatedBuilder.equals(other.generatedBuilder))) {
return false;
}
if (valueType != other.valueType
&& (valueType == null || !valueType.equals(other.valueType))) {
return false;
}
if (partialType != other.partialType
&& (partialType == null || !partialType.equals(other.partialType))) {
return false;
}
if (!visibleNestedTypes.equals(other.visibleNestedTypes)) {
return false;
}
if (propertyEnum != other.propertyEnum
&& (propertyEnum == null || !propertyEnum.equals(other.propertyEnum))) {
return false;
}
if (!properties.equals(other.properties)) {
return false;
}
if (!standardMethodUnderrides.equals(other.standardMethodUnderrides)) {
return false;
}
if (builderSerializable != other.builderSerializable) {
return false;
}
if (hasToBuilderMethod != other.hasToBuilderMethod) {
return false;
}
if (!generatedBuilderAnnotations.equals(other.generatedBuilderAnnotations)) {
return false;
}
if (!valueTypeAnnotations.equals(other.valueTypeAnnotations)) {
return false;
}
if (valueTypeVisibility != other.valueTypeVisibility
&& (valueTypeVisibility == null
|| !valueTypeVisibility.equals(other.valueTypeVisibility))) {
return false;
}
if (!nestedClasses.equals(other.nestedClasses)) {
return false;
}
return _unsetProperties.equals(other._unsetProperties);
}
@Override
public int hashCode() {
return Arrays.hashCode(
new Object[] {
type,
interfaceType,
optionalBuilder,
builderFactory,
generatedBuilder,
valueType,
partialType,
visibleNestedTypes,
propertyEnum,
properties,
standardMethodUnderrides,
builderSerializable,
hasToBuilderMethod,
generatedBuilderAnnotations,
valueTypeAnnotations,
valueTypeVisibility,
nestedClasses,
_unsetProperties
});
}
@Override
public String toString() {
return "partial Metadata{"
+ COMMA_JOINER.join(
(!_unsetProperties.contains(Metadata_Builder.Property.TYPE) ? "type=" + type : null),
(!_unsetProperties.contains(Metadata_Builder.Property.INTERFACE_TYPE)
? "interfaceType=" + interfaceType
: null),
(optionalBuilder != null ? "optionalBuilder=" + optionalBuilder : null),
(builderFactory != null ? "builderFactory=" + builderFactory : null),
(!_unsetProperties.contains(Metadata_Builder.Property.GENERATED_BUILDER)
? "generatedBuilder=" + generatedBuilder
: null),
(!_unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE)
? "valueType=" + valueType
: null),
(!_unsetProperties.contains(Metadata_Builder.Property.PARTIAL_TYPE)
? "partialType=" + partialType
: null),
"visibleNestedTypes=" + visibleNestedTypes,
(!_unsetProperties.contains(Metadata_Builder.Property.PROPERTY_ENUM)
? "propertyEnum=" + propertyEnum
: null),
"properties=" + properties,
"standardMethodUnderrides=" + standardMethodUnderrides,
(!_unsetProperties.contains(Metadata_Builder.Property.BUILDER_SERIALIZABLE)
? "builderSerializable=" + builderSerializable
: null),
(!_unsetProperties.contains(Metadata_Builder.Property.HAS_TO_BUILDER_METHOD)
? "hasToBuilderMethod=" + hasToBuilderMethod
: null),
"generatedBuilderAnnotations=" + generatedBuilderAnnotations,
"valueTypeAnnotations=" + valueTypeAnnotations,
(!_unsetProperties.contains(Metadata_Builder.Property.VALUE_TYPE_VISIBILITY)
? "valueTypeVisibility=" + valueTypeVisibility
: null),
"nestedClasses=" + nestedClasses)
+ "}";
}
}
}