io.grafeas.v1.SourceContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grafeas Show documentation
Show all versions of grafeas Show documentation
Java idiomatic client for Grafeas.
/*
* Copyright 2019 The Grafeas Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: grafeas/v1/provenance.proto
package io.grafeas.v1;
/**
*
*
*
* A SourceContext is a reference to a tree of files. A SourceContext together
* with a path point to a unique revision of a single file or directory.
*
*
* Protobuf type {@code grafeas.v1.SourceContext}
*/
public final class SourceContext extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:grafeas.v1.SourceContext)
SourceContextOrBuilder {
private static final long serialVersionUID = 0L;
// Use SourceContext.newBuilder() to construct.
private SourceContext(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private SourceContext() {}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new SourceContext();
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return io.grafeas.v1.Provenance.internal_static_grafeas_v1_SourceContext_descriptor;
}
@SuppressWarnings({"rawtypes"})
@java.lang.Override
protected com.google.protobuf.MapField internalGetMapField(int number) {
switch (number) {
case 4:
return internalGetLabels();
default:
throw new RuntimeException("Invalid map field number: " + number);
}
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grafeas.v1.Provenance.internal_static_grafeas_v1_SourceContext_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grafeas.v1.SourceContext.class, io.grafeas.v1.SourceContext.Builder.class);
}
private int contextCase_ = 0;
@SuppressWarnings("serial")
private java.lang.Object context_;
public enum ContextCase
implements
com.google.protobuf.Internal.EnumLite,
com.google.protobuf.AbstractMessage.InternalOneOfEnum {
CLOUD_REPO(1),
GERRIT(2),
GIT(3),
CONTEXT_NOT_SET(0);
private final int value;
private ContextCase(int value) {
this.value = value;
}
/**
* @param value The number of the enum to look for.
* @return The enum associated with the given number.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static ContextCase valueOf(int value) {
return forNumber(value);
}
public static ContextCase forNumber(int value) {
switch (value) {
case 1:
return CLOUD_REPO;
case 2:
return GERRIT;
case 3:
return GIT;
case 0:
return CONTEXT_NOT_SET;
default:
return null;
}
}
public int getNumber() {
return this.value;
}
};
public ContextCase getContextCase() {
return ContextCase.forNumber(contextCase_);
}
public static final int CLOUD_REPO_FIELD_NUMBER = 1;
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*
* @return Whether the cloudRepo field is set.
*/
@java.lang.Override
public boolean hasCloudRepo() {
return contextCase_ == 1;
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*
* @return The cloudRepo.
*/
@java.lang.Override
public io.grafeas.v1.CloudRepoSourceContext getCloudRepo() {
if (contextCase_ == 1) {
return (io.grafeas.v1.CloudRepoSourceContext) context_;
}
return io.grafeas.v1.CloudRepoSourceContext.getDefaultInstance();
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*/
@java.lang.Override
public io.grafeas.v1.CloudRepoSourceContextOrBuilder getCloudRepoOrBuilder() {
if (contextCase_ == 1) {
return (io.grafeas.v1.CloudRepoSourceContext) context_;
}
return io.grafeas.v1.CloudRepoSourceContext.getDefaultInstance();
}
public static final int GERRIT_FIELD_NUMBER = 2;
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*
* @return Whether the gerrit field is set.
*/
@java.lang.Override
public boolean hasGerrit() {
return contextCase_ == 2;
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*
* @return The gerrit.
*/
@java.lang.Override
public io.grafeas.v1.GerritSourceContext getGerrit() {
if (contextCase_ == 2) {
return (io.grafeas.v1.GerritSourceContext) context_;
}
return io.grafeas.v1.GerritSourceContext.getDefaultInstance();
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*/
@java.lang.Override
public io.grafeas.v1.GerritSourceContextOrBuilder getGerritOrBuilder() {
if (contextCase_ == 2) {
return (io.grafeas.v1.GerritSourceContext) context_;
}
return io.grafeas.v1.GerritSourceContext.getDefaultInstance();
}
public static final int GIT_FIELD_NUMBER = 3;
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*
* @return Whether the git field is set.
*/
@java.lang.Override
public boolean hasGit() {
return contextCase_ == 3;
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*
* @return The git.
*/
@java.lang.Override
public io.grafeas.v1.GitSourceContext getGit() {
if (contextCase_ == 3) {
return (io.grafeas.v1.GitSourceContext) context_;
}
return io.grafeas.v1.GitSourceContext.getDefaultInstance();
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*/
@java.lang.Override
public io.grafeas.v1.GitSourceContextOrBuilder getGitOrBuilder() {
if (contextCase_ == 3) {
return (io.grafeas.v1.GitSourceContext) context_;
}
return io.grafeas.v1.GitSourceContext.getDefaultInstance();
}
public static final int LABELS_FIELD_NUMBER = 4;
private static final class LabelsDefaultEntryHolder {
static final com.google.protobuf.MapEntry defaultEntry =
com.google.protobuf.MapEntry.newDefaultInstance(
io.grafeas.v1.Provenance
.internal_static_grafeas_v1_SourceContext_LabelsEntry_descriptor,
com.google.protobuf.WireFormat.FieldType.STRING,
"",
com.google.protobuf.WireFormat.FieldType.STRING,
"");
}
@SuppressWarnings("serial")
private com.google.protobuf.MapField labels_;
private com.google.protobuf.MapField internalGetLabels() {
if (labels_ == null) {
return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
}
return labels_;
}
public int getLabelsCount() {
return internalGetLabels().getMap().size();
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
@java.lang.Override
public boolean containsLabels(java.lang.String key) {
if (key == null) {
throw new NullPointerException("map key");
}
return internalGetLabels().getMap().containsKey(key);
}
/** Use {@link #getLabelsMap()} instead. */
@java.lang.Override
@java.lang.Deprecated
public java.util.Map getLabels() {
return getLabelsMap();
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
@java.lang.Override
public java.util.Map getLabelsMap() {
return internalGetLabels().getMap();
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
@java.lang.Override
public /* nullable */ java.lang.String getLabelsOrDefault(
java.lang.String key,
/* nullable */
java.lang.String defaultValue) {
if (key == null) {
throw new NullPointerException("map key");
}
java.util.Map map = internalGetLabels().getMap();
return map.containsKey(key) ? map.get(key) : defaultValue;
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
@java.lang.Override
public java.lang.String getLabelsOrThrow(java.lang.String key) {
if (key == null) {
throw new NullPointerException("map key");
}
java.util.Map map = internalGetLabels().getMap();
if (!map.containsKey(key)) {
throw new java.lang.IllegalArgumentException();
}
return map.get(key);
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (contextCase_ == 1) {
output.writeMessage(1, (io.grafeas.v1.CloudRepoSourceContext) context_);
}
if (contextCase_ == 2) {
output.writeMessage(2, (io.grafeas.v1.GerritSourceContext) context_);
}
if (contextCase_ == 3) {
output.writeMessage(3, (io.grafeas.v1.GitSourceContext) context_);
}
com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 4);
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (contextCase_ == 1) {
size +=
com.google.protobuf.CodedOutputStream.computeMessageSize(
1, (io.grafeas.v1.CloudRepoSourceContext) context_);
}
if (contextCase_ == 2) {
size +=
com.google.protobuf.CodedOutputStream.computeMessageSize(
2, (io.grafeas.v1.GerritSourceContext) context_);
}
if (contextCase_ == 3) {
size +=
com.google.protobuf.CodedOutputStream.computeMessageSize(
3, (io.grafeas.v1.GitSourceContext) context_);
}
for (java.util.Map.Entry entry :
internalGetLabels().getMap().entrySet()) {
com.google.protobuf.MapEntry labels__ =
LabelsDefaultEntryHolder.defaultEntry
.newBuilderForType()
.setKey(entry.getKey())
.setValue(entry.getValue())
.build();
size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, labels__);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.grafeas.v1.SourceContext)) {
return super.equals(obj);
}
io.grafeas.v1.SourceContext other = (io.grafeas.v1.SourceContext) obj;
if (!internalGetLabels().equals(other.internalGetLabels())) return false;
if (!getContextCase().equals(other.getContextCase())) return false;
switch (contextCase_) {
case 1:
if (!getCloudRepo().equals(other.getCloudRepo())) return false;
break;
case 2:
if (!getGerrit().equals(other.getGerrit())) return false;
break;
case 3:
if (!getGit().equals(other.getGit())) return false;
break;
case 0:
default:
}
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (!internalGetLabels().getMap().isEmpty()) {
hash = (37 * hash) + LABELS_FIELD_NUMBER;
hash = (53 * hash) + internalGetLabels().hashCode();
}
switch (contextCase_) {
case 1:
hash = (37 * hash) + CLOUD_REPO_FIELD_NUMBER;
hash = (53 * hash) + getCloudRepo().hashCode();
break;
case 2:
hash = (37 * hash) + GERRIT_FIELD_NUMBER;
hash = (53 * hash) + getGerrit().hashCode();
break;
case 3:
hash = (37 * hash) + GIT_FIELD_NUMBER;
hash = (53 * hash) + getGit().hashCode();
break;
case 0:
default:
}
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.grafeas.v1.SourceContext parseFrom(java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grafeas.v1.SourceContext parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grafeas.v1.SourceContext parseFrom(com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grafeas.v1.SourceContext parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grafeas.v1.SourceContext parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grafeas.v1.SourceContext parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grafeas.v1.SourceContext parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static io.grafeas.v1.SourceContext parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static io.grafeas.v1.SourceContext parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static io.grafeas.v1.SourceContext parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static io.grafeas.v1.SourceContext parseFrom(com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static io.grafeas.v1.SourceContext parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grafeas.v1.SourceContext prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
*
* A SourceContext is a reference to a tree of files. A SourceContext together
* with a path point to a unique revision of a single file or directory.
*
*
* Protobuf type {@code grafeas.v1.SourceContext}
*/
public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder
implements
// @@protoc_insertion_point(builder_implements:grafeas.v1.SourceContext)
io.grafeas.v1.SourceContextOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return io.grafeas.v1.Provenance.internal_static_grafeas_v1_SourceContext_descriptor;
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMapField(int number) {
switch (number) {
case 4:
return internalGetLabels();
default:
throw new RuntimeException("Invalid map field number: " + number);
}
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMutableMapField(int number) {
switch (number) {
case 4:
return internalGetMutableLabels();
default:
throw new RuntimeException("Invalid map field number: " + number);
}
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grafeas.v1.Provenance.internal_static_grafeas_v1_SourceContext_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grafeas.v1.SourceContext.class, io.grafeas.v1.SourceContext.Builder.class);
}
// Construct using io.grafeas.v1.SourceContext.newBuilder()
private Builder() {}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
if (cloudRepoBuilder_ != null) {
cloudRepoBuilder_.clear();
}
if (gerritBuilder_ != null) {
gerritBuilder_.clear();
}
if (gitBuilder_ != null) {
gitBuilder_.clear();
}
internalGetMutableLabels().clear();
contextCase_ = 0;
context_ = null;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return io.grafeas.v1.Provenance.internal_static_grafeas_v1_SourceContext_descriptor;
}
@java.lang.Override
public io.grafeas.v1.SourceContext getDefaultInstanceForType() {
return io.grafeas.v1.SourceContext.getDefaultInstance();
}
@java.lang.Override
public io.grafeas.v1.SourceContext build() {
io.grafeas.v1.SourceContext result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public io.grafeas.v1.SourceContext buildPartial() {
io.grafeas.v1.SourceContext result = new io.grafeas.v1.SourceContext(this);
if (bitField0_ != 0) {
buildPartial0(result);
}
buildPartialOneofs(result);
onBuilt();
return result;
}
private void buildPartial0(io.grafeas.v1.SourceContext result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000008) != 0)) {
result.labels_ = internalGetLabels();
result.labels_.makeImmutable();
}
}
private void buildPartialOneofs(io.grafeas.v1.SourceContext result) {
result.contextCase_ = contextCase_;
result.context_ = this.context_;
if (contextCase_ == 1 && cloudRepoBuilder_ != null) {
result.context_ = cloudRepoBuilder_.build();
}
if (contextCase_ == 2 && gerritBuilder_ != null) {
result.context_ = gerritBuilder_.build();
}
if (contextCase_ == 3 && gitBuilder_ != null) {
result.context_ = gitBuilder_.build();
}
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grafeas.v1.SourceContext) {
return mergeFrom((io.grafeas.v1.SourceContext) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grafeas.v1.SourceContext other) {
if (other == io.grafeas.v1.SourceContext.getDefaultInstance()) return this;
internalGetMutableLabels().mergeFrom(other.internalGetLabels());
bitField0_ |= 0x00000008;
switch (other.getContextCase()) {
case CLOUD_REPO:
{
mergeCloudRepo(other.getCloudRepo());
break;
}
case GERRIT:
{
mergeGerrit(other.getGerrit());
break;
}
case GIT:
{
mergeGit(other.getGit());
break;
}
case CONTEXT_NOT_SET:
{
break;
}
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10:
{
input.readMessage(getCloudRepoFieldBuilder().getBuilder(), extensionRegistry);
contextCase_ = 1;
break;
} // case 10
case 18:
{
input.readMessage(getGerritFieldBuilder().getBuilder(), extensionRegistry);
contextCase_ = 2;
break;
} // case 18
case 26:
{
input.readMessage(getGitFieldBuilder().getBuilder(), extensionRegistry);
contextCase_ = 3;
break;
} // case 26
case 34:
{
com.google.protobuf.MapEntry labels__ =
input.readMessage(
LabelsDefaultEntryHolder.defaultEntry.getParserForType(),
extensionRegistry);
internalGetMutableLabels()
.getMutableMap()
.put(labels__.getKey(), labels__.getValue());
bitField0_ |= 0x00000008;
break;
} // case 34
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int contextCase_ = 0;
private java.lang.Object context_;
public ContextCase getContextCase() {
return ContextCase.forNumber(contextCase_);
}
public Builder clearContext() {
contextCase_ = 0;
context_ = null;
onChanged();
return this;
}
private int bitField0_;
private com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.CloudRepoSourceContext,
io.grafeas.v1.CloudRepoSourceContext.Builder,
io.grafeas.v1.CloudRepoSourceContextOrBuilder>
cloudRepoBuilder_;
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*
* @return Whether the cloudRepo field is set.
*/
@java.lang.Override
public boolean hasCloudRepo() {
return contextCase_ == 1;
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*
* @return The cloudRepo.
*/
@java.lang.Override
public io.grafeas.v1.CloudRepoSourceContext getCloudRepo() {
if (cloudRepoBuilder_ == null) {
if (contextCase_ == 1) {
return (io.grafeas.v1.CloudRepoSourceContext) context_;
}
return io.grafeas.v1.CloudRepoSourceContext.getDefaultInstance();
} else {
if (contextCase_ == 1) {
return cloudRepoBuilder_.getMessage();
}
return io.grafeas.v1.CloudRepoSourceContext.getDefaultInstance();
}
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*/
public Builder setCloudRepo(io.grafeas.v1.CloudRepoSourceContext value) {
if (cloudRepoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
context_ = value;
onChanged();
} else {
cloudRepoBuilder_.setMessage(value);
}
contextCase_ = 1;
return this;
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*/
public Builder setCloudRepo(io.grafeas.v1.CloudRepoSourceContext.Builder builderForValue) {
if (cloudRepoBuilder_ == null) {
context_ = builderForValue.build();
onChanged();
} else {
cloudRepoBuilder_.setMessage(builderForValue.build());
}
contextCase_ = 1;
return this;
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*/
public Builder mergeCloudRepo(io.grafeas.v1.CloudRepoSourceContext value) {
if (cloudRepoBuilder_ == null) {
if (contextCase_ == 1
&& context_ != io.grafeas.v1.CloudRepoSourceContext.getDefaultInstance()) {
context_ =
io.grafeas.v1.CloudRepoSourceContext.newBuilder(
(io.grafeas.v1.CloudRepoSourceContext) context_)
.mergeFrom(value)
.buildPartial();
} else {
context_ = value;
}
onChanged();
} else {
if (contextCase_ == 1) {
cloudRepoBuilder_.mergeFrom(value);
} else {
cloudRepoBuilder_.setMessage(value);
}
}
contextCase_ = 1;
return this;
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*/
public Builder clearCloudRepo() {
if (cloudRepoBuilder_ == null) {
if (contextCase_ == 1) {
contextCase_ = 0;
context_ = null;
onChanged();
}
} else {
if (contextCase_ == 1) {
contextCase_ = 0;
context_ = null;
}
cloudRepoBuilder_.clear();
}
return this;
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*/
public io.grafeas.v1.CloudRepoSourceContext.Builder getCloudRepoBuilder() {
return getCloudRepoFieldBuilder().getBuilder();
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*/
@java.lang.Override
public io.grafeas.v1.CloudRepoSourceContextOrBuilder getCloudRepoOrBuilder() {
if ((contextCase_ == 1) && (cloudRepoBuilder_ != null)) {
return cloudRepoBuilder_.getMessageOrBuilder();
} else {
if (contextCase_ == 1) {
return (io.grafeas.v1.CloudRepoSourceContext) context_;
}
return io.grafeas.v1.CloudRepoSourceContext.getDefaultInstance();
}
}
/**
*
*
*
* A SourceContext referring to a revision in a Google Cloud Source Repo.
*
*
* .grafeas.v1.CloudRepoSourceContext cloud_repo = 1;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.CloudRepoSourceContext,
io.grafeas.v1.CloudRepoSourceContext.Builder,
io.grafeas.v1.CloudRepoSourceContextOrBuilder>
getCloudRepoFieldBuilder() {
if (cloudRepoBuilder_ == null) {
if (!(contextCase_ == 1)) {
context_ = io.grafeas.v1.CloudRepoSourceContext.getDefaultInstance();
}
cloudRepoBuilder_ =
new com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.CloudRepoSourceContext,
io.grafeas.v1.CloudRepoSourceContext.Builder,
io.grafeas.v1.CloudRepoSourceContextOrBuilder>(
(io.grafeas.v1.CloudRepoSourceContext) context_, getParentForChildren(), isClean());
context_ = null;
}
contextCase_ = 1;
onChanged();
return cloudRepoBuilder_;
}
private com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.GerritSourceContext,
io.grafeas.v1.GerritSourceContext.Builder,
io.grafeas.v1.GerritSourceContextOrBuilder>
gerritBuilder_;
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*
* @return Whether the gerrit field is set.
*/
@java.lang.Override
public boolean hasGerrit() {
return contextCase_ == 2;
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*
* @return The gerrit.
*/
@java.lang.Override
public io.grafeas.v1.GerritSourceContext getGerrit() {
if (gerritBuilder_ == null) {
if (contextCase_ == 2) {
return (io.grafeas.v1.GerritSourceContext) context_;
}
return io.grafeas.v1.GerritSourceContext.getDefaultInstance();
} else {
if (contextCase_ == 2) {
return gerritBuilder_.getMessage();
}
return io.grafeas.v1.GerritSourceContext.getDefaultInstance();
}
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*/
public Builder setGerrit(io.grafeas.v1.GerritSourceContext value) {
if (gerritBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
context_ = value;
onChanged();
} else {
gerritBuilder_.setMessage(value);
}
contextCase_ = 2;
return this;
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*/
public Builder setGerrit(io.grafeas.v1.GerritSourceContext.Builder builderForValue) {
if (gerritBuilder_ == null) {
context_ = builderForValue.build();
onChanged();
} else {
gerritBuilder_.setMessage(builderForValue.build());
}
contextCase_ = 2;
return this;
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*/
public Builder mergeGerrit(io.grafeas.v1.GerritSourceContext value) {
if (gerritBuilder_ == null) {
if (contextCase_ == 2
&& context_ != io.grafeas.v1.GerritSourceContext.getDefaultInstance()) {
context_ =
io.grafeas.v1.GerritSourceContext.newBuilder(
(io.grafeas.v1.GerritSourceContext) context_)
.mergeFrom(value)
.buildPartial();
} else {
context_ = value;
}
onChanged();
} else {
if (contextCase_ == 2) {
gerritBuilder_.mergeFrom(value);
} else {
gerritBuilder_.setMessage(value);
}
}
contextCase_ = 2;
return this;
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*/
public Builder clearGerrit() {
if (gerritBuilder_ == null) {
if (contextCase_ == 2) {
contextCase_ = 0;
context_ = null;
onChanged();
}
} else {
if (contextCase_ == 2) {
contextCase_ = 0;
context_ = null;
}
gerritBuilder_.clear();
}
return this;
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*/
public io.grafeas.v1.GerritSourceContext.Builder getGerritBuilder() {
return getGerritFieldBuilder().getBuilder();
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*/
@java.lang.Override
public io.grafeas.v1.GerritSourceContextOrBuilder getGerritOrBuilder() {
if ((contextCase_ == 2) && (gerritBuilder_ != null)) {
return gerritBuilder_.getMessageOrBuilder();
} else {
if (contextCase_ == 2) {
return (io.grafeas.v1.GerritSourceContext) context_;
}
return io.grafeas.v1.GerritSourceContext.getDefaultInstance();
}
}
/**
*
*
*
* A SourceContext referring to a Gerrit project.
*
*
* .grafeas.v1.GerritSourceContext gerrit = 2;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.GerritSourceContext,
io.grafeas.v1.GerritSourceContext.Builder,
io.grafeas.v1.GerritSourceContextOrBuilder>
getGerritFieldBuilder() {
if (gerritBuilder_ == null) {
if (!(contextCase_ == 2)) {
context_ = io.grafeas.v1.GerritSourceContext.getDefaultInstance();
}
gerritBuilder_ =
new com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.GerritSourceContext,
io.grafeas.v1.GerritSourceContext.Builder,
io.grafeas.v1.GerritSourceContextOrBuilder>(
(io.grafeas.v1.GerritSourceContext) context_, getParentForChildren(), isClean());
context_ = null;
}
contextCase_ = 2;
onChanged();
return gerritBuilder_;
}
private com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.GitSourceContext,
io.grafeas.v1.GitSourceContext.Builder,
io.grafeas.v1.GitSourceContextOrBuilder>
gitBuilder_;
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*
* @return Whether the git field is set.
*/
@java.lang.Override
public boolean hasGit() {
return contextCase_ == 3;
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*
* @return The git.
*/
@java.lang.Override
public io.grafeas.v1.GitSourceContext getGit() {
if (gitBuilder_ == null) {
if (contextCase_ == 3) {
return (io.grafeas.v1.GitSourceContext) context_;
}
return io.grafeas.v1.GitSourceContext.getDefaultInstance();
} else {
if (contextCase_ == 3) {
return gitBuilder_.getMessage();
}
return io.grafeas.v1.GitSourceContext.getDefaultInstance();
}
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*/
public Builder setGit(io.grafeas.v1.GitSourceContext value) {
if (gitBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
context_ = value;
onChanged();
} else {
gitBuilder_.setMessage(value);
}
contextCase_ = 3;
return this;
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*/
public Builder setGit(io.grafeas.v1.GitSourceContext.Builder builderForValue) {
if (gitBuilder_ == null) {
context_ = builderForValue.build();
onChanged();
} else {
gitBuilder_.setMessage(builderForValue.build());
}
contextCase_ = 3;
return this;
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*/
public Builder mergeGit(io.grafeas.v1.GitSourceContext value) {
if (gitBuilder_ == null) {
if (contextCase_ == 3 && context_ != io.grafeas.v1.GitSourceContext.getDefaultInstance()) {
context_ =
io.grafeas.v1.GitSourceContext.newBuilder((io.grafeas.v1.GitSourceContext) context_)
.mergeFrom(value)
.buildPartial();
} else {
context_ = value;
}
onChanged();
} else {
if (contextCase_ == 3) {
gitBuilder_.mergeFrom(value);
} else {
gitBuilder_.setMessage(value);
}
}
contextCase_ = 3;
return this;
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*/
public Builder clearGit() {
if (gitBuilder_ == null) {
if (contextCase_ == 3) {
contextCase_ = 0;
context_ = null;
onChanged();
}
} else {
if (contextCase_ == 3) {
contextCase_ = 0;
context_ = null;
}
gitBuilder_.clear();
}
return this;
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*/
public io.grafeas.v1.GitSourceContext.Builder getGitBuilder() {
return getGitFieldBuilder().getBuilder();
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*/
@java.lang.Override
public io.grafeas.v1.GitSourceContextOrBuilder getGitOrBuilder() {
if ((contextCase_ == 3) && (gitBuilder_ != null)) {
return gitBuilder_.getMessageOrBuilder();
} else {
if (contextCase_ == 3) {
return (io.grafeas.v1.GitSourceContext) context_;
}
return io.grafeas.v1.GitSourceContext.getDefaultInstance();
}
}
/**
*
*
*
* A SourceContext referring to any third party Git repo (e.g., GitHub).
*
*
* .grafeas.v1.GitSourceContext git = 3;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.GitSourceContext,
io.grafeas.v1.GitSourceContext.Builder,
io.grafeas.v1.GitSourceContextOrBuilder>
getGitFieldBuilder() {
if (gitBuilder_ == null) {
if (!(contextCase_ == 3)) {
context_ = io.grafeas.v1.GitSourceContext.getDefaultInstance();
}
gitBuilder_ =
new com.google.protobuf.SingleFieldBuilderV3<
io.grafeas.v1.GitSourceContext,
io.grafeas.v1.GitSourceContext.Builder,
io.grafeas.v1.GitSourceContextOrBuilder>(
(io.grafeas.v1.GitSourceContext) context_, getParentForChildren(), isClean());
context_ = null;
}
contextCase_ = 3;
onChanged();
return gitBuilder_;
}
private com.google.protobuf.MapField labels_;
private com.google.protobuf.MapField internalGetLabels() {
if (labels_ == null) {
return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
}
return labels_;
}
private com.google.protobuf.MapField
internalGetMutableLabels() {
if (labels_ == null) {
labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry);
}
if (!labels_.isMutable()) {
labels_ = labels_.copy();
}
bitField0_ |= 0x00000008;
onChanged();
return labels_;
}
public int getLabelsCount() {
return internalGetLabels().getMap().size();
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
@java.lang.Override
public boolean containsLabels(java.lang.String key) {
if (key == null) {
throw new NullPointerException("map key");
}
return internalGetLabels().getMap().containsKey(key);
}
/** Use {@link #getLabelsMap()} instead. */
@java.lang.Override
@java.lang.Deprecated
public java.util.Map getLabels() {
return getLabelsMap();
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
@java.lang.Override
public java.util.Map getLabelsMap() {
return internalGetLabels().getMap();
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
@java.lang.Override
public /* nullable */ java.lang.String getLabelsOrDefault(
java.lang.String key,
/* nullable */
java.lang.String defaultValue) {
if (key == null) {
throw new NullPointerException("map key");
}
java.util.Map map = internalGetLabels().getMap();
return map.containsKey(key) ? map.get(key) : defaultValue;
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
@java.lang.Override
public java.lang.String getLabelsOrThrow(java.lang.String key) {
if (key == null) {
throw new NullPointerException("map key");
}
java.util.Map map = internalGetLabels().getMap();
if (!map.containsKey(key)) {
throw new java.lang.IllegalArgumentException();
}
return map.get(key);
}
public Builder clearLabels() {
bitField0_ = (bitField0_ & ~0x00000008);
internalGetMutableLabels().getMutableMap().clear();
return this;
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
public Builder removeLabels(java.lang.String key) {
if (key == null) {
throw new NullPointerException("map key");
}
internalGetMutableLabels().getMutableMap().remove(key);
return this;
}
/** Use alternate mutation accessors instead. */
@java.lang.Deprecated
public java.util.Map getMutableLabels() {
bitField0_ |= 0x00000008;
return internalGetMutableLabels().getMutableMap();
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
public Builder putLabels(java.lang.String key, java.lang.String value) {
if (key == null) {
throw new NullPointerException("map key");
}
if (value == null) {
throw new NullPointerException("map value");
}
internalGetMutableLabels().getMutableMap().put(key, value);
bitField0_ |= 0x00000008;
return this;
}
/**
*
*
*
* Labels with user defined metadata.
*
*
* map<string, string> labels = 4;
*/
public Builder putAllLabels(java.util.Map values) {
internalGetMutableLabels().getMutableMap().putAll(values);
bitField0_ |= 0x00000008;
return this;
}
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:grafeas.v1.SourceContext)
}
// @@protoc_insertion_point(class_scope:grafeas.v1.SourceContext)
private static final io.grafeas.v1.SourceContext DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grafeas.v1.SourceContext();
}
public static io.grafeas.v1.SourceContext getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser PARSER =
new com.google.protobuf.AbstractParser() {
@java.lang.Override
public SourceContext parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public io.grafeas.v1.SourceContext getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}