com.google.common.truth.extensions.proto.AutoOneOf_SubScopeId Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truth-proto-extension Show documentation
Show all versions of truth-proto-extension Show documentation
An extension for the Truth test assertion framework supporting
Protocol Buffers.
The newest version!
package com.google.common.truth.extensions.proto;
import com.google.protobuf.Descriptors;
// Generated by com.google.auto.value.processor.AutoOneOfProcessor
final class AutoOneOf_SubScopeId {
private AutoOneOf_SubScopeId() {} // There are no instances of this type.
static SubScopeId fieldDescriptor(Descriptors.FieldDescriptor fieldDescriptor) {
if (fieldDescriptor == null) {
throw new NullPointerException();
}
return new Impl_fieldDescriptor(fieldDescriptor);
}
static SubScopeId unknownFieldDescriptor(UnknownFieldDescriptor unknownFieldDescriptor) {
if (unknownFieldDescriptor == null) {
throw new NullPointerException();
}
return new Impl_unknownFieldDescriptor(unknownFieldDescriptor);
}
static SubScopeId unpackedAnyValueType(Descriptors.Descriptor unpackedAnyValueType) {
if (unpackedAnyValueType == null) {
throw new NullPointerException();
}
return new Impl_unpackedAnyValueType(unpackedAnyValueType);
}
// Parent class that each implementation will inherit from.
private abstract static class Parent_ extends SubScopeId {
@Override
Descriptors.FieldDescriptor fieldDescriptor() {
throw new UnsupportedOperationException(kind().toString());
}
@Override
UnknownFieldDescriptor unknownFieldDescriptor() {
throw new UnsupportedOperationException(kind().toString());
}
@Override
Descriptors.Descriptor unpackedAnyValueType() {
throw new UnsupportedOperationException(kind().toString());
}
}
// Implementation when the contained property is "fieldDescriptor".
private static final class Impl_fieldDescriptor extends Parent_ {
private final Descriptors.FieldDescriptor fieldDescriptor;
Impl_fieldDescriptor(Descriptors.FieldDescriptor fieldDescriptor) {
this.fieldDescriptor = fieldDescriptor;
}
@Override
public Descriptors.FieldDescriptor fieldDescriptor() {
return fieldDescriptor;
}
@Override
public String toString() {
return "SubScopeId{fieldDescriptor=" + this.fieldDescriptor + "}";
}
@Override
public boolean equals(Object x) {
if (x instanceof SubScopeId) {
SubScopeId that = (SubScopeId) x;
return this.kind() == that.kind()
&& this.fieldDescriptor.equals(that.fieldDescriptor());
} else {
return false;
}
}
@Override
public int hashCode() {
return fieldDescriptor.hashCode();
}
@Override
public SubScopeId.Kind kind() {
return SubScopeId.Kind.FIELD_DESCRIPTOR;
}
}
// Implementation when the contained property is "unknownFieldDescriptor".
private static final class Impl_unknownFieldDescriptor extends Parent_ {
private final UnknownFieldDescriptor unknownFieldDescriptor;
Impl_unknownFieldDescriptor(UnknownFieldDescriptor unknownFieldDescriptor) {
this.unknownFieldDescriptor = unknownFieldDescriptor;
}
@Override
public UnknownFieldDescriptor unknownFieldDescriptor() {
return unknownFieldDescriptor;
}
@Override
public String toString() {
return "SubScopeId{unknownFieldDescriptor=" + this.unknownFieldDescriptor + "}";
}
@Override
public boolean equals(Object x) {
if (x instanceof SubScopeId) {
SubScopeId that = (SubScopeId) x;
return this.kind() == that.kind()
&& this.unknownFieldDescriptor.equals(that.unknownFieldDescriptor());
} else {
return false;
}
}
@Override
public int hashCode() {
return unknownFieldDescriptor.hashCode();
}
@Override
public SubScopeId.Kind kind() {
return SubScopeId.Kind.UNKNOWN_FIELD_DESCRIPTOR;
}
}
// Implementation when the contained property is "unpackedAnyValueType".
private static final class Impl_unpackedAnyValueType extends Parent_ {
private final Descriptors.Descriptor unpackedAnyValueType;
Impl_unpackedAnyValueType(Descriptors.Descriptor unpackedAnyValueType) {
this.unpackedAnyValueType = unpackedAnyValueType;
}
@Override
public Descriptors.Descriptor unpackedAnyValueType() {
return unpackedAnyValueType;
}
@Override
public String toString() {
return "SubScopeId{unpackedAnyValueType=" + this.unpackedAnyValueType + "}";
}
@Override
public boolean equals(Object x) {
if (x instanceof SubScopeId) {
SubScopeId that = (SubScopeId) x;
return this.kind() == that.kind()
&& this.unpackedAnyValueType.equals(that.unpackedAnyValueType());
} else {
return false;
}
}
@Override
public int hashCode() {
return unpackedAnyValueType.hashCode();
}
@Override
public SubScopeId.Kind kind() {
return SubScopeId.Kind.UNPACKED_ANY_VALUE_TYPE;
}
}
}