use of org.apache.axis.wsdl.symbolTable.TypeEntry in project Lucee by lucee.
the class AxisCaster method _initPojo.
private static void _initPojo(PageContext pc, TypeEntry typeEntry, QName type, Pojo pojo, Property[] props, Struct sct, Component comp, TypeMapping tm, Set<Object> done) throws PageException {
Property p;
Object v;
Collection.Key k;
CFMLExpressionInterpreter interpreter = new CFMLExpressionInterpreter(false);
for (int i = 0; i < props.length; i++) {
p = props[i];
k = Caster.toKey(p.getName());
// value
v = sct.get(k, null);
if (v == null && comp != null)
v = comp.get(k, null);
if (v != null)
v = Caster.castTo(pc, p.getType(), v, false);
else {
if (!StringUtil.isEmpty(p.getDefault())) {
try {
v = Caster.castTo(pc, p.getType(), p.getDefault(), false);
} catch (PageException pe) {
try {
v = interpreter.interpret(pc, p.getDefault());
v = Caster.castTo(pc, p.getType(), v, false);
} catch (PageException pe2) {
throw new ExpressionException("can not use default value [" + p.getDefault() + "] for property [" + p.getName() + "] with type [" + p.getType() + "]");
}
}
}
}
// set or throw
if (v == null) {
if (p.isRequired())
throw new ExpressionException("required property [" + p.getName() + "] is not defined");
} else {
TypeEntry childTE = null;
QName childT = null;
if (typeEntry != null) {
childTE = AxisUtil.getContainedElement(typeEntry, p.getName(), null);
if (childTE != null)
childT = childTE.getQName();
}
Reflector.callSetter(pojo, p.getName().toLowerCase(), _toAxisType(tm, null, childTE, childT, null, v, done));
}
}
}
use of org.apache.axis.wsdl.symbolTable.TypeEntry in project Lucee by lucee.
the class Axis1Client method map.
private Class map(PageContext pc, SymbolTable symbolTable, Config secondChanceConfig, org.apache.axis.encoding.TypeMapping tm, TypeEntry type) throws PageException {
TypeEntry ref = type.getRefType();
if (ref != null && ref != type) {
map(pc, symbolTable, secondChanceConfig, tm, ref);
}
// Simple Type
if (type.getContainedElements() == null)
return null;
// is class already registered!
// Class clazz=tm.getClassForQName(type.getQName());
// if(clazz!=null && clazz.getName().equals(getClientClassName(type))) return clazz;
Class clazz = mapComplex(pc, symbolTable, secondChanceConfig, tm, type);
// TODO make a better impl; this is not the fastest way to make sure all pojos use the same classloader
if (clazz != null && getClassLoader(pc, secondChanceConfig) != clazz.getClassLoader()) {
clazz = mapComplex(pc, symbolTable, secondChanceConfig, tm, type);
}
return clazz;
}
use of org.apache.axis.wsdl.symbolTable.TypeEntry in project Lucee by lucee.
the class Axis1Client method mapComplex.
private Class mapComplex(PageContext pc, SymbolTable symbolTable, Config secondChanceConfig, org.apache.axis.encoding.TypeMapping tm, TypeEntry type) throws PageException {
TypeEntry ref = type.getRefType();
if (ref == null)
return _mapComplex(pc, symbolTable, secondChanceConfig, tm, type);
// Array
if (ref.getContainedElements() == null)
return null;
Class clazz = mapComplex(pc, symbolTable, secondChanceConfig, tm, ref);
if (clazz == null)
return null;
Class arr = ClassUtil.toArrayClass(clazz);
TypeMappingUtil.registerBeanTypeMapping(tm, arr, type.getQName());
return arr;
}
Aggregations