sct.setEL(KeyImpl.getInstance(props[i].getName()), props[i]);
}
return sct;
}
public static Struct getMetaData(PageContext pc,UDFPropertiesImpl udf) throws PageException {
StructImpl func=new StructImpl();
pc=ThreadLocalPageContext.get(pc);
// TODO func.set("roles", value);
// TODO func.set("userMetadata", value); neo unterst゚tzt irgendwelche a
// meta data
Struct meta = udf.meta;
if(meta!=null) StructUtil.copy(meta, func, true);
func.setEL(KeyConstants._closure, Boolean.FALSE);
func.set(KeyConstants._access,ComponentUtil.toStringAccess(udf.getAccess()));
String hint=udf.hint;
if(!StringUtil.isEmpty(hint))func.set(KeyConstants._hint,hint);
String displayname=udf.displayName;
if(!StringUtil.isEmpty(displayname))func.set(KeyConstants._displayname,displayname);
func.set(KeyConstants._name,udf.functionName);
func.set(KeyConstants._output,Caster.toBoolean(udf.output));
func.set(KeyConstants._returntype, udf.strReturnType);
func.set(KeyConstants._description, udf.description);
func.set(KeyConstants._owner, udf.pageSource.getDisplayPath());
int format = udf.returnFormat;
if(format<0 || format==UDF.RETURN_FORMAT_WDDX) func.set(KeyConstants._returnFormat, "wddx");
else if(format==UDF.RETURN_FORMAT_PLAIN) func.set(KeyConstants._returnFormat, "plain");
else if(format==UDF.RETURN_FORMAT_JSON) func.set(KeyConstants._returnFormat, "json");
else if(format==UDF.RETURN_FORMAT_SERIALIZE)func.set(KeyConstants._returnFormat, "cfml");
FunctionArgument[] args = udf.arguments;
Array params=new ArrayImpl();
//Object defaultValue;
Struct m;
//Object defaultValue;
for(int y=0;y<args.length;y++) {
StructImpl param=new StructImpl();
param.set(KeyConstants._name,args[y].getName().getString());
param.set(KeyConstants._required,Caster.toBoolean(args[y].isRequired()));
param.set(KeyConstants._type,args[y].getTypeAsString());
displayname=args[y].getDisplayName();
if(!StringUtil.isEmpty(displayname)) param.set(KeyConstants._displayname,displayname);
int defType = args[y].getDefaultType();
if(defType==FunctionArgument.DEFAULT_TYPE_RUNTIME_EXPRESSION){
param.set(KeyConstants._default, "[runtime expression]");
}
else if(defType==FunctionArgument.DEFAULT_TYPE_LITERAL){
param.set(KeyConstants._default,
UDFUtil.getDefaultValue(pc, udf.pageSource, udf.index, y, null));
}
hint=args[y].getHint();
if(!StringUtil.isEmpty(hint))param.set(KeyConstants._hint,hint);
// TODO func.set("userMetadata", value); neo unterst゚tzt irgendwelche attr, die dann hier ausgebenen werden blレdsinn
// meta data
m=args[y].getMetaData();
if(m!=null) StructUtil.copy(m, param, true);