or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

core-message-api.mddescriptors-reflection.mdextensions.mdindex.mdjson-format.mdserialization-io.mdwell-known-types.md

well-known-types.mddocs/

0

# Well-Known Types

1

2

Standard protocol buffer types including timestamps, durations, Any messages, and wrapper types for primitives. These are commonly used types that provide standard solutions for common data representation needs in the shaded akka.protobufv3.internal package.

3

4

## Capabilities

5

6

### Timestamp Type

7

8

Represents a point in time independent of time zones or calendars. Useful for recording when events occurred.

9

10

```java { .api }

11

/**

12

* Represents a point in time independent of any time zone or calendar.

13

* Precision is in nanoseconds with seconds since Unix epoch.

14

*/

15

class Timestamp implements Message {

16

/** Get seconds since Unix epoch */

17

long getSeconds();

18

19

/** Get nanoseconds adjustment (0-999,999,999) */

20

int getNanos();

21

22

/** Create new builder */

23

static Builder newBuilder();

24

25

/** Create builder from existing timestamp */

26

static Builder newBuilder(Timestamp prototype);

27

28

/** Parse from byte array */

29

static Timestamp parseFrom(byte[] data) throws InvalidProtocolBufferException;

30

31

/** Parse from ByteString */

32

static Timestamp parseFrom(ByteString data) throws InvalidProtocolBufferException;

33

34

/** Parse from CodedInputStream */

35

static Timestamp parseFrom(CodedInputStream input) throws IOException;

36

37

/** Get default instance */

38

static Timestamp getDefaultInstance();

39

40

/** Create builder for this message */

41

Builder newBuilderForType();

42

43

/** Create builder with this message's contents */

44

Builder toBuilder();

45

46

/** Timestamp builder */

47

static class Builder implements Message.Builder {

48

/** Get seconds value */

49

long getSeconds();

50

51

/** Set seconds value */

52

Builder setSeconds(long value);

53

54

/** Clear seconds field */

55

Builder clearSeconds();

56

57

/** Get nanos value */

58

int getNanos();

59

60

/** Set nanos value */

61

Builder setNanos(int value);

62

63

/** Clear nanos field */

64

Builder clearNanos();

65

66

/** Build the timestamp */

67

Timestamp build();

68

69

/** Build partial timestamp */

70

Timestamp buildPartial();

71

72

/** Clone this builder */

73

Builder clone();

74

75

/** Clear all fields */

76

Builder clear();

77

78

/** Merge from another timestamp */

79

Builder mergeFrom(Timestamp other);

80

}

81

}

82

```

83

84

### Duration Type

85

86

Represents a span of time with seconds and nanoseconds precision. Useful for timeouts, delays, and elapsed time measurements.

87

88

```java { .api }

89

/**

90

* Represents a signed span of time between two timestamps.

91

* Can be negative to represent time going backwards.

92

*/

93

class Duration implements Message {

94

/** Get seconds component */

95

long getSeconds();

96

97

/** Get nanoseconds component (can be negative) */

98

int getNanos();

99

100

/** Create new builder */

101

static Builder newBuilder();

102

103

/** Create builder from existing duration */

104

static Builder newBuilder(Duration prototype);

105

106

/** Parse from byte array */

107

static Duration parseFrom(byte[] data) throws InvalidProtocolBufferException;

108

109

/** Parse from ByteString */

110

static Duration parseFrom(ByteString data) throws InvalidProtocolBufferException;

111

112

/** Parse from CodedInputStream */

113

static Duration parseFrom(CodedInputStream input) throws IOException;

114

115

/** Get default instance */

116

static Duration getDefaultInstance();

117

118

/** Create builder for this message */

119

Builder newBuilderForType();

120

121

/** Create builder with this message's contents */

122

Builder toBuilder();

123

124

/** Duration builder */

125

static class Builder implements Message.Builder {

126

/** Get seconds value */

127

long getSeconds();

128

129

/** Set seconds value */

130

Builder setSeconds(long value);

131

132

/** Clear seconds field */

133

Builder clearSeconds();

134

135

/** Get nanos value */

136

int getNanos();

137

138

/** Set nanos value */

139

Builder setNanos(int value);

140

141

/** Clear nanos field */

142

Builder clearNanos();

143

144

/** Build the duration */

145

Duration build();

146

147

/** Build partial duration */

148

Duration buildPartial();

149

150

/** Clone this builder */

151

Builder clone();

152

153

/** Clear all fields */

154

Builder clear();

155

156

/** Merge from another duration */

157

Builder mergeFrom(Duration other);

158

}

159

}

160

```

