{
"对象名称" : {
type : "对象类型",
parent : "被继承的对象名称",
events : {
fetch : "触发器的类型或者函数名",
create : "触发器的类型或者函数名",
depose : "触发器的类型或者函数名"
},
args : [
参数1, 参数2 ...
],
fields : {
"字段名称1" : 字段值1 ,
"字段名称2" : 字段值2 ,
...
},
factory : "xxx.yyy.zzz#create" //工厂类#工厂方法,这个create方法需要带参数,怎么破?是上面的fields?
}
}
大神,菜鸟又来求救了。。。
10 回复
大神,
credential : {
type : "com.mongodb.MongoCredential",
args : ["xxx","xxx","xxx"],
factory:"$credential#createCredential"
},
creList : {
type : "java.util.ArrayList",
args : [[{refer : "credential"}]]
}
在creList 里面想添加credential 这样可以吗?
credential : {
type : "com.mongodb.MongoCredential",
args : ["xxx","xxx","xxx"],
factory:"$credential#createCredential"
},
$credential 指向 credential, 一个对象怎么可能用自己来构建呢??
要这样写. 因为createCredential是静态方法,直接用类名.
credential : {
type : "com.mongodb.MongoCredential",
args : ["xxx","xxx","xxx"],
factory:"com.mongodb.MongoCredential#createCredential"
},
但password是char[], 这个有点烦. 我建议做个帮助类
public class MongoCredentialBuilder {
public static MongoCredential createCredential(final String userName, final String source, final String password) {
return MongoCredential.createCredential(userName, source, password == null ? null : password.toCharArray());
}
}
credential : {
type : "com.mongodb.MongoCredential",
args : ["xxx","xxx","xxx"],
factory:"xxxx.MongoCredentialBuilder#createCredential"
},
添加回复
请先登陆