Hi Oliver, you asked for an example of using CodeList
Things to note in the following example:
- serialVersionUID is required, we need to be able to send these things
back and forth
- you can directly create your static final constants using a constructor
- your subclass needs to maintain a list (which is passed to the super
class)
- the family method returns all possible values in a strongly typed array
- CodeList has no advantage over Java 5 enum (the difference is
syntactic sugar), although you can create additional CodeLists values at
runtime
- I imagine Martin has carefully named the methods so an Java 5 Enum can
extend CodeList, although I am not positive on this
Cheers,
Jody
public final class SortOrder extends CodeList {
private static final long serialVersionUID = 7840334200112859571L;
private static final List all = new ArrayList(2);
public static final SortOrder ASCENDING = new SortOrder("ASC");
public static final SortOrder DESCENDING = new SortOrder("DESC");
private SortOrder( String name ){
super(name, all );
}
public CodeList[] family() {
return (CodeList[]) all.toArray( new CodeList[ all.size()]);
}
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel