org.codehaus.enunciate.modules.xfire_client.client-response-bean.fmt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of enunciate-xfire-client
Show all versions of enunciate-xfire-client
The Enunciate XFire Client module generates the client-side artifacts for invoking a remove web service endpoint via XFire.
The newest version!
[#ftl]
[#--template for the client-side endpoint interface.--]
[#assign beanfqn=message.responseBeanName/]
[#assign beanPackage=packageFor(beanfqn[0..(beanfqn?last_index_of(".") - 1)])/]
[#assign simpleBeanName=beanfqn[(beanfqn?last_index_of(".") + 1)..]/]
[@file name=(simpleBeanName + ".java") package=beanPackage charset="utf-8"]
// Generated by Enunciate
package ${beanPackage};
import javax.xml.namespace.QName;
/**
* Response bean for the ${message.elementName} operation.
*/
public class ${simpleBeanName} implements org.codehaus.enunciate.modules.xfire_client.GeneratedWrapperBean {
[#list message.childElements as childElement]
[#if "return" = childElement.elementName]
private ${classnameFor(childElement)} _retval;
[#else]
private ${classnameFor(childElement)} ${childElement.elementName};
[/#if]
[/#list]
[#list message.childElements as childElement]
[#if "return" = childElement.elementName]
[#assign varname="_retval"]
[#else]
[#assign varname=childElement.elementName]
[/#if]
/**
* ${childElement.elementDocs?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
public ${classnameFor(childElement)} get${childElement.elementName?cap_first}() {
return this.${varname};
}
/**
* ${childElement.elementDocs?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
public void set${childElement.elementName?cap_first}(${classnameFor(childElement)} value) {
this.${varname} = value;
}
[#if childElement.type.map?default(false)]
/**
* Puts an entry into the ${childElement.elementName} map.
*/
public void putIn${childElement.elementName?cap_first}(${classnameFor(childElement.type.keyType)} key, ${classnameFor(childElement.type.valueType)} value) {
if (this.${varname} == null) {
this.${varname} = (${classnameFor(childElement)}) new java.util.HashMap();
}
this.${varname}.put(key, value);
}
[#elseif childElement.type.array && !(childElement.type.componentType.primitive && ("byte" = childElement.type.componentType.kind?string?lower_case))]
/**
* Adds an item to the ${childElement.elementName} array.
*/
public void addTo${childElement.elementName?cap_first}(${componentTypeFor(childElement.type)} item) {
if (this.${varname} == null) {
this.${varname} = new ${componentTypeFor(childElement.type)}[1];
}
else {
Object oldArray = this.${varname};
int oldArrayLength = this.${varname}.length;
this.${varname} = new ${componentTypeFor(childElement.type)}[oldArrayLength + 1];
System.arraycopy(oldArray, 0, this.${varname}, 0, oldArrayLength);
}
this.${varname}[this.${varname}.length - 1] = item;
}
[#elseif childElement.type.collection]
/**
* Adds an item to the ${childElement.elementName} collection.
*/
public void addTo${childElement.elementName?cap_first}(${componentTypeFor(childElement.type)} item) {
if (this.${varname} == null) {
this.${varname} = (${classnameFor(childElement)}) org.codehaus.enunciate.modules.xfire_client.ListParser.newCollectionInstance(${collectionTypeFor(childElement)}.class);
}
this.${varname}.add(item);
}
[/#if]
[/#list]
// Inherited.
public QName getWrapperQName() {
return new QName("${message.elementNamespace}", "${message.elementName}");
}
// Inherited.
public String[] getPropertyOrder() {
return new String[] {[#list message.childElements as childElement] "${childElement.elementName}"[#if childElement_has_next],[/#if][/#list] };
}
}
[/@file]