use of com.webcohesion.enunciate.modules.jaxb.model.AnyElement in project enunciate by stoicflame.
the class ClientSimpleNameMethod method exec.
public Object exec(List list) throws TemplateModelException {
if (list.size() < 1) {
throw new TemplateModelException("The functionIdentifierFor method must have an accessor or type mirror as a parameter.");
}
TemplateModel from = (TemplateModel) list.get(0);
Object unwrapped = BeansWrapper.getDefaultInstance().unwrap(from);
String name;
if (unwrapped instanceof Accessor) {
Accessor accessor = (Accessor) unwrapped;
name = accessor.getClientSimpleName();
if (this.clientNames.containsKey(name)) {
name = this.clientNames.get(name);
}
} else if (unwrapped instanceof AnyElement) {
AnyElement accessor = (AnyElement) unwrapped;
name = accessor.getClientSimpleName();
if (this.clientNames.containsKey(name)) {
name = this.clientNames.get(name);
}
} else {
throw new TemplateModelException("The clientSimpleName method must have an accessor as a parameter.");
}
return name;
}
Aggregations