1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Generated by the protocol buffer compiler. DO NOT EDIT! 17 // source: google/cloud/recommender/v1/recommendation.proto 18 19 package com.google.cloud.recommender.v1; 20 21 /** 22 * 23 * 24 * <pre> 25 * Contains metadata about how much money a recommendation can save or incur. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.recommender.v1.CostProjection} 29 */ 30 public final class CostProjection extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.recommender.v1.CostProjection) 33 CostProjectionOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use CostProjection.newBuilder() to construct. CostProjection(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private CostProjection(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 CostProjection()40 private CostProjection() {} 41 42 @java.lang.Override 43 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)44 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 45 return new CostProjection(); 46 } 47 48 @java.lang.Override getUnknownFields()49 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 50 return this.unknownFields; 51 } 52 getDescriptor()53 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 54 return com.google.cloud.recommender.v1.RecommendationOuterClass 55 .internal_static_google_cloud_recommender_v1_CostProjection_descriptor; 56 } 57 58 @java.lang.Override 59 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()60 internalGetFieldAccessorTable() { 61 return com.google.cloud.recommender.v1.RecommendationOuterClass 62 .internal_static_google_cloud_recommender_v1_CostProjection_fieldAccessorTable 63 .ensureFieldAccessorsInitialized( 64 com.google.cloud.recommender.v1.CostProjection.class, 65 com.google.cloud.recommender.v1.CostProjection.Builder.class); 66 } 67 68 public static final int COST_FIELD_NUMBER = 1; 69 private com.google.type.Money cost_; 70 /** 71 * 72 * 73 * <pre> 74 * An approximate projection on amount saved or amount incurred. Negative cost 75 * units indicate cost savings and positive cost units indicate increase. 76 * See google.type.Money documentation for positive/negative units. 77 * A user's permissions may affect whether the cost is computed using list 78 * prices or custom contract prices. 79 * </pre> 80 * 81 * <code>.google.type.Money cost = 1;</code> 82 * 83 * @return Whether the cost field is set. 84 */ 85 @java.lang.Override hasCost()86 public boolean hasCost() { 87 return cost_ != null; 88 } 89 /** 90 * 91 * 92 * <pre> 93 * An approximate projection on amount saved or amount incurred. Negative cost 94 * units indicate cost savings and positive cost units indicate increase. 95 * See google.type.Money documentation for positive/negative units. 96 * A user's permissions may affect whether the cost is computed using list 97 * prices or custom contract prices. 98 * </pre> 99 * 100 * <code>.google.type.Money cost = 1;</code> 101 * 102 * @return The cost. 103 */ 104 @java.lang.Override getCost()105 public com.google.type.Money getCost() { 106 return cost_ == null ? com.google.type.Money.getDefaultInstance() : cost_; 107 } 108 /** 109 * 110 * 111 * <pre> 112 * An approximate projection on amount saved or amount incurred. Negative cost 113 * units indicate cost savings and positive cost units indicate increase. 114 * See google.type.Money documentation for positive/negative units. 115 * A user's permissions may affect whether the cost is computed using list 116 * prices or custom contract prices. 117 * </pre> 118 * 119 * <code>.google.type.Money cost = 1;</code> 120 */ 121 @java.lang.Override getCostOrBuilder()122 public com.google.type.MoneyOrBuilder getCostOrBuilder() { 123 return cost_ == null ? com.google.type.Money.getDefaultInstance() : cost_; 124 } 125 126 public static final int DURATION_FIELD_NUMBER = 2; 127 private com.google.protobuf.Duration duration_; 128 /** 129 * 130 * 131 * <pre> 132 * Duration for which this cost applies. 133 * </pre> 134 * 135 * <code>.google.protobuf.Duration duration = 2;</code> 136 * 137 * @return Whether the duration field is set. 138 */ 139 @java.lang.Override hasDuration()140 public boolean hasDuration() { 141 return duration_ != null; 142 } 143 /** 144 * 145 * 146 * <pre> 147 * Duration for which this cost applies. 148 * </pre> 149 * 150 * <code>.google.protobuf.Duration duration = 2;</code> 151 * 152 * @return The duration. 153 */ 154 @java.lang.Override getDuration()155 public com.google.protobuf.Duration getDuration() { 156 return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_; 157 } 158 /** 159 * 160 * 161 * <pre> 162 * Duration for which this cost applies. 163 * </pre> 164 * 165 * <code>.google.protobuf.Duration duration = 2;</code> 166 */ 167 @java.lang.Override getDurationOrBuilder()168 public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() { 169 return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_; 170 } 171 172 private byte memoizedIsInitialized = -1; 173 174 @java.lang.Override isInitialized()175 public final boolean isInitialized() { 176 byte isInitialized = memoizedIsInitialized; 177 if (isInitialized == 1) return true; 178 if (isInitialized == 0) return false; 179 180 memoizedIsInitialized = 1; 181 return true; 182 } 183 184 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)185 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 186 if (cost_ != null) { 187 output.writeMessage(1, getCost()); 188 } 189 if (duration_ != null) { 190 output.writeMessage(2, getDuration()); 191 } 192 getUnknownFields().writeTo(output); 193 } 194 195 @java.lang.Override getSerializedSize()196 public int getSerializedSize() { 197 int size = memoizedSize; 198 if (size != -1) return size; 199 200 size = 0; 201 if (cost_ != null) { 202 size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCost()); 203 } 204 if (duration_ != null) { 205 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDuration()); 206 } 207 size += getUnknownFields().getSerializedSize(); 208 memoizedSize = size; 209 return size; 210 } 211 212 @java.lang.Override equals(final java.lang.Object obj)213 public boolean equals(final java.lang.Object obj) { 214 if (obj == this) { 215 return true; 216 } 217 if (!(obj instanceof com.google.cloud.recommender.v1.CostProjection)) { 218 return super.equals(obj); 219 } 220 com.google.cloud.recommender.v1.CostProjection other = 221 (com.google.cloud.recommender.v1.CostProjection) obj; 222 223 if (hasCost() != other.hasCost()) return false; 224 if (hasCost()) { 225 if (!getCost().equals(other.getCost())) return false; 226 } 227 if (hasDuration() != other.hasDuration()) return false; 228 if (hasDuration()) { 229 if (!getDuration().equals(other.getDuration())) return false; 230 } 231 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 232 return true; 233 } 234 235 @java.lang.Override hashCode()236 public int hashCode() { 237 if (memoizedHashCode != 0) { 238 return memoizedHashCode; 239 } 240 int hash = 41; 241 hash = (19 * hash) + getDescriptor().hashCode(); 242 if (hasCost()) { 243 hash = (37 * hash) + COST_FIELD_NUMBER; 244 hash = (53 * hash) + getCost().hashCode(); 245 } 246 if (hasDuration()) { 247 hash = (37 * hash) + DURATION_FIELD_NUMBER; 248 hash = (53 * hash) + getDuration().hashCode(); 249 } 250 hash = (29 * hash) + getUnknownFields().hashCode(); 251 memoizedHashCode = hash; 252 return hash; 253 } 254 parseFrom(java.nio.ByteBuffer data)255 public static com.google.cloud.recommender.v1.CostProjection parseFrom(java.nio.ByteBuffer data) 256 throws com.google.protobuf.InvalidProtocolBufferException { 257 return PARSER.parseFrom(data); 258 } 259 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)260 public static com.google.cloud.recommender.v1.CostProjection parseFrom( 261 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 262 throws com.google.protobuf.InvalidProtocolBufferException { 263 return PARSER.parseFrom(data, extensionRegistry); 264 } 265 parseFrom( com.google.protobuf.ByteString data)266 public static com.google.cloud.recommender.v1.CostProjection parseFrom( 267 com.google.protobuf.ByteString data) 268 throws com.google.protobuf.InvalidProtocolBufferException { 269 return PARSER.parseFrom(data); 270 } 271 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)272 public static com.google.cloud.recommender.v1.CostProjection parseFrom( 273 com.google.protobuf.ByteString data, 274 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 275 throws com.google.protobuf.InvalidProtocolBufferException { 276 return PARSER.parseFrom(data, extensionRegistry); 277 } 278 parseFrom(byte[] data)279 public static com.google.cloud.recommender.v1.CostProjection parseFrom(byte[] data) 280 throws com.google.protobuf.InvalidProtocolBufferException { 281 return PARSER.parseFrom(data); 282 } 283 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)284 public static com.google.cloud.recommender.v1.CostProjection parseFrom( 285 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 286 throws com.google.protobuf.InvalidProtocolBufferException { 287 return PARSER.parseFrom(data, extensionRegistry); 288 } 289 parseFrom(java.io.InputStream input)290 public static com.google.cloud.recommender.v1.CostProjection parseFrom(java.io.InputStream input) 291 throws java.io.IOException { 292 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 293 } 294 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)295 public static com.google.cloud.recommender.v1.CostProjection parseFrom( 296 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 297 throws java.io.IOException { 298 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 299 PARSER, input, extensionRegistry); 300 } 301 parseDelimitedFrom( java.io.InputStream input)302 public static com.google.cloud.recommender.v1.CostProjection parseDelimitedFrom( 303 java.io.InputStream input) throws java.io.IOException { 304 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 305 } 306 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)307 public static com.google.cloud.recommender.v1.CostProjection parseDelimitedFrom( 308 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 309 throws java.io.IOException { 310 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 311 PARSER, input, extensionRegistry); 312 } 313 parseFrom( com.google.protobuf.CodedInputStream input)314 public static com.google.cloud.recommender.v1.CostProjection parseFrom( 315 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 316 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 317 } 318 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)319 public static com.google.cloud.recommender.v1.CostProjection parseFrom( 320 com.google.protobuf.CodedInputStream input, 321 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 322 throws java.io.IOException { 323 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 324 PARSER, input, extensionRegistry); 325 } 326 327 @java.lang.Override newBuilderForType()328 public Builder newBuilderForType() { 329 return newBuilder(); 330 } 331 newBuilder()332 public static Builder newBuilder() { 333 return DEFAULT_INSTANCE.toBuilder(); 334 } 335 newBuilder(com.google.cloud.recommender.v1.CostProjection prototype)336 public static Builder newBuilder(com.google.cloud.recommender.v1.CostProjection prototype) { 337 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 338 } 339 340 @java.lang.Override toBuilder()341 public Builder toBuilder() { 342 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 343 } 344 345 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)346 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 347 Builder builder = new Builder(parent); 348 return builder; 349 } 350 /** 351 * 352 * 353 * <pre> 354 * Contains metadata about how much money a recommendation can save or incur. 355 * </pre> 356 * 357 * Protobuf type {@code google.cloud.recommender.v1.CostProjection} 358 */ 359 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 360 implements 361 // @@protoc_insertion_point(builder_implements:google.cloud.recommender.v1.CostProjection) 362 com.google.cloud.recommender.v1.CostProjectionOrBuilder { getDescriptor()363 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 364 return com.google.cloud.recommender.v1.RecommendationOuterClass 365 .internal_static_google_cloud_recommender_v1_CostProjection_descriptor; 366 } 367 368 @java.lang.Override 369 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()370 internalGetFieldAccessorTable() { 371 return com.google.cloud.recommender.v1.RecommendationOuterClass 372 .internal_static_google_cloud_recommender_v1_CostProjection_fieldAccessorTable 373 .ensureFieldAccessorsInitialized( 374 com.google.cloud.recommender.v1.CostProjection.class, 375 com.google.cloud.recommender.v1.CostProjection.Builder.class); 376 } 377 378 // Construct using com.google.cloud.recommender.v1.CostProjection.newBuilder() Builder()379 private Builder() {} 380 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)381 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 382 super(parent); 383 } 384 385 @java.lang.Override clear()386 public Builder clear() { 387 super.clear(); 388 bitField0_ = 0; 389 cost_ = null; 390 if (costBuilder_ != null) { 391 costBuilder_.dispose(); 392 costBuilder_ = null; 393 } 394 duration_ = null; 395 if (durationBuilder_ != null) { 396 durationBuilder_.dispose(); 397 durationBuilder_ = null; 398 } 399 return this; 400 } 401 402 @java.lang.Override getDescriptorForType()403 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 404 return com.google.cloud.recommender.v1.RecommendationOuterClass 405 .internal_static_google_cloud_recommender_v1_CostProjection_descriptor; 406 } 407 408 @java.lang.Override getDefaultInstanceForType()409 public com.google.cloud.recommender.v1.CostProjection getDefaultInstanceForType() { 410 return com.google.cloud.recommender.v1.CostProjection.getDefaultInstance(); 411 } 412 413 @java.lang.Override build()414 public com.google.cloud.recommender.v1.CostProjection build() { 415 com.google.cloud.recommender.v1.CostProjection result = buildPartial(); 416 if (!result.isInitialized()) { 417 throw newUninitializedMessageException(result); 418 } 419 return result; 420 } 421 422 @java.lang.Override buildPartial()423 public com.google.cloud.recommender.v1.CostProjection buildPartial() { 424 com.google.cloud.recommender.v1.CostProjection result = 425 new com.google.cloud.recommender.v1.CostProjection(this); 426 if (bitField0_ != 0) { 427 buildPartial0(result); 428 } 429 onBuilt(); 430 return result; 431 } 432 buildPartial0(com.google.cloud.recommender.v1.CostProjection result)433 private void buildPartial0(com.google.cloud.recommender.v1.CostProjection result) { 434 int from_bitField0_ = bitField0_; 435 if (((from_bitField0_ & 0x00000001) != 0)) { 436 result.cost_ = costBuilder_ == null ? cost_ : costBuilder_.build(); 437 } 438 if (((from_bitField0_ & 0x00000002) != 0)) { 439 result.duration_ = durationBuilder_ == null ? duration_ : durationBuilder_.build(); 440 } 441 } 442 443 @java.lang.Override clone()444 public Builder clone() { 445 return super.clone(); 446 } 447 448 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)449 public Builder setField( 450 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 451 return super.setField(field, value); 452 } 453 454 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)455 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 456 return super.clearField(field); 457 } 458 459 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)460 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 461 return super.clearOneof(oneof); 462 } 463 464 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)465 public Builder setRepeatedField( 466 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 467 return super.setRepeatedField(field, index, value); 468 } 469 470 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)471 public Builder addRepeatedField( 472 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 473 return super.addRepeatedField(field, value); 474 } 475 476 @java.lang.Override mergeFrom(com.google.protobuf.Message other)477 public Builder mergeFrom(com.google.protobuf.Message other) { 478 if (other instanceof com.google.cloud.recommender.v1.CostProjection) { 479 return mergeFrom((com.google.cloud.recommender.v1.CostProjection) other); 480 } else { 481 super.mergeFrom(other); 482 return this; 483 } 484 } 485 mergeFrom(com.google.cloud.recommender.v1.CostProjection other)486 public Builder mergeFrom(com.google.cloud.recommender.v1.CostProjection other) { 487 if (other == com.google.cloud.recommender.v1.CostProjection.getDefaultInstance()) return this; 488 if (other.hasCost()) { 489 mergeCost(other.getCost()); 490 } 491 if (other.hasDuration()) { 492 mergeDuration(other.getDuration()); 493 } 494 this.mergeUnknownFields(other.getUnknownFields()); 495 onChanged(); 496 return this; 497 } 498 499 @java.lang.Override isInitialized()500 public final boolean isInitialized() { 501 return true; 502 } 503 504 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)505 public Builder mergeFrom( 506 com.google.protobuf.CodedInputStream input, 507 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 508 throws java.io.IOException { 509 if (extensionRegistry == null) { 510 throw new java.lang.NullPointerException(); 511 } 512 try { 513 boolean done = false; 514 while (!done) { 515 int tag = input.readTag(); 516 switch (tag) { 517 case 0: 518 done = true; 519 break; 520 case 10: 521 { 522 input.readMessage(getCostFieldBuilder().getBuilder(), extensionRegistry); 523 bitField0_ |= 0x00000001; 524 break; 525 } // case 10 526 case 18: 527 { 528 input.readMessage(getDurationFieldBuilder().getBuilder(), extensionRegistry); 529 bitField0_ |= 0x00000002; 530 break; 531 } // case 18 532 default: 533 { 534 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 535 done = true; // was an endgroup tag 536 } 537 break; 538 } // default: 539 } // switch (tag) 540 } // while (!done) 541 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 542 throw e.unwrapIOException(); 543 } finally { 544 onChanged(); 545 } // finally 546 return this; 547 } 548 549 private int bitField0_; 550 551 private com.google.type.Money cost_; 552 private com.google.protobuf.SingleFieldBuilderV3< 553 com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder> 554 costBuilder_; 555 /** 556 * 557 * 558 * <pre> 559 * An approximate projection on amount saved or amount incurred. Negative cost 560 * units indicate cost savings and positive cost units indicate increase. 561 * See google.type.Money documentation for positive/negative units. 562 * A user's permissions may affect whether the cost is computed using list 563 * prices or custom contract prices. 564 * </pre> 565 * 566 * <code>.google.type.Money cost = 1;</code> 567 * 568 * @return Whether the cost field is set. 569 */ hasCost()570 public boolean hasCost() { 571 return ((bitField0_ & 0x00000001) != 0); 572 } 573 /** 574 * 575 * 576 * <pre> 577 * An approximate projection on amount saved or amount incurred. Negative cost 578 * units indicate cost savings and positive cost units indicate increase. 579 * See google.type.Money documentation for positive/negative units. 580 * A user's permissions may affect whether the cost is computed using list 581 * prices or custom contract prices. 582 * </pre> 583 * 584 * <code>.google.type.Money cost = 1;</code> 585 * 586 * @return The cost. 587 */ getCost()588 public com.google.type.Money getCost() { 589 if (costBuilder_ == null) { 590 return cost_ == null ? com.google.type.Money.getDefaultInstance() : cost_; 591 } else { 592 return costBuilder_.getMessage(); 593 } 594 } 595 /** 596 * 597 * 598 * <pre> 599 * An approximate projection on amount saved or amount incurred. Negative cost 600 * units indicate cost savings and positive cost units indicate increase. 601 * See google.type.Money documentation for positive/negative units. 602 * A user's permissions may affect whether the cost is computed using list 603 * prices or custom contract prices. 604 * </pre> 605 * 606 * <code>.google.type.Money cost = 1;</code> 607 */ setCost(com.google.type.Money value)608 public Builder setCost(com.google.type.Money value) { 609 if (costBuilder_ == null) { 610 if (value == null) { 611 throw new NullPointerException(); 612 } 613 cost_ = value; 614 } else { 615 costBuilder_.setMessage(value); 616 } 617 bitField0_ |= 0x00000001; 618 onChanged(); 619 return this; 620 } 621 /** 622 * 623 * 624 * <pre> 625 * An approximate projection on amount saved or amount incurred. Negative cost 626 * units indicate cost savings and positive cost units indicate increase. 627 * See google.type.Money documentation for positive/negative units. 628 * A user's permissions may affect whether the cost is computed using list 629 * prices or custom contract prices. 630 * </pre> 631 * 632 * <code>.google.type.Money cost = 1;</code> 633 */ setCost(com.google.type.Money.Builder builderForValue)634 public Builder setCost(com.google.type.Money.Builder builderForValue) { 635 if (costBuilder_ == null) { 636 cost_ = builderForValue.build(); 637 } else { 638 costBuilder_.setMessage(builderForValue.build()); 639 } 640 bitField0_ |= 0x00000001; 641 onChanged(); 642 return this; 643 } 644 /** 645 * 646 * 647 * <pre> 648 * An approximate projection on amount saved or amount incurred. Negative cost 649 * units indicate cost savings and positive cost units indicate increase. 650 * See google.type.Money documentation for positive/negative units. 651 * A user's permissions may affect whether the cost is computed using list 652 * prices or custom contract prices. 653 * </pre> 654 * 655 * <code>.google.type.Money cost = 1;</code> 656 */ mergeCost(com.google.type.Money value)657 public Builder mergeCost(com.google.type.Money value) { 658 if (costBuilder_ == null) { 659 if (((bitField0_ & 0x00000001) != 0) 660 && cost_ != null 661 && cost_ != com.google.type.Money.getDefaultInstance()) { 662 getCostBuilder().mergeFrom(value); 663 } else { 664 cost_ = value; 665 } 666 } else { 667 costBuilder_.mergeFrom(value); 668 } 669 bitField0_ |= 0x00000001; 670 onChanged(); 671 return this; 672 } 673 /** 674 * 675 * 676 * <pre> 677 * An approximate projection on amount saved or amount incurred. Negative cost 678 * units indicate cost savings and positive cost units indicate increase. 679 * See google.type.Money documentation for positive/negative units. 680 * A user's permissions may affect whether the cost is computed using list 681 * prices or custom contract prices. 682 * </pre> 683 * 684 * <code>.google.type.Money cost = 1;</code> 685 */ clearCost()686 public Builder clearCost() { 687 bitField0_ = (bitField0_ & ~0x00000001); 688 cost_ = null; 689 if (costBuilder_ != null) { 690 costBuilder_.dispose(); 691 costBuilder_ = null; 692 } 693 onChanged(); 694 return this; 695 } 696 /** 697 * 698 * 699 * <pre> 700 * An approximate projection on amount saved or amount incurred. Negative cost 701 * units indicate cost savings and positive cost units indicate increase. 702 * See google.type.Money documentation for positive/negative units. 703 * A user's permissions may affect whether the cost is computed using list 704 * prices or custom contract prices. 705 * </pre> 706 * 707 * <code>.google.type.Money cost = 1;</code> 708 */ getCostBuilder()709 public com.google.type.Money.Builder getCostBuilder() { 710 bitField0_ |= 0x00000001; 711 onChanged(); 712 return getCostFieldBuilder().getBuilder(); 713 } 714 /** 715 * 716 * 717 * <pre> 718 * An approximate projection on amount saved or amount incurred. Negative cost 719 * units indicate cost savings and positive cost units indicate increase. 720 * See google.type.Money documentation for positive/negative units. 721 * A user's permissions may affect whether the cost is computed using list 722 * prices or custom contract prices. 723 * </pre> 724 * 725 * <code>.google.type.Money cost = 1;</code> 726 */ getCostOrBuilder()727 public com.google.type.MoneyOrBuilder getCostOrBuilder() { 728 if (costBuilder_ != null) { 729 return costBuilder_.getMessageOrBuilder(); 730 } else { 731 return cost_ == null ? com.google.type.Money.getDefaultInstance() : cost_; 732 } 733 } 734 /** 735 * 736 * 737 * <pre> 738 * An approximate projection on amount saved or amount incurred. Negative cost 739 * units indicate cost savings and positive cost units indicate increase. 740 * See google.type.Money documentation for positive/negative units. 741 * A user's permissions may affect whether the cost is computed using list 742 * prices or custom contract prices. 743 * </pre> 744 * 745 * <code>.google.type.Money cost = 1;</code> 746 */ 747 private com.google.protobuf.SingleFieldBuilderV3< 748 com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder> getCostFieldBuilder()749 getCostFieldBuilder() { 750 if (costBuilder_ == null) { 751 costBuilder_ = 752 new com.google.protobuf.SingleFieldBuilderV3< 753 com.google.type.Money, 754 com.google.type.Money.Builder, 755 com.google.type.MoneyOrBuilder>(getCost(), getParentForChildren(), isClean()); 756 cost_ = null; 757 } 758 return costBuilder_; 759 } 760 761 private com.google.protobuf.Duration duration_; 762 private com.google.protobuf.SingleFieldBuilderV3< 763 com.google.protobuf.Duration, 764 com.google.protobuf.Duration.Builder, 765 com.google.protobuf.DurationOrBuilder> 766 durationBuilder_; 767 /** 768 * 769 * 770 * <pre> 771 * Duration for which this cost applies. 772 * </pre> 773 * 774 * <code>.google.protobuf.Duration duration = 2;</code> 775 * 776 * @return Whether the duration field is set. 777 */ hasDuration()778 public boolean hasDuration() { 779 return ((bitField0_ & 0x00000002) != 0); 780 } 781 /** 782 * 783 * 784 * <pre> 785 * Duration for which this cost applies. 786 * </pre> 787 * 788 * <code>.google.protobuf.Duration duration = 2;</code> 789 * 790 * @return The duration. 791 */ getDuration()792 public com.google.protobuf.Duration getDuration() { 793 if (durationBuilder_ == null) { 794 return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_; 795 } else { 796 return durationBuilder_.getMessage(); 797 } 798 } 799 /** 800 * 801 * 802 * <pre> 803 * Duration for which this cost applies. 804 * </pre> 805 * 806 * <code>.google.protobuf.Duration duration = 2;</code> 807 */ setDuration(com.google.protobuf.Duration value)808 public Builder setDuration(com.google.protobuf.Duration value) { 809 if (durationBuilder_ == null) { 810 if (value == null) { 811 throw new NullPointerException(); 812 } 813 duration_ = value; 814 } else { 815 durationBuilder_.setMessage(value); 816 } 817 bitField0_ |= 0x00000002; 818 onChanged(); 819 return this; 820 } 821 /** 822 * 823 * 824 * <pre> 825 * Duration for which this cost applies. 826 * </pre> 827 * 828 * <code>.google.protobuf.Duration duration = 2;</code> 829 */ setDuration(com.google.protobuf.Duration.Builder builderForValue)830 public Builder setDuration(com.google.protobuf.Duration.Builder builderForValue) { 831 if (durationBuilder_ == null) { 832 duration_ = builderForValue.build(); 833 } else { 834 durationBuilder_.setMessage(builderForValue.build()); 835 } 836 bitField0_ |= 0x00000002; 837 onChanged(); 838 return this; 839 } 840 /** 841 * 842 * 843 * <pre> 844 * Duration for which this cost applies. 845 * </pre> 846 * 847 * <code>.google.protobuf.Duration duration = 2;</code> 848 */ mergeDuration(com.google.protobuf.Duration value)849 public Builder mergeDuration(com.google.protobuf.Duration value) { 850 if (durationBuilder_ == null) { 851 if (((bitField0_ & 0x00000002) != 0) 852 && duration_ != null 853 && duration_ != com.google.protobuf.Duration.getDefaultInstance()) { 854 getDurationBuilder().mergeFrom(value); 855 } else { 856 duration_ = value; 857 } 858 } else { 859 durationBuilder_.mergeFrom(value); 860 } 861 bitField0_ |= 0x00000002; 862 onChanged(); 863 return this; 864 } 865 /** 866 * 867 * 868 * <pre> 869 * Duration for which this cost applies. 870 * </pre> 871 * 872 * <code>.google.protobuf.Duration duration = 2;</code> 873 */ clearDuration()874 public Builder clearDuration() { 875 bitField0_ = (bitField0_ & ~0x00000002); 876 duration_ = null; 877 if (durationBuilder_ != null) { 878 durationBuilder_.dispose(); 879 durationBuilder_ = null; 880 } 881 onChanged(); 882 return this; 883 } 884 /** 885 * 886 * 887 * <pre> 888 * Duration for which this cost applies. 889 * </pre> 890 * 891 * <code>.google.protobuf.Duration duration = 2;</code> 892 */ getDurationBuilder()893 public com.google.protobuf.Duration.Builder getDurationBuilder() { 894 bitField0_ |= 0x00000002; 895 onChanged(); 896 return getDurationFieldBuilder().getBuilder(); 897 } 898 /** 899 * 900 * 901 * <pre> 902 * Duration for which this cost applies. 903 * </pre> 904 * 905 * <code>.google.protobuf.Duration duration = 2;</code> 906 */ getDurationOrBuilder()907 public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() { 908 if (durationBuilder_ != null) { 909 return durationBuilder_.getMessageOrBuilder(); 910 } else { 911 return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_; 912 } 913 } 914 /** 915 * 916 * 917 * <pre> 918 * Duration for which this cost applies. 919 * </pre> 920 * 921 * <code>.google.protobuf.Duration duration = 2;</code> 922 */ 923 private com.google.protobuf.SingleFieldBuilderV3< 924 com.google.protobuf.Duration, 925 com.google.protobuf.Duration.Builder, 926 com.google.protobuf.DurationOrBuilder> getDurationFieldBuilder()927 getDurationFieldBuilder() { 928 if (durationBuilder_ == null) { 929 durationBuilder_ = 930 new com.google.protobuf.SingleFieldBuilderV3< 931 com.google.protobuf.Duration, 932 com.google.protobuf.Duration.Builder, 933 com.google.protobuf.DurationOrBuilder>( 934 getDuration(), getParentForChildren(), isClean()); 935 duration_ = null; 936 } 937 return durationBuilder_; 938 } 939 940 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)941 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 942 return super.setUnknownFields(unknownFields); 943 } 944 945 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)946 public final Builder mergeUnknownFields( 947 final com.google.protobuf.UnknownFieldSet unknownFields) { 948 return super.mergeUnknownFields(unknownFields); 949 } 950 951 // @@protoc_insertion_point(builder_scope:google.cloud.recommender.v1.CostProjection) 952 } 953 954 // @@protoc_insertion_point(class_scope:google.cloud.recommender.v1.CostProjection) 955 private static final com.google.cloud.recommender.v1.CostProjection DEFAULT_INSTANCE; 956 957 static { 958 DEFAULT_INSTANCE = new com.google.cloud.recommender.v1.CostProjection(); 959 } 960 getDefaultInstance()961 public static com.google.cloud.recommender.v1.CostProjection getDefaultInstance() { 962 return DEFAULT_INSTANCE; 963 } 964 965 private static final com.google.protobuf.Parser<CostProjection> PARSER = 966 new com.google.protobuf.AbstractParser<CostProjection>() { 967 @java.lang.Override 968 public CostProjection parsePartialFrom( 969 com.google.protobuf.CodedInputStream input, 970 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 971 throws com.google.protobuf.InvalidProtocolBufferException { 972 Builder builder = newBuilder(); 973 try { 974 builder.mergeFrom(input, extensionRegistry); 975 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 976 throw e.setUnfinishedMessage(builder.buildPartial()); 977 } catch (com.google.protobuf.UninitializedMessageException e) { 978 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 979 } catch (java.io.IOException e) { 980 throw new com.google.protobuf.InvalidProtocolBufferException(e) 981 .setUnfinishedMessage(builder.buildPartial()); 982 } 983 return builder.buildPartial(); 984 } 985 }; 986 parser()987 public static com.google.protobuf.Parser<CostProjection> parser() { 988 return PARSER; 989 } 990 991 @java.lang.Override getParserForType()992 public com.google.protobuf.Parser<CostProjection> getParserForType() { 993 return PARSER; 994 } 995 996 @java.lang.Override getDefaultInstanceForType()997 public com.google.cloud.recommender.v1.CostProjection getDefaultInstanceForType() { 998 return DEFAULT_INSTANCE; 999 } 1000 } 1001