### 源文件
~~~
syntax = "proto2";
package com.test.protobuf;
option optimize_for = SPEED;
option java_package = "com.test.protobuf";
option java_outer_classname = "DataInfo";
message Student{
required string name = 1;
optional int32 age = 2;
optional string address = 3;
}
~~~
### 命令
```
protoc --java_out=src/main/java src/protobuf/Student.proto
```
### 生成目标文件
Datainfo.class
~~~
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: src/protobuf/Student.proto
package com.test.protobuf;
public final class DataInfo {
private DataInfo() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public interface StudentOrBuilder extends
// @@protoc_insertion_point(interface_extends:com.test.protobuf.Student)
com.google.protobuf.MessageOrBuilder {
/**
* <code>required string name = 1;</code>
*/
boolean hasName();
/**
* <code>required string name = 1;</code>
*/
java.lang.String getName();
/**
* <code>required string name = 1;</code>
*/
com.google.protobuf.ByteString
getNameBytes();
/**
* <code>optional int32 age = 2;</code>
*/
boolean hasAge();
/**
* <code>optional int32 age = 2;</code>
*/
int getAge();
/**
* <code>optional string address = 3;</code>
*/
boolean hasAddress();
/**
* <code>optional string address = 3;</code>
*/
java.lang.String getAddress();
/**
* <code>optional string address = 3;</code>
*/
com.google.protobuf.ByteString
getAddressBytes();
}
/**
* Protobuf type {@code com.test.protobuf.Student}
*/
public static final class Student extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:com.test.protobuf.Student)
StudentOrBuilder {
private static final long serialVersionUID = 0L;
// Use Student.newBuilder() to construct.
private Student(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Student() {
name_ = "";
address_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new Student();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Student(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
name_ = bs;
break;
}
case 16: {
bitField0_ |= 0x00000002;
age_ = input.readInt32();
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
address_ = bs;
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.test.protobuf.DataInfo.internal_static_com_test_protobuf_Student_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.test.protobuf.DataInfo.internal_static_com_test_protobuf_Student_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.test.protobuf.DataInfo.Student.class, com.test.protobuf.DataInfo.Student.Builder.class);
}
private int bitField0_;
public static final int NAME_FIELD_NUMBER = 1;
private volatile java.lang.Object name_;
/**
* <code>required string name = 1;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
* <code>required string name = 1;</code>
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
}
}
/**
* <code>required string name = 1;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int AGE_FIELD_NUMBER = 2;
private int age_;
/**
* <code>optional int32 age = 2;</code>
*/
public boolean hasAge() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
* <code>optional int32 age = 2;</code>
*/
public int getAge() {
return age_;
}
public static final int ADDRESS_FIELD_NUMBER = 3;
private volatile java.lang.Object address_;
/**
* <code>optional string address = 3;</code>
*/
public boolean hasAddress() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
* <code>optional string address = 3;</code>
*/
public java.lang.String getAddress() {
java.lang.Object ref = address_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
address_ = s;
}
return s;
}
}
/**
* <code>optional string address = 3;</code>
*/
public com.google.protobuf.ByteString
getAddressBytes() {
java.lang.Object ref = address_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
address_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasName()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (((bitField0_ & 0x00000001) != 0)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
}
if (((bitField0_ & 0x00000002) != 0)) {
output.writeInt32(2, age_);
}
if (((bitField0_ & 0x00000004) != 0)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, address_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) != 0)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
}
if (((bitField0_ & 0x00000002) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, age_);
}
if (((bitField0_ & 0x00000004) != 0)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, address_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.test.protobuf.DataInfo.Student)) {
return super.equals(obj);
}
com.test.protobuf.DataInfo.Student other = (com.test.protobuf.DataInfo.Student) obj;
if (hasName() != other.hasName()) return false;
if (hasName()) {
if (!getName()
.equals(other.getName())) return false;
}
if (hasAge() != other.hasAge()) return false;
if (hasAge()) {
if (getAge()
!= other.getAge()) return false;
}
if (hasAddress() != other.hasAddress()) return false;
if (hasAddress()) {
if (!getAddress()
.equals(other.getAddress())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasName()) {
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
}
if (hasAge()) {
hash = (37 * hash) + AGE_FIELD_NUMBER;
hash = (53 * hash) + getAge();
}
if (hasAddress()) {
hash = (37 * hash) + ADDRESS_FIELD_NUMBER;
hash = (53 * hash) + getAddress().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.test.protobuf.DataInfo.Student parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.test.protobuf.DataInfo.Student parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.test.protobuf.DataInfo.Student parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.test.protobuf.DataInfo.Student parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.test.protobuf.DataInfo.Student parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.test.protobuf.DataInfo.Student parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.test.protobuf.DataInfo.Student parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.test.protobuf.DataInfo.Student 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 com.test.protobuf.DataInfo.Student parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.test.protobuf.DataInfo.Student 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 com.test.protobuf.DataInfo.Student parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.test.protobuf.DataInfo.Student 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(com.test.protobuf.DataInfo.Student 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;
}
/**
* Protobuf type {@code com.test.protobuf.Student}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:com.test.protobuf.Student)
com.test.protobuf.DataInfo.StudentOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.test.protobuf.DataInfo.internal_static_com_test_protobuf_Student_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.test.protobuf.DataInfo.internal_static_com_test_protobuf_Student_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.test.protobuf.DataInfo.Student.class, com.test.protobuf.DataInfo.Student.Builder.class);
}
// Construct using com.test.protobuf.DataInfo.Student.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
name_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
age_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
address_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.test.protobuf.DataInfo.internal_static_com_test_protobuf_Student_descriptor;
}
@java.lang.Override
public com.test.protobuf.DataInfo.Student getDefaultInstanceForType() {
return com.test.protobuf.DataInfo.Student.getDefaultInstance();
}
@java.lang.Override
public com.test.protobuf.DataInfo.Student build() {
com.test.protobuf.DataInfo.Student result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.test.protobuf.DataInfo.Student buildPartial() {
com.test.protobuf.DataInfo.Student result = new com.test.protobuf.DataInfo.Student(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) != 0)) {
to_bitField0_ |= 0x00000001;
}
result.name_ = name_;
if (((from_bitField0_ & 0x00000002) != 0)) {
result.age_ = age_;
to_bitField0_ |= 0x00000002;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
to_bitField0_ |= 0x00000004;
}
result.address_ = address_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
@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 com.test.protobuf.DataInfo.Student) {
return mergeFrom((com.test.protobuf.DataInfo.Student)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.test.protobuf.DataInfo.Student other) {
if (other == com.test.protobuf.DataInfo.Student.getDefaultInstance()) return this;
if (other.hasName()) {
bitField0_ |= 0x00000001;
name_ = other.name_;
onChanged();
}
if (other.hasAge()) {
setAge(other.getAge());
}
if (other.hasAddress()) {
bitField0_ |= 0x00000004;
address_ = other.address_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
if (!hasName()) {
return false;
}
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.test.protobuf.DataInfo.Student parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.test.protobuf.DataInfo.Student) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object name_ = "";
/**
* <code>required string name = 1;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
* <code>required string name = 1;</code>
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string name = 1;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string name = 1;</code>
*/
public Builder setName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
name_ = value;
onChanged();
return this;
}
/**
* <code>required string name = 1;</code>
*/
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000001);
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
* <code>required string name = 1;</code>
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
name_ = value;
onChanged();
return this;
}
private int age_ ;
/**
* <code>optional int32 age = 2;</code>
*/
public boolean hasAge() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
* <code>optional int32 age = 2;</code>
*/
public int getAge() {
return age_;
}
/**
* <code>optional int32 age = 2;</code>
*/
public Builder setAge(int value) {
bitField0_ |= 0x00000002;
age_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 age = 2;</code>
*/
public Builder clearAge() {
bitField0_ = (bitField0_ & ~0x00000002);
age_ = 0;
onChanged();
return this;
}
private java.lang.Object address_ = "";
/**
* <code>optional string address = 3;</code>
*/
public boolean hasAddress() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
* <code>optional string address = 3;</code>
*/
public java.lang.String getAddress() {
java.lang.Object ref = address_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
address_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>optional string address = 3;</code>
*/
public com.google.protobuf.ByteString
getAddressBytes() {
java.lang.Object ref = address_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
address_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>optional string address = 3;</code>
*/
public Builder setAddress(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
address_ = value;
onChanged();
return this;
}
/**
* <code>optional string address = 3;</code>
*/
public Builder clearAddress() {
bitField0_ = (bitField0_ & ~0x00000004);
address_ = getDefaultInstance().getAddress();
onChanged();
return this;
}
/**
* <code>optional string address = 3;</code>
*/
public Builder setAddressBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
address_ = value;
onChanged();
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:com.test.protobuf.Student)
}
// @@protoc_insertion_point(class_scope:com.test.protobuf.Student)
private static final com.test.protobuf.DataInfo.Student DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.test.protobuf.DataInfo.Student();
}
public static com.test.protobuf.DataInfo.Student getDefaultInstance() {
return DEFAULT_INSTANCE;
}
@java.lang.Deprecated public static final com.google.protobuf.Parser<Student>
PARSER = new com.google.protobuf.AbstractParser<Student>() {
@java.lang.Override
public Student parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Student(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<Student> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Student> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.test.protobuf.DataInfo.Student getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_com_test_protobuf_Student_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_com_test_protobuf_Student_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\032src/protobuf/Student.proto\022\021com.test.p" +
"rotobuf\"5\n\007Student\022\014\n\004name\030\001 \002(\t\022\013\n\003age\030" +
"\002 \001(\005\022\017\n\007address\030\003 \001(\tB\037\n\021com.test.proto" +
"bufB\010DataInfoH\001"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_com_test_protobuf_Student_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_com_test_protobuf_Student_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_com_test_protobuf_Student_descriptor,
new java.lang.String[] { "Name", "Age", "Address", });
}
// @@protoc_insertion_point(outer_class_scope)
}
~~~
- 环境搭建
- JRE和JDK
- tomcat
- 问题
- maven
- 简介
- IDEA
- 修改快捷键
- 快捷键
- java基础
- 编译运行
- 常量和变量
- JShell
- 数据类型
- 基本数据类型
- 整数
- 浮点数
- 字符
- 布尔
- 引用数据类型
- 类
- 数组
- 接口
- 常用类
- Object
- 简介
- 方法
- getClass
- equals
- toString
- 日期时间
- Date
- DateFormat
- Calendar
- System
- currentTimeMillis
- arraycopy
- 字符串
- StringBuilder
- 包装类
- 简介
- 装箱与拆箱
- 基本类型与字符串之间的转换
- Arrays
- 集合
- 简介
- 迭代器
- Collection
- List
- ArrayList
- Vector
- LinkedList
- Set
- HashSet
- LinkedSet
- Collections
- Map
- HashMap
- LinkedHashMap
- 泛型
- 泛型类
- 泛型方法
- 泛型接口
- 泛型通配符
- 异常
- Throwable
- Error
- 异常的处理
- 多线程
- 简介
- Thread
- 简介
- 创建线程
- 线程分类
- join
- 线程状态
- 6种状态
- 线程安全
- 买票问题
- 同步锁
- 同步代码块
- 同步方法
- Lock锁
- 死锁
- Threadlocal
- 三大特性
- Java内存模型
- 简介
- Volatile
- 线程通信
- 等待唤醒机制
- 例子
- 线程池
- 简介
- Executor
- 例子
- File
- 构造方法
- IO
- 简介
- 字节流
- 输出流
- OutputStream
- FileOutputStream
- 输入流
- InputStream
- FileInputStream
- 复制图片
- 字符流
- 输入流
- Reader
- FileReader
- 输出流
- Writer
- FileWriter
- 缓冲流
- 简介
- 字节缓冲流
- 字符缓冲流
- 转换流
- 字符编码和字符集
- InputStreamReader
- OutputStreamWriter
- 序列化
- 简介
- ObjectOutputStream
- ObjectInputStream
- 打印流
- PrintStream
- 异常处理
- 属性集
- 简介
- 网络编程
- Socket
- TCP
- 简介
- 三次握手
- Socket
- ServerSocket
- 例子
- 上传文件
- IO
- BIO
- NIO
- AIO
- 面向对象
- 类
- 简介
- 定义
- static
- 抽象类
- 内部类
- 封装
- 简介
- final
- 权限修饰符
- 继承
- super
- 多态
- 接口
- 单元测试
- 注解
- java提高
- 反射
- 简介
- 获取类
- 创建对象
- 例子
- 为私有属性赋值
- Jdbc加载驱动
- JVM
- Java8新特性
- Lamdda
- 简介
- 示例
- @FunctionalInterface
- Stream
- 设计模式
- 设计原则
- 设计模式
- 单例模式
- 简介
- 饿汉式
- 懒汉式
- 静态内部方式
- 枚举方式
- 工厂模式
- 简介
- 简单工厂模式
- 工厂方法模式
- 代理模式
- 简介
- 静态代理
- 动态代理
- Jdk
- Cglib
- 区别
- 建造者模式
- 数据格式
- Protobuf
- 示例
- Student.proto
- 测试
- web基础
- JDBC
- 简介
- 核心类
- JDBCUtils
- 连接池
- Druid
- 简介
- druid.properties
- JDBCUtils
- JDBCTemplate
- Servlet
- 简介
- Servlet
- Servlet
- GenericServlet
- HttpServlet
- 常用框架
- Spring全家桶
- Spring
- 简介
- 注解
- Autowired
- Value
- Scope
- PostConstruct
- PreDestroy
- Component
- Configuration
- Bean
- ComponentScan
- PropertySource
- Import
- IoC
- 简介
- bean
- bean工厂
- bean创建
- 作用范围
- 生命周期
- DI
- 简介
- 方式
- 构造函数
- set方法
- 注解
- 注入集合
- 注解
- applicationContext.xml
- bean
- test
- 原理
- 如何创建Web环境中的IoC容器
- 源码分析
- Aop
- 简介
- 基础
- 相关术语
- 切入点表达式
- 常用通知
- 实现原理
- 静态代理
- JDK动态代理
- CGLIB动态代理
- 比较
- 事务
- 编程式事务
- 声明式事务
- 例子
- xml
- pom
- bean.xml
- bean
- Logger
- test
- 注解
- bean.xml
- bean
- Logger
- 整合
- Spring之JDBC
- JdbcTemplate
- 三方DataSource
- DBCP
- C3P0
- Spring之事务
- 事务简介
- 特性
- 事务并发问题
- 隔离级别
- 事务管理分类
- 编程式事务管理
- 声明式事务管理
- xml
- 注解
- SpringMVC
- 简介
- 常用注解
- @Controller
- @RequestMapping
- @RequstParam
- @PathVariable
- @RequestHeader
- @CookieValue
- @ModelAttribute
- @SessionAttribute
- @ResponseBody
- @RequestBody
- 获取参数
- 拦截器
- 定义拦截器
- 配置拦截器
- SpringData
- 简介
- SpringDataJpa
- 简介
- 核心类
- Persistence
- EntityManagerFactory
- Entity
- 基本注解
- 关联关系注解
- @JoinColumn
- @OneToOne
- EntityManager
- EntityTransaction
- Query
- 基础查询方法
- Repository
- CrudRepository
- PagingAndSortingRepository
- JpaRepository
- SimpleJpaRepository
- Jpql
- 简介
- 操作
- maven
- 简介
- 入门案例1
- 环境搭建
- 实体类
- 测试
- 入门案例2
- pom
- applicationContext.xml
- pojo
- dao
- test
- Springboot
- 入门案例
- pom
- application.yml
- 实体类
- dao
- test
- SpringDataRedis
- 简介
- application.yml
- 使用
- SpringDataMongoDB
- 简介
- mongodb-driver
- SpringDataMongoDB
- SpringScurity
- BCrypt
- 常见认证机制
- HTTP Base Auth
- Cookie Auth
- OAuth
- Token Auth
- JWT
- 简介
- JJWT
- 简介
- 入门案例
- pom
- 生成token
- 校验token
- 自定义claims
- SpringCache
- 简介
- ElasticSearch
- 简介
- mybatis
- 简介
- 基础
- 核心类
- SqlSessionFactory
- SqlSession
- Executor
- MappedStatement
- 配置文件
- db.properties
- sqlMapConfig.xml
- Mapper.xml
- 关联查询
- 一对一
- resultType
- resultMap
- 一对多
- resultMap
- 动态sql
- if
- where
- sql片段
- foreach
- 缓存
- 简介
- 一级缓存
- 二级缓存
- 增删改查
- select
- insert
- update
- delete
- params
- provider
- 入门案例
- xml
- sqlMapConfig
- User
- xml方式
- UserMapper.xml
- test
- 代理方式(JDK)
- 规范
- UserMapper.xml
- UserMapper.class
- test
- springboot
- pom
- application.yml
- Person
- mapper
- App
- test
- Http
- HttpClient
- pom
- request
- 连接池
- RestTemplate
- 队列
- ActiveMQ
- pom
- application.yml
- QueueConfig
- 生产者
- 消费者
- RabbitMQ
- 网络编程
- netty
- 简介
- 核心组件
- Channel
- EventLoop
- ChannelHandler
- 常用子类
- ChannelPipeline
- ChannelConfig
- Future
- ChannelFuture
- ByteBuf
- 简介
- 案例
- Echo服务器
- EchoServer
- EchoServerHandler
- EchoClient
- EchoClientHandler
- Websocket
- pom
- Server
- WebsocketChannelInitalizer
- TextWebsocketFrameHandler
- Protobuf
- Server
- ProtobufChannelInitalizer
- ProtobufServerHandler
- lombok
- Springboot集成lombok
- 日志
- 定时任务
- cron表达式
- Spring自带
- 任务
- 开启
- Quartz
- 简介
- pom
- Application
- config
- job
- controller
- Junit
- Spring整合Junit
- 爬虫
- Jsoup
- 简介
- 解析
- 解析URL
- 解析字符串
- 解析文件
- Document
- Element
- Selector
- WebMagic
- Protobuf
- 环境搭建
- Json
- Springboot
- 简介
- 配置
- pom
- 常用注解
- RestController
- 整合
- JdbcTemplate
- pom
- application.properties
- UserService
- Mybatis
- pom
- application.properties
- UserMapper
- App
- Springjpa
- pom
- Person
- PersonDao
- App
- test
- 多数据源
- application.properties
- Lombok
- 安装
- 依赖
- 实体类
- 常用注解
- EhCache
- 依赖
- chcache.xml
- UserMapper
- 清除缓存
- 开启缓存
- 热部署
- 简介
- 依赖
- 监控管理
- Actuator
- 日志
- log4j
- pom
- log4j.properties
- test
- Aop方式
- pom
- WebLogAspect
- lombok
- application.yml
- logbok-spring.xml
- pom
- 使用
- 事务
- 简介
- 分布式事务
- DBConfig
- 性能调优
- 组件自动扫描
- Servlet容器更换为Undernow
- Springboot jvm参数调优
- 全局处理
- 全局异常处理
- 拦截器
- 数据库连接池
- 打包发布
- jar
- war
- 案例
- 入门案例
- SpringCloud
- 简介
- Eureka
- 服务端
- pom
- application.yml
- EurekaApplication
- 高可用
- 用户认证
- 客户端
- pom
- application.yml
- EurekaClientApplication
- Ribbon
- pom
- application.yml
- Application
- RibbonConfig
- RibbonService
- RibbonController
- Feign
- pom
- application.yml
- Application
- config
- dao
- service
- controller
- Hystrix
- Sidecar
- pom
- application.yml
- Application
- Zuul
- pom
- application.yml
- Application
- 过滤器
- 类型
- 禁用过滤器
- 容错与回退
- 高可用