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

link.jfire.mvc.binder.field.impl.DoubleField Maven / Gradle / Ivy

package link.jfire.mvc.binder.field.impl;

import java.lang.reflect.Field;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import link.jfire.baseutil.StringUtil;

public class DoubleField extends AbstractBinderField
{
    public DoubleField(String prefix, Field field)
    {
        super(prefix, field);
    }
    
    @SuppressWarnings("restriction")
    @Override
    public Object setValue(HttpServletRequest request, Object entity, Map map, HttpServletResponse response) throws InstantiationException, IllegalAccessException
    {
        String value = map.get(name);
        if (StringUtil.isNotBlank(value))
        {
            if (entity == null)
            {
                entity = type.newInstance();
            }
            unsafe.putDouble(entity, offset, Double.valueOf(value));
        }
        return entity;
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy