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

org.nutz.ioc.java.IocObjectNode Maven / Gradle / Ivy

Go to download

Nutz, which is a collections of lightweight frameworks, each of them can be used independently

There is a newer version: 1.r.72
Show newest version
package org.nutz.ioc.java;

import org.nutz.ioc.IocMaking;
import org.nutz.ioc.Iocs;
import org.nutz.lang.meta.Pair;

public class IocObjectNode extends ChainNode {

    private String name;
    private Class type;

    public IocObjectNode(String name) {
        Pair> p = Iocs.parseName(name);
        this.name = p.getName();
        this.type = p.getValue();
    }

    protected Object getValue(IocMaking ing, Object obj) throws Exception {
        return ing.getIoc().get(type, name);
    }

    @Override
    protected String asString() {
        if (null == type)
            return "$" + name;
        return "$" + name + ":" + type.getName();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy