com.sage.accpac.sm
Class ViewFields

java.lang.Object
  extended by com.sage.accpac.sm.ViewFields
All Implemented Interfaces:
java.lang.Iterable<ViewField>

@ThreadSafe
public final class ViewFields
extends java.lang.Object
implements java.lang.Iterable<ViewField>

Represents the collection of fields in an Accpac view

Thread safety
Thread-safe

Method Summary
 ViewField get(int fieldID)
          Gets the field with the given ID
 ViewField get(java.lang.String name)
          Gets the field with the given name
 int getCount()
          Gets the number of fields exposed by the view
 ViewField getFieldByIndex(int index)
          Gets the field based on the zero-based index within the collection.
 View getParent()
          Returns the View instance that created the current instance
 boolean has(java.lang.String name)
          checks whether the collection includes a field with the given name.
 java.util.Iterator<ViewField> iterator()
          Gets an iterator on the collection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCount

public int getCount()
Gets the number of fields exposed by the view

Consider instead simply iterating over the collection:

 for (ViewField field : myView.getViewFields())
 {
    process(field);
 }
 

Returns:
the number of fields exposed by the view
See Also:
getFieldByIndex(int), iterator()

get

public ViewField get(int fieldID)
Gets the field with the given ID

Parameters:
fieldID - the field ID
Returns:
the field corresponding to the id
Throws:
java.lang.IndexOutOfBoundsException - if there is no field with the given id.
See Also:
get(String), getFieldByIndex(int)

get

public ViewField get(java.lang.String name)
Gets the field with the given name

Parameters:
name - the field name
Returns:
the field corresponding to the name
Throws:
java.lang.IndexOutOfBoundsException - if there is no field with the given name.
See Also:
has(String)

getFieldByIndex

public ViewField getFieldByIndex(int index)
Gets the field based on the zero-based index within the collection. Consider instead simply iterating over the collection:
 for (ViewField field : myView.getViewFields())
 {
    process(field);
 }
 

Parameters:
index - the zero-based index within the collection
Returns:
the field corresponding to the index
Throws:
java.lang.IndexOutOfBoundsException - if there is no field with the given index.
See Also:
getCount()

has

public boolean has(java.lang.String name)
checks whether the collection includes a field with the given name.

If, and only if, this returns true then get(String) will not throw an exception.

Parameters:
name - the field name
Returns:
true if the collection includes a field with the given name

iterator

public java.util.Iterator<ViewField> iterator()
Gets an iterator on the collection

Specified by:
iterator in interface java.lang.Iterable<ViewField>
Returns:
an Iterator<ViewField> on the fields in the collection.

getParent

public View getParent()
Returns the View instance that created the current instance

Returns:
the View instance that created the current instance


Copyright © 2011 Sage Software, Inc. All rights reserved.