org.codehaus.enunciate.modules.xfire_client.client-fault-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=fault.implicitFaultBeanQualifiedName/]
[#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;
/**
* Fault bean for the ${fault.elementName} fault.
*/
public class ${simpleBeanName} implements org.codehaus.enunciate.modules.xfire_client.GeneratedWrapperBean {
[#list fault.childElements as childElement]
private ${classnameFor(childElement)} ${childElement.elementName};
[/#list]
[#list fault.childElements as childElement]
/**
* ${childElement.elementDocs?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
public ${classnameFor(childElement)} get${childElement.elementName?cap_first}() {
return this.${childElement.elementName};
}
/**
* ${childElement.elementDocs?default("(no documentation provided)")?chop_linebreak?replace("\n", "\n * ")}
*/
public void set${childElement.elementName?cap_first}(${classnameFor(childElement)} ${childElement.elementName}) {
this.${childElement.elementName} = ${childElement.elementName};
}
[#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.${childElement.elementName} == null) {
this.${childElement.elementName} = (${classnameFor(childElement)}) new java.util.HashMap();
}
this.${childElement.elementName}.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.${childElement.elementName} == null) {
this.${childElement.elementName} = new ${componentTypeFor(childElement.type)}[1];
}
else {
Object oldArray = this.${childElement.elementName};
int oldArrayLength = this.${childElement.elementName}.length;
this.${childElement.elementName} = new ${componentTypeFor(childElement.type)}[oldArrayLength + 1];
System.arraycopy(oldArray, 0, this.${childElement.elementName}, 0, oldArrayLength);
}
this.${childElement.elementName}[this.${childElement.elementName}.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.${childElement.elementName} == null) {
this.${childElement.elementName} = (${classnameFor(childElement)}) org.codehaus.enunciate.modules.xfire_client.ListParser.newCollectionInstance(${collectionTypeFor(childElement)}.class);
}
this.${childElement.elementName}.add(item);
}
[/#if]
[/#list]
// Inherited.
public QName getWrapperQName() {
return new QName("${fault.targetNamespace}", "${fault.elementName}");
}
// Inherited.
public String[] getPropertyOrder() {
return new String[] {[#list fault.childElements as childElement] "${childElement.elementName}"[#if childElement_has_next],[/#if][/#list] };
}
}
[/@file]