com.neko233.skilltree.commons.parser.protobuf.ProtobufMessageMetadata Maven / Gradle / Ivy
package com.neko233.skilltree.commons.parser.protobuf;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Optional;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ProtobufMessageMetadata {
// 归属的 message class name
public String messageName;
// 描述符: repeated / optional / required
public String descriptor;
// field type
public String type;
// 字段名
public String fieldName;
// 顺序. 从 0 开始
public Integer order;
// 注释
public String comment;
/**
* 是不是数组
*
* @return is Array ?
*/
public boolean isArray() {
String trim = Optional.ofNullable(descriptor).orElse("").trim();
return "repeated".equalsIgnoreCase(trim);
}
}