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

com.jn.agileway.spring.converter.NameToCommonEnumConverter Maven / Gradle / Ivy

There is a newer version: 3.1.12
Show newest version
package com.jn.agileway.spring.converter;

import com.jn.langx.util.enums.CommonEnumByNameConverter;
import com.jn.langx.util.enums.base.CommonEnum;
import org.springframework.core.convert.converter.Converter;

public class NameToCommonEnumConverter implements Converter {

    private CommonEnumByNameConverter delegate;

    public NameToCommonEnumConverter(Class enumClass) {
        this.delegate = new CommonEnumByNameConverter(enumClass);
    }

    @Override
    public T convert(String name) {
        if (!delegate.isConvertible(String.class, this.delegate.getEnumClass())) {
            return null;
        }
        return this.delegate.apply(name);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy