Package su.mvc.util

Source Code of su.mvc.util.KeyConverter

package su.mvc.util;

import com.googlecode.objectify.Key;
import ognl.DefaultTypeConverter;

import java.util.Map;


public class KeyConverter extends DefaultTypeConverter {

    public Object convertValue(Map map, Object o, Class toType) {
        if (toType == Key.class) {
            String s = ((String[]) o)[0];
            return Key.create(s);
        } else if (toType == String.class) {
            Key k = (Key) o;
            return k.getString();
        }

        return null;
    }

}
TOP

Related Classes of su.mvc.util.KeyConverter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.