super();
nsURI = "http://www.oreilly.com/catalog/javajaxb";
xmlName = "employee";
XMLFieldDescriptorImpl desc = null;
XMLFieldHandler handler = null;
FieldValidator fieldValidator = null;
//-- set grouping compositor
setCompositorAsSequence();
//-- initialize attribute descriptors
//-- _id
desc = new XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_id", "id", NodeType.Attribute);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Employee target = (Employee) object;
if(!target.hasId())
return null;
return new Integer(target.getId());
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Employee target = (Employee) object;
// if null, use delete method for optional primitives
if (value == null) {
target.deleteId();
return;
}
target.setId( ((Integer)value).intValue());
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public Object newInstance( Object parent ) {
return null;
}
} );
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.oreilly.com/catalog/javajaxb");
addFieldDescriptor(desc);
//-- validation code for: _id
fieldValidator = new FieldValidator();
{ //-- local scope
IntegerValidator iv = new IntegerValidator();
fieldValidator.setValidator(iv);
}
desc.setValidator(fieldValidator);
//-- initialize element descriptors
//-- _name
desc = new XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", NodeType.Element);
desc.setImmutable(true);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Employee target = (Employee) object;
return target.getName();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Employee target = (Employee) object;
target.setName( (java.lang.String) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public Object newInstance( Object parent ) {
return null;
}
} );
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.oreilly.com/catalog/javajaxb");
desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _name
fieldValidator = new FieldValidator();
fieldValidator.setMinOccurs(1);
{ //-- local scope
StringValidator sv = new StringValidator();
sv.setWhiteSpace("preserve");
fieldValidator.setValidator(sv);
}
desc.setValidator(fieldValidator);
//-- _addressList
desc = new XMLFieldDescriptorImpl(Address.class, "_addressList", "address", NodeType.Element);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Employee target = (Employee) object;
return target.getAddress();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Employee target = (Employee) object;
target.addAddress( (Address) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public Object newInstance( Object parent ) {
return new Address();
}
} );
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.oreilly.com/catalog/javajaxb");
desc.setRequired(true);
desc.setMultivalued(true);
addFieldDescriptor(desc);
//-- validation code for: _addressList
fieldValidator = new FieldValidator();
fieldValidator.setMinOccurs(1);
desc.setValidator(fieldValidator);
//-- _organization
desc = new XMLFieldDescriptorImpl(Organization.class, "_organization", "organization", NodeType.Element);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Employee target = (Employee) object;
return target.getOrganization();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Employee target = (Employee) object;
target.setOrganization( (Organization) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public Object newInstance( Object parent ) {
return new Organization();
}
} );
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.oreilly.com/catalog/javajaxb");
desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _organization
fieldValidator = new FieldValidator();
fieldValidator.setMinOccurs(1);
desc.setValidator(fieldValidator);
//-- _office
desc = new XMLFieldDescriptorImpl(Office.class, "_office", "office", NodeType.Element);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Employee target = (Employee) object;
return target.getOffice();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Employee target = (Employee) object;
target.setOffice( (Office) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public Object newInstance( Object parent ) {
return new Office();
}
} );
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.oreilly.com/catalog/javajaxb");
desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _office
fieldValidator = new FieldValidator();
fieldValidator.setMinOccurs(1);
desc.setValidator(fieldValidator);