com.jn.agileway.spring.converter.NameToCommonEnumConverter Maven / Gradle / Ivy
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