161

162

### Any Type

163

164

Contains an arbitrary serialized protocol buffer message along with a URL that describes the type. Enables polymorphic message handling.

165

166

```java { .api }

167

/**

168

* Contains an arbitrary serialized protocol buffer message along with a URL

169

* that describes the type of the serialized message.

170

*/

171

class Any implements Message {

172

/** Get type URL identifying the message type */

173

String getTypeUrl();

174

175

/** Get serialized message bytes */

176

ByteString getValue();

177

178

/** Check if this Any contains a message of the given type */

179

static <T extends Message> boolean is(Any any, Class<T> clazz);

180

181

/** Unpack the Any to the specified message type */

182

<T extends Message> T unpack(Class<T> clazz)

183

throws InvalidProtocolBufferException;

184

185

/** Pack a message into an Any */

186

static Any pack(Message message);

187

188

/** Pack a message with custom type URL prefix */

189

static Any pack(Message message, String typeUrlPrefix);

190

191

/** Create new builder */

192

static Builder newBuilder();

193

194

/** Create builder from existing Any */

195

static Builder newBuilder(Any prototype);

196

197

/** Parse from byte array */

198

static Any parseFrom(byte[] data) throws InvalidProtocolBufferException;

199

200

/** Parse from ByteString */

201

static Any parseFrom(ByteString data) throws InvalidProtocolBufferException;

202

203

/** Parse from CodedInputStream */

204

static Any parseFrom(CodedInputStream input) throws IOException;

205

206

/** Get default instance */

207

static Any getDefaultInstance();

208

209

/** Any builder */

210

static class Builder implements Message.Builder {

211

/** Get type URL */

212

String getTypeUrl();

213

214

/** Set type URL */

215

Builder setTypeUrl(String value);

216

217

/** Clear type URL */

218

Builder clearTypeUrl();

219

220

/** Get value bytes */

221

ByteString getValue();

222

223

/** Set value bytes */

224

Builder setValue(ByteString value);

225

226

/** Clear value */

227

Builder clearValue();

228

229

/** Build the Any */

230

Any build();

231

232

/** Build partial Any */

233

Any buildPartial();

234

235

/** Clone this builder */

236

Builder clone();

237

238

/** Clear all fields */

239

Builder clear();

240

241

/** Merge from another Any */

242

Builder mergeFrom(Any other);

243

}

244

}

245

```

246

247

### Struct Type

248

249

Represents a structured data object consisting of fields with dynamic values. Similar to a JSON object.

250

251

```java { .api }

252

/**

253

* Represents a structured data object, equivalent to a JSON object.

254

* Consists of a collection of name/value pairs.

255

*/

256

class Struct implements Message {

257

/** Get all fields in the struct */

258

Map<String, Value> getFieldsMap();

259

260

/** Get number of fields */

261

int getFieldsCount();

262

263

/** Check if field exists */

264

boolean containsFields(String key);

265

266

/** Get field value */

267

Value getFieldsOrDefault(String key, Value defaultValue);

268

269

/** Get field value or throw exception */

270

Value getFieldsOrThrow(String key);

271

272

/** Create new builder */

273

static Builder newBuilder();

274

275

/** Create builder from existing struct */

276

static Builder newBuilder(Struct prototype);

277

278

/** Parse from byte array */

279

static Struct parseFrom(byte[] data) throws InvalidProtocolBufferException;

280

281

/** Parse from ByteString */

282

static Struct parseFrom(ByteString data) throws InvalidProtocolBufferException;

283

284

/** Get default instance */

285

static Struct getDefaultInstance();

286

287

/** Struct builder */

288

static class Builder implements Message.Builder {

289

/** Get mutable fields map */

290

Map<String, Value> getMutableFields();

291

292

/** Put field value */

293

Builder putFields(String key, Value value);

294

295

/** Put all fields from map */

296

Builder putAllFields(Map<String, Value> values);

297

298

/** Remove field */

299

Builder removeFields(String key);

300

301

/** Clear all fields */

302

Builder clearFields();

303

304

/** Build the struct */

305

Struct build();

306

307

/** Build partial struct */

308

Struct buildPartial();

309

310

/** Clone this builder */

311

Builder clone();

312

313

/** Clear all fields */

314

Builder clear();

315

316

/** Merge from another struct */

317

Builder mergeFrom(Struct other);

318

}

319

}

320

```

