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

io.protostuff.compiler.model.EnumConstant Maven / Gradle / Ivy

The newest version!
package io.protostuff.compiler.model;

import com.google.common.base.MoreObjects;

/**
 * Enum value (constant).
 *
 * @author Kostiantyn Shchepanovskyi
 * @see Enum
 */
public class EnumConstant extends AbstractDescriptor {

    protected int value;

    private Enum parent;

    public EnumConstant(Enum parent) {
        this.parent = parent;
    }

    @Override
    public Enum getParent() {
        return parent;
    }

    public void setParent(Enum parent) {
        this.parent = parent;
    }

    @Override
    public DescriptorType getDescriptorType() {
        return DescriptorType.ENUM_CONSTANT;
    }

    /**
     * Returns numeric value of this enum constant that is used in serialized form.
     */
    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .omitNullValues()
                .add("name", name)
                .add("value", value)
                .add("options", options)
                .toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy