All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy