net.dongliu.prettypb.runtime.include.ExtensionField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of prettypb-include Show documentation
Show all versions of prettypb-include Show documentation
necessary lib for proto beans compile
package net.dongliu.prettypb.runtime.include;
/**
* extension field. number
* this is for eliminate object conversion when use setExtension and getExtension
*
* @author dongliu
*/
public class ExtensionField {
/**
* the proto field number
*/
private int number;
/**
* the proto field name
*/
private String name;
/**
* the field's java clazz
*/
private Class> clazz;
/**
* the proto field type
*/
private ProtoType protoType;
/**
* if this field is required.
*/
private boolean required;
/**
* if this field is repeated
*/
private boolean repeated;
/**
* if this field is packed. only for repeated field
*/
private boolean packed;
/**
* only for non repeated fields
*/
private T defaultValue;
/**
* which proto message this field extend. include proto package and proto name
*/
private String extendee;
public ExtensionField(int number, String name, Class> clazz, ProtoType protoType,
boolean required, boolean repeated, boolean packed, T defaultValue,
String extendee) {
this.number = number;
this.name = name;
this.clazz = clazz;
this.protoType = protoType;
this.required = required;
this.repeated = repeated;
this.packed = packed;
this.defaultValue = defaultValue;
this.extendee = extendee;
}
public int getNumber() {
return number;
}
public String getExtendee() {
return extendee;
}
public String getName() {
return name;
}
public Class> getClazz() {
return clazz;
}
public ProtoType getProtoType() {
return protoType;
}
public boolean isRequired() {
return required;
}
public boolean isRepeated() {
return repeated;
}
public boolean isPacked() {
return packed;
}
public T getDefaultValue() {
return defaultValue;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExtensionField that = (ExtensionField) o;
return number == that.number;
}
@Override
public int hashCode() {
return number;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy