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

cn.maarlakes.enumx.Valuable Maven / Gradle / Ivy

Go to download

enumx 提供枚举值的统一接口,枚举值扩展接口,以及一些常见的枚举工具方法。

The newest version!
package cn.maarlakes.enumx;


import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonValue;
import jakarta.annotation.Nonnull;

import java.io.Serializable;

/**
 * @author linjpxc
 */
public interface Valuable extends Serializable {

    @Nonnull
    @JsonValue
    @JSONField
    T value();

    @Nonnull
    @SuppressWarnings("unchecked")
    default Class valueType() {
        return (Class) this.value().getClass();
    }

    @Nonnull
    static , V> Class getValueType(@Nonnull Class type) {
        return ValueUtils.getValueType(type);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy