com.liguorien.flex.generator.writers.dom4j.methods
Class GetArray
java.lang.Object
com.liguorien.flex.generator.writers.dom4j.BuilderMethodWriter
com.liguorien.flex.generator.writers.dom4j.ContextMethodWriter
com.liguorien.flex.generator.writers.dom4j.methods.GetArray
- All Implemented Interfaces:
- MethodWriter<Dom4jBuilderHandler>
public class GetArray
- extends ContextMethodWriter
Generates a method who builds an array from a dom4j element.
The generated code looks like this :
/**
* Build a Person array from a dom4j element.
* @param el A dom4j element.
* @return A Person array.
*/
public static Person[] getContacts(Element el) {
if(el == null) return null;
final List els = el.elements();
final int size = els.size();
final Person[] items = new Person[size];
for(int i = 0; i < size; i++) {
final Element e = (Element)els.get(i);
items[i] = PersonBuilder.getInstance(e);
}
return items;
}
- Version:
- 0.2
- Author:
- Nicolas Désy
|
Constructor Summary |
GetArray(java.lang.Class<?> entryClass,
java.beans.PropertyDescriptor prop)
Create a new instance of GetArray |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
GetArray
public GetArray(java.lang.Class<?> entryClass,
java.beans.PropertyDescriptor prop)
- Create a new instance of GetArray
- Parameters:
entryClass - The entry type of the arrayprop - The property which requested this method generation.
writeMethod
public void writeMethod(java.io.Writer w,
FlexGenerator g,
Dom4jBuilderHandler handler,
java.lang.Class<?> clazz)
throws java.io.IOException
- Description copied from interface:
MethodWriter
- Writes method signature and body to the writer
- Parameters:
w - The Writerg - The current generatorhandler - The current handlerclazz - The current clazz
- Throws:
java.io.IOException
capitalize
public static java.lang.String capitalize(java.lang.String name)
- //FIXME: should not be here...
- Parameters:
name -
- Returns:
- The same string with the first letter capitalized
Copyright 2006 Nicolas Désy. All rights reserved.