📄 datasources.java
字号:
/**
* This file is generated by BorlandXML.
*/
package com.prudsys.pdm.Adapters.ServiceAPI.DataSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
* The DataSources class represents the element "DataSources" with the content
* model defined as follows:
* <p>
* <!ELEMENT DataSources (DataSource)*><br>
*/
public class DataSources extends com.borland.xml.toolkit.XmlObject
{
/**
*
*/
private static final long serialVersionUID = -8613658422005327807L;
/** xml tag name of this element. */
public static String _tagName = "DataSources";
/** Defines a list of DataSource objects. */
protected ArrayList<DataSource> _objDataSource = new ArrayList<DataSource>();
/** Public identifier. */
protected String publicId = "datasources.dtd";
/** System identifier. */
protected String systemId = "datasources.dtd";
/**
* Creates an empty DataSources object
*/
public DataSources()
{
super();
}
/**
* Returns an array of DataSource objects. The length of the returned
* array is zero if the list of DataSource object is empty.
*/
public DataSource[] getDataSource()
{
return _objDataSource.toArray(new DataSource[0]);
}
/**
* Replaces all existing DataSource objects with a new array of
* DataSource objects.
* @param objArray an array of DataSource objects.
*/
public void setDataSource(DataSource[] objArray)
{
if( objArray == null || objArray.length == 0 )
this._objDataSource.clear();
else
{
this._objDataSource = new ArrayList<DataSource>(Arrays.asList(objArray));
for( int i=0; i<objArray.length; i++ )
{
if( objArray[i] != null )
objArray[i]._setParent(this);
}
}
}
/**
* Gets the DataSource object at the specified index.
* @param index index of the returned object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public DataSource getDataSource(int index)
{
return _objDataSource.get(index);
}
/**
* Replaces an existing DataSource object at the specified index with
* a new DataSource object.
* @param index index of replaced object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public void setDataSource(int index, DataSource obj)
{
if( obj == null )
removeDataSource(index);
else
{
_objDataSource.set(index, obj);
obj._setParent(this);
}
}
/**
* Returns the number of DataSource objects in the list.
*/
public int getDataSourceCount()
{
return _objDataSource.size();
}
/**
* Returns <code>true</code> if there is no DataSource object in the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean isNoDataSource()
{
return _objDataSource.size() == 0;
}
/**
* Returns a read-only list of DataSource objects.
*/
public List<DataSource> getDataSourceList()
{
return Collections.unmodifiableList(_objDataSource);
}
/**
* Adds a new DataSource object at the end of the list.
* @return <code>true</code> if the new object is added to the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean addDataSource(DataSource obj)
{
if( obj==null )
return false;
obj._setParent(this);
return _objDataSource.add(obj);
}
/**
* Adds a list of new DataSource objects at the end of the list.
* @return <code>true</code> if the list was changed; otherwise, the method
* returns <code>false</code>.
*/
public boolean addDataSource(Collection<DataSource> coDataSource)
{
if( coDataSource==null )
return false;
java.util.Iterator<DataSource> it = coDataSource.iterator();
while( it.hasNext() )
{
Object obj = it.next();
if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
}
return _objDataSource.addAll(coDataSource);
}
/**
* Removes an existing DataSource object at the specified index.
* @return The removed object.
*/
public DataSource removeDataSource(int index)
{
return _objDataSource.remove(index);
}
/**
* Removes the specified DataSource object.
* @return <code>true</code> if this list contains the object; otherwise,
* the method returns <code>false</code>.
*/
public boolean removeDataSource(DataSource obj)
{
return _objDataSource.remove(obj);
}
/**
* Clears all DataSource objects from the list.
*/
public void clearDataSourceList()
{
_objDataSource.clear();
}
/**
* Marshals this object to an XML instance and outputs it to the specifed output stream.
* @param out OutputStream object to receive the output of the XML instance.
* @throws java.io.IOException Couldn't create the XML document.
*/
public void marshal(java.io.OutputStream out)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId() );
}
/**
* Marshals this object to an XML instance and stores it in the specified file.
* @param fileName File to store the output of the XML instance.
* @throws java.io.IOException Failed to get a FileOutputStream or to create the
* XML document.
*/
public void marshal(String fileName)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(), getSystemId() );
}
/**
* Marshals this object to an XML instance and stores it in the specified file.
* @param file File to store the output of the XML instance.
* @throws java.io.IOException Failed to get a FileOutputStream or to create the
* XML document.
*/
public void marshal(java.io.File file)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId() );
}
/**
* Marshals this object to an XML instance and outputs it to the specified writer.
* @param writer Writer object to receive the output of the XML instance.
* @throws java.io.IOException Failed to create the XML document.
*/
public void marshal(java.io.Writer writer)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId() );
}
/**
* Unmarshals an XML document back to a DataSources object from an input stream.
* @param in The InputStream object to read the XML document.
*/
public static DataSources unmarshal(java.io.InputStream in)
{
return DataSources.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(in));
}
/**
* Unmarshals an XML document back to a DataSources object from a file.
* @param file A File object.
*/
public static DataSources unmarshal(java.io.File file)
{
return DataSources.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(file));
}
/**
* Unmarshals an XML document back to a DataSources object from a file.
* @param fileName File name of XML document.
*/
public static DataSources unmarshal(String fileName)
{
return DataSources.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(fileName));
}
/**
* Unmarshals an XML document back to a DataSources object from a reader.
* @param reader A Reader object.
*/
public static DataSources unmarshal(java.io.Reader reader)
{
return DataSources.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(reader));
}
/**
* Gets public identifier.
*/
public String getPublicId()
{
return publicId;
}
/**
* Sets public identifier.
*/
public void setPublicId(String publicId)
{
this.publicId = publicId;
}
/**
* Gets system identifier.
*/
public String getSystemId()
{
return systemId;
}
/**
* Sets system identifier.
*/
public void setSystemId(String systemId)
{
this.systemId = systemId;
}
/**
* Marshals this object to an element.
*/
public com.borland.xml.toolkit.Element marshal()
{
com.borland.xml.toolkit.Element elem = new com.borland.xml.toolkit.Element(get_TagName());
/** Marshals a list of DataSource objects to elements */
Iterator<DataSource> it1 = _objDataSource.iterator();
while( it1.hasNext() )
{
DataSource obj = it1.next();
if( obj != null )
elem.addContent(obj.marshal());
}
return elem;
}
/**
* Unmarshals the specified "DataSources" element back to a DataSources object.
*/
public static DataSources unmarshal(com.borland.xml.toolkit.Element elem)
{
if( elem == null )
return null;
DataSources __objDataSources = new DataSources();
/** Unmarshals a list of "<<_tagName_>>" elements back to DataSource objects. */
Iterator it1 = elem.getChildren(DataSource._tagName).iterator();
while( it1.hasNext() )
__objDataSources.addDataSource(DataSource.unmarshal((com.borland.xml.toolkit.Element)it1.next()));
return __objDataSources;
}
/**
* Validates this object. If you pass <code>true</code> to this method, it
* checks for the first error and stops. On the other hand, if you pass
* <code>false</code> to this method, it collects all the errors by
* visiting every available elements.
* @param firstError <code>true</code> to exit this method when the first error
* is found; <code>false</code> to collect all errors.
* @return com.borland.xml.toolkit.ErrorList A list that contains one or more errors.
* @see com.borland.xml.toolkit.XmlObject#validate()
* @see com.borland.xml.toolkit.XmlObject#isValid()
* @see com.borland.xml.toolkit.ErrorList
*/
public com.borland.xml.toolkit.ErrorList validate(boolean firstError)
{
com.borland.xml.toolkit.ErrorList errors = new com.borland.xml.toolkit.ErrorList();
/** DataSource is zero or more */
Iterator<DataSource> it1 = _objDataSource.iterator();
while( it1.hasNext() )
{
DataSource obj = it1.next();
if( obj != null )
{
errors.add(obj.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
}
return errors.size()==0 ? null : errors;
}
/**
* Returns a list containing all child elements. Each element in the list is a subclass
* of XmlObject.
*/
public java.util.List<ArrayList<DataSource>> _getChildren()
{
java.util.List<ArrayList<DataSource>> children = new java.util.ArrayList<ArrayList<DataSource>>();
/** adds _objDataSource */
if( _objDataSource != null && _objDataSource.size() > 0 )
children.add(_objDataSource);
return children;
}
/**
* Gets the tag name of this element.
*/
public String get_TagName()
{
return _tagName;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -