FileDocCategorySizeDatePackage
Employee.javaAPI DocExample7557Thu Mar 07 09:58:26 GMT 2002javajaxb.generated.hr

Employee.java

/*
 * This class was automatically generated with 
 * <a href="http://castor.exolab.org">Castor 0.9.3</a>, using an
 * XML Schema.
 * $Id$
 */

package javajaxb.generated.hr;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.Enumeration;
import java.util.Vector;
import org.exolab.castor.xml.*;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.DocumentHandler;

/**
 * Employee representation
 * @version $Revision$ $Date$
**/
public class Employee implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    private int _id;

    /**
     * keeps track of state for field: _id
    **/
    private boolean _has_id;

    private java.lang.String _name;

    private java.util.Vector _addressList;

    private Organization _organization;

    private Office _office;


      //----------------/
     //- Constructors -/
    //----------------/

    public Employee() {
        super();
        _addressList = new Vector();
    } //-- javajaxb.generated.hr.Employee()


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * 
     * @param vAddress
    **/
    public void addAddress(Address vAddress)
        throws java.lang.IndexOutOfBoundsException
    {
        if (!(_addressList.size() < 2)) {
            throw new IndexOutOfBoundsException();
        }
        _addressList.addElement(vAddress);
    } //-- void addAddress(Address) 

    /**
     * 
     * @param index
     * @param vAddress
    **/
    public void addAddress(int index, Address vAddress)
        throws java.lang.IndexOutOfBoundsException
    {
        if (!(_addressList.size() < 2)) {
            throw new IndexOutOfBoundsException();
        }
        _addressList.insertElementAt(vAddress, index);
    } //-- void addAddress(int, Address) 

    /**
    **/
    public void deleteId()
    {
        this._has_id= false;
    } //-- void deleteId() 

    /**
    **/
    public java.util.Enumeration enumerateAddress()
    {
        return _addressList.elements();
    } //-- java.util.Enumeration enumerateAddress() 

    /**
     * 
     * @param index
    **/
    public Address getAddress(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _addressList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (Address) _addressList.elementAt(index);
    } //-- Address getAddress(int) 

    /**
    **/
    public Address[] getAddress()
    {
        int size = _addressList.size();
        Address[] mArray = new Address[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (Address) _addressList.elementAt(index);
        }
        return mArray;
    } //-- Address[] getAddress() 

    /**
    **/
    public int getAddressCount()
    {
        return _addressList.size();
    } //-- int getAddressCount() 

    /**
    **/
    public int getId()
    {
        return this._id;
    } //-- int getId() 

    /**
    **/
    public java.lang.String getName()
    {
        return this._name;
    } //-- java.lang.String getName() 

    /**
    **/
    public Office getOffice()
    {
        return this._office;
    } //-- Office getOffice() 

    /**
    **/
    public Organization getOrganization()
    {
        return this._organization;
    } //-- Organization getOrganization() 

    /**
    **/
    public boolean hasId()
    {
        return this._has_id;
    } //-- boolean hasId() 

    /**
    **/
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * 
     * @param out
    **/
    public void marshal(java.io.Writer out)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * 
     * @param handler
    **/
    public void marshal(org.xml.sax.DocumentHandler handler)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.DocumentHandler) 

    /**
     * 
     * @param index
    **/
    public Address removeAddress(int index)
    {
        Object obj = _addressList.elementAt(index);
        _addressList.removeElementAt(index);
        return (Address) obj;
    } //-- Address removeAddress(int) 

    /**
    **/
    public void removeAllAddress()
    {
        _addressList.removeAllElements();
    } //-- void removeAllAddress() 

    /**
     * 
     * @param index
     * @param vAddress
    **/
    public void setAddress(int index, Address vAddress)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _addressList.size())) {
            throw new IndexOutOfBoundsException();
        }
        if (!(index < 2)) {
            throw new IndexOutOfBoundsException();
        }
        _addressList.setElementAt(vAddress, index);
    } //-- void setAddress(int, Address) 

    /**
     * 
     * @param addressArray
    **/
    public void setAddress(Address[] addressArray)
    {
        //-- copy array
        _addressList.removeAllElements();
        for (int i = 0; i < addressArray.length; i++) {
            _addressList.addElement(addressArray[i]);
        }
    } //-- void setAddress(Address) 

    /**
     * 
     * @param id
    **/
    public void setId(int id)
    {
        this._id = id;
        this._has_id = true;
    } //-- void setId(int) 

    /**
     * 
     * @param name
    **/
    public void setName(java.lang.String name)
    {
        this._name = name;
    } //-- void setName(java.lang.String) 

    /**
     * 
     * @param office
    **/
    public void setOffice(Office office)
    {
        this._office = office;
    } //-- void setOffice(Office) 

    /**
     * 
     * @param organization
    **/
    public void setOrganization(Organization organization)
    {
        this._organization = organization;
    } //-- void setOrganization(Organization) 

    /**
     * 
     * @param reader
    **/
    public static javajaxb.generated.hr.Employee unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (javajaxb.generated.hr.Employee) Unmarshaller.unmarshal(javajaxb.generated.hr.Employee.class, reader);
    } //-- javajaxb.generated.hr.Employee unmarshal(java.io.Reader) 

    /**
    **/
    public void validate()
        throws org.exolab.castor.xml.ValidationException
    {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}