org.nutz.ioc.java.IocObjectNode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nutz Show documentation
Show all versions of nutz Show documentation
Nutz, which is a collections of lightweight frameworks, each of them can be used independently
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();
}
}