Package org.nutz.ioc.val

Source Code of org.nutz.ioc.val.ReferValue

package org.nutz.ioc.val;

import org.nutz.ioc.Ioc;
import org.nutz.ioc.Ioc2;
import org.nutz.ioc.IocMaking;
import org.nutz.ioc.Iocs;
import org.nutz.ioc.ValueProxy;
import org.nutz.lang.meta.Pair;

public class ReferValue implements ValueProxy {

    private String name;
    private Class<?> type;

    public ReferValue(String name) {
        Pair<Class<?>> p = Iocs.parseName(name);
        this.name = p.getName();
        this.type = p.getValue();
    }

    public Object get(IocMaking ing) {
        Ioc ioc = ing.getIoc();
        if (ioc instanceof Ioc2)
            return ((Ioc2)ioc).get(type, name,ing.getContext());
        return ioc.get(type, name);
    }

}
TOP

Related Classes of org.nutz.ioc.val.ReferValue

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.