321

322

### Value Type

323

324

Represents a dynamically typed value which can be null, number, string, boolean, struct, or list.

325

326

```java { .api }

327

/**

328

* Represents a dynamically typed value which can hold various types

329

* including null, number, string, boolean, struct, or list of values.

330

*/

331

class Value implements Message {

332

/** Get the kind of value stored */

333

KindCase getKindCase();

334

335

/** Check if value is null */

336

boolean hasNullValue();

337

338

/** Get null value */

339

NullValue getNullValue();

340

341

/** Check if value is number */

342

boolean hasNumberValue();

343

344

/** Get number value */

345

double getNumberValue();

346

347

/** Check if value is string */

348

boolean hasStringValue();

349

350

/** Get string value */

351

String getStringValue();

352

353

/** Check if value is boolean */

354

boolean hasBoolValue();

355

356

/** Get boolean value */

357

boolean getBoolValue();

358

359

/** Check if value is struct */

360

boolean hasStructValue();

361

362

/** Get struct value */

363

Struct getStructValue();

364

365

/** Check if value is list */

366

boolean hasListValue();

367

368

/** Get list value */

369

ListValue getListValue();

370

371

/** Create new builder */

372

static Builder newBuilder();

373

374

/** Create builder from existing value */

375

static Builder newBuilder(Value prototype);

376

377

/** Parse from byte array */

378

static Value parseFrom(byte[] data) throws InvalidProtocolBufferException;

379

380

/** Get default instance */

381

static Value getDefaultInstance();

382

383

/** Value kind enumeration */

384

enum KindCase {

385

NULL_VALUE(1),

386

NUMBER_VALUE(2),

387

STRING_VALUE(3),

388

BOOL_VALUE(4),

389

STRUCT_VALUE(5),

390

LIST_VALUE(6),

391

KIND_NOT_SET(0);

392

393

/** Get field number */

394

int getNumber();

395

}

396

397

/** Value builder */

398

static class Builder implements Message.Builder {

399

/** Set null value */

400

Builder setNullValue(NullValue value);

401

402

/** Set number value */

403

Builder setNumberValue(double value);

404

405

/** Set string value */

406

Builder setStringValue(String value);

407

408

/** Set boolean value */

409

Builder setBoolValue(boolean value);

410

411

/** Set struct value */

412

Builder setStructValue(Struct value);

413

414

/** Set struct value from builder */

415

Builder setStructValue(Struct.Builder builderForValue);

416

417

/** Set list value */

418

Builder setListValue(ListValue value);

419

420

/** Set list value from builder */

421

Builder setListValue(ListValue.Builder builderForValue);

422

423

/** Clear kind */

424

Builder clearKind();

425

426

/** Build the value */

427

Value build();

428

429

/** Clone this builder */

430

Builder clone();

431

432

/** Clear all fields */

433

Builder clear();

434

435

/** Merge from another value */

436

Builder mergeFrom(Value other);

437

}

438

}

439

```

440

441

### ListValue Type

442

443

Represents a repeated Value, equivalent to a JSON array.

444

445

```java { .api }

446

/**

447

* Represents a repeated Value, equivalent to a JSON array.

448

* Contains an ordered list of dynamically typed values.

449

*/

450

class ListValue implements Message {

451

/** Get all values in the list */

452

List<Value> getValuesList();

453

454

/** Get value at specific index */

455

Value getValues(int index);

456

457

/** Get number of values */

458

int getValuesCount();

459

460

/** Create new builder */

461

static Builder newBuilder();

462

463

/** Create builder from existing list */

464

static Builder newBuilder(ListValue prototype);

465

466

/** Parse from byte array */

467

static ListValue parseFrom(byte[] data) throws InvalidProtocolBufferException;

468

469

/** Get default instance */

470

static ListValue getDefaultInstance();

471

472

/** ListValue builder */

473

static class Builder implements Message.Builder {

474

/** Get mutable values list */

475

List<Value> getValuesList();

476

477

/** Get value at index */

478

Value getValues(int index);

479

480

/** Set value at index */

481

Builder setValues(int index, Value value);

482

483

/** Set value at index from builder */

484

Builder setValues(int index, Value.Builder builderForValue);

485

486

/** Add value to end */

487

Builder addValues(Value value);

488

489

/** Add value from builder */

490

Builder addValues(Value.Builder builderForValue);

491

492

/** Add all values from collection */

493

Builder addAllValues(Iterable<? extends Value> values);

494

495

/** Clear all values */

496

Builder clearValues();

497

498

/** Remove value at index */

499

Builder removeValues(int index);

500

501

/** Build the list value */

502

ListValue build();

503

504

/** Clone this builder */

505

Builder clone();

506

507

/** Clear all fields */

508

Builder clear();

509

510

/** Merge from another list value */

511

Builder mergeFrom(ListValue other);

512

}

513

}

514

```

515

516

### Empty Type

517

518

Generic empty message that can be used in APIs that need a message but have no content.

519

520

```java { .api }

521

/**

522

* Generic empty message that is useful for APIs that need a message

523

* but have no actual content to convey.

524

*/

525

class Empty implements Message {

526

/** Create new builder */

527

static Builder newBuilder();

528

529

/** Parse from byte array */

530

static Empty parseFrom(byte[] data) throws InvalidProtocolBufferException;

531

532

/** Get default instance */

533

static Empty getDefaultInstance();

534

535

/** Empty builder */

536

static class Builder implements Message.Builder {

537

/** Build the empty message */

538

Empty build();

539

540

/** Clone this builder */

541

Builder clone();

542

543

/** Clear all fields */

544

Builder clear();

545

546

/** Merge from another empty */

547

Builder mergeFrom(Empty other);

548

}

549

}

550

```

551

552

### FieldMask Type

553

554

Represents a set of symbolic field paths for use in update operations and field projection.

555

556

```java { .api }

557

/**

558

* Represents a set of symbolic field paths, for example:

559

* paths: ["f.a", "f.b.d"]

560

* Used to specify which fields should be updated or returned.

561

*/

562

class FieldMask implements Message {

563

/** Get all field paths */

564

List<String> getPathsList();

565

566

/** Get path at specific index */

567

String getPaths(int index);

568

569

/** Get number of paths */

570

int getPathsCount();

571

572

/** Create new builder */

573

static Builder newBuilder();

574

575

/** Create builder from existing field mask */

576

static Builder newBuilder(FieldMask prototype);

577

578

/** Parse from byte array */

579

static FieldMask parseFrom(byte[] data) throws InvalidProtocolBufferException;

580

581

/** Get default instance */

582

static FieldMask getDefaultInstance();

583

584

/** FieldMask builder */

585

static class Builder implements Message.Builder {

586

/** Get mutable paths list */

587

List<String> getPathsList();

588

589

/** Get path at index */

590

String getPaths(int index);

591

592

/** Set path at index */

593

Builder setPaths(int index, String value);

594

595

/** Add path to end */

596

Builder addPaths(String value);

597

598

/** Add all paths from collection */

599

Builder addAllPaths(Iterable<String> values);

600

601

/** Clear all paths */

602

Builder clearPaths();

603

604

/** Build the field mask */

605

FieldMask build();

606

607

/** Clone this builder */

608

Builder clone();

609

610

/** Clear all fields */

611

Builder clear();

612

613

/** Merge from another field mask */

614

Builder mergeFrom(FieldMask other);

615

}

616

}

617

```

618

619

### Wrapper Types

620

621

Wrapper messages for primitive types, useful for distinguishing between zero values and unset values.

622

623

```java { .api }

624

/**

625

* Wrapper message for double.

626

* Enables distinction between 0.0 and unset value.

627

*/

628

class DoubleValue implements Message {

629

/** Get the double value */

630

double getValue();

631

632

/** Create from primitive value */

633

static DoubleValue of(double value);

634

635

/** Create new builder */

636

static Builder newBuilder();

637

638

/** Get default instance */

639

static DoubleValue getDefaultInstance();

640

}

641

642

/**

643

* Wrapper message for float.

644

* Enables distinction between 0.0f and unset value.

645

*/

646

class FloatValue implements Message {

647

/** Get the float value */

648

float getValue();

649

650

/** Create from primitive value */

651

static FloatValue of(float value);

652

653

/** Create new builder */

654

static Builder newBuilder();

655

656

/** Get default instance */

657

static FloatValue getDefaultInstance();

658

}

659

660

/**

661

* Wrapper message for int64.

662

* Enables distinction between 0L and unset value.

663

*/

664

class Int64Value implements Message {

665

/** Get the long value */

666

long getValue();

667

668

/** Create from primitive value */

669

static Int64Value of(long value);

670

671

/** Create new builder */

672

static Builder newBuilder();

673

674

/** Get default instance */

675

static Int64Value getDefaultInstance();

676

}

677

678

/**

679

* Wrapper message for uint64.

680

* Enables distinction between 0L and unset value.

681

*/

682

class UInt64Value implements Message {

683

/** Get the long value */

684

long getValue();

685

686

/** Create from primitive value */

687

static UInt64Value of(long value);

688

689

/** Create new builder */

690

static Builder newBuilder();

691

692

/** Get default instance */

693

static UInt64Value getDefaultInstance();

694

}

695

696

/**

697

* Wrapper message for int32.

698

* Enables distinction between 0 and unset value.

699

*/

700

class Int32Value implements Message {

701

/** Get the int value */

702

int getValue();

703

704

/** Create from primitive value */

705

static Int32Value of(int value);

706

707

/** Create new builder */

708

static Builder newBuilder();

709

710

/** Get default instance */

711

static Int32Value getDefaultInstance();

712

}

713

714

/**

715

* Wrapper message for uint32.

716

* Enables distinction between 0 and unset value.

717

*/

718

class UInt32Value implements Message {

719

/** Get the int value */

720

int getValue();

721

722

/** Create from primitive value */

723

static UInt32Value of(int value);

724

725

/** Create new builder */

726

static Builder newBuilder();

727

728

/** Get default instance */

729

static UInt32Value getDefaultInstance();

730

}

731

732

/**

733

* Wrapper message for bool.

734

* Enables distinction between false and unset value.

735

*/

736

class BoolValue implements Message {

737

/** Get the boolean value */

738

boolean getValue();

739

740

/** Create from primitive value */

741

static BoolValue of(boolean value);

742

743

/** Create new builder */

744

static Builder newBuilder();

745

746

/** Get default instance */

747

static BoolValue getDefaultInstance();

748

}

749

750

/**

751

* Wrapper message for string.

752

* Enables distinction between empty string and unset value.

753

*/

754

class StringValue implements Message {

755

/** Get the string value */

756

String getValue();

757

758

/** Create from string value */

759

static StringValue of(String value);

760

761

/** Create new builder */

762

static Builder newBuilder();

763

764

/** Get default instance */

765

static StringValue getDefaultInstance();

766

}

767

768

/**

769

* Wrapper message for bytes.

770

* Enables distinction between empty bytes and unset value.

771

*/

772

class BytesValue implements Message {

773

/** Get the ByteString value */

774

ByteString getValue();

775

776

/** Create from ByteString value */

777

static BytesValue of(ByteString value);

778

779

/** Create new builder */

780

static Builder newBuilder();

781

782

/** Get default instance */

783

static BytesValue getDefaultInstance();

784

}

785

```

786

787

### NullValue Enum

788

789

Represents a null value, used in Value messages to indicate the absence of a value.

790

791

```java { .api }

792

/**

793

* Represents JSON null value.

794

* Used in Value messages to explicitly represent null.

795

*/

796

enum NullValue {

797

/** The JSON null value */

798

NULL_VALUE(0);

799

800

/** Get the numeric value */

801

int getNumber();

802

803

/** Get enum value from number */

804

static NullValue valueOf(int value);

805

806

/** Get enum value from descriptor */

807

static NullValue valueOf(Descriptors.EnumValueDescriptor desc);

808

809

/** Get the descriptor for this enum */

810

static Descriptors.EnumDescriptor getDescriptor();

811

812

/** Get the descriptor for this value */

813

Descriptors.EnumValueDescriptor getValueDescriptor();

814

}

815

```

816

817

## Usage Examples

818

819

### Working with Timestamps

820

821

```java

822

import akka.protobufv3.internal.*;

823

824

// Create timestamp for current time

825

long currentSeconds = System.currentTimeMillis() / 1000;

826

int nanos = (int) ((System.currentTimeMillis() % 1000) * 1000000);

827

828

Timestamp timestamp = Timestamp.newBuilder()

829

.setSeconds(currentSeconds)

830

.setNanos(nanos)

831

.build();

832

833

// Read timestamp values

834

long seconds = timestamp.getSeconds();

835

int nanoseconds = timestamp.getNanos();

836

837

// Convert to milliseconds

838

long millis = seconds * 1000 + nanoseconds / 1000000;

839

```

840

841

### Working with Durations

842

843

```java

844

import akka.protobufv3.internal.*;

845

846

// Create 5 second duration

847

Duration fiveSeconds = Duration.newBuilder()

848

.setSeconds(5)

849

.setNanos(0)

850

.build();

851

852

// Create 1.5 second duration

853

Duration oneAndHalf = Duration.newBuilder()

854

.setSeconds(1)

855

.setNanos(500_000_000)

856

.build();

857

858

// Read duration

859

long durationSeconds = fiveSeconds.getSeconds();

860

int durationNanos = fiveSeconds.getNanos();

861

```

862

863

### Working with Any Messages

864

865

```java

866

import akka.protobufv3.internal.*;

867

868

// Pack a message into Any (assumes MyMessage exists)

869

// MyMessage original = MyMessage.newBuilder()

870

// .setName("example")

871

// .setId(123)

872

// .build();

873

874

// Any anyMessage = Any.pack(original);

875

876

// Check if Any contains specific type

877

// boolean isMyMessage = Any.is(anyMessage, MyMessage.class);

878

879

// Unpack the Any

880

// if (isMyMessage) {

881

// MyMessage unpacked = anyMessage.unpack(MyMessage.class);

882

// System.out.println("Unpacked: " + unpacked.getName());

883

// }

884

```

885

886

### Working with Struct and Value

887

888

```java

889

import akka.protobufv3.internal.*;

890

891

// Create a struct with various value types

892

Struct struct = Struct.newBuilder()

893

.putFields("name", Value.newBuilder()

894

.setStringValue("John Doe")

895

.build())

896

.putFields("age", Value.newBuilder()

897

.setNumberValue(30)

898

.build())

899

.putFields("active", Value.newBuilder()

900

.setBoolValue(true)

901

.build())

902

.putFields("metadata", Value.newBuilder()

903

.setNullValue(NullValue.NULL_VALUE)

904

.build())

905

.build();

906

907

// Read struct values

908

Value nameValue = struct.getFieldsOrThrow("name");

909

if (nameValue.hasStringValue()) {

910

String name = nameValue.getStringValue();

911

System.out.println("Name: " + name);

912

}

913

914

Value ageValue = struct.getFieldsOrThrow("age");

915

if (ageValue.hasNumberValue()) {

916

double age = ageValue.getNumberValue();

917

System.out.println("Age: " + age);

918

}

919

```

920

921

### Working with ListValue

922

923

```java

924

import akka.protobufv3.internal.*;

925

926

// Create a list of mixed values

927

ListValue list = ListValue.newBuilder()

928

.addValues(Value.newBuilder().setStringValue("hello").build())

929

.addValues(Value.newBuilder().setNumberValue(42).build())

930

.addValues(Value.newBuilder().setBoolValue(true).build())

931

.build();

932

933

// Iterate over values

934

for (Value value : list.getValuesList()) {

935

switch (value.getKindCase()) {

936

case STRING_VALUE:

937

System.out.println("String: " + value.getStringValue());

938

break;

939

case NUMBER_VALUE:

940

System.out.println("Number: " + value.getNumberValue());

941

break;

942

case BOOL_VALUE:

943

System.out.println("Boolean: " + value.getBoolValue());

944

break;

945

default:

946

System.out.println("Other type: " + value.getKindCase());

947

}

948

}

949

```

950

951

### Working with Wrapper Types

952

953

```java

954

import akka.protobufv3.internal.*;

955

956

// Create wrapper values

957

StringValue name = StringValue.of("John");

958

Int32Value age = Int32Value.of(30);

959

BoolValue active = BoolValue.of(true);

960

961

// Use in message (assumes a message with wrapper fields exists)

962

// UserProfile profile = UserProfile.newBuilder()

963

// .setName(name)

964

// .setAge(age)

965

// .setActive(active)

966

// .build();

967

968

// Check if wrapper fields are set vs default values

969

// if (profile.hasName()) {

970

// String nameStr = profile.getName().getValue();

971

// }

972

```