com.sage.accpac.sm
Class Errors

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

@ThreadSafe
public class Errors
extends java.lang.Object
implements java.lang.Iterable<Error>

Provides access to the errors raised within the context of the current program. They include errors when calling methods of the Program object, as well as methods of all objects created directly or indirectly from the Program object. These include errors of all views created within the program.
An object of this class cannot be created directly by an application. Obtain the object from the Program object's Errors property.
The collection is a dynamic object; its properties can change; they reflect the state of the error stack at the time that the collection is accessed. For example consider:

 Program s;
 .
 .
 .
 View v = s.openView(...);
 .
 .
 .
 Errors e = s.getErrors();
 System.out.println(e.getCount();
 v.update();
 System.out.println(e.getCount();
 .
 .
 .
 
The count printed may be different on the second occasion due to errors caused by the update() call. Note that there is only one call to getErrors().

See Also:
Program.getErrors()
Thread safety
Thread-safe. However remember that this is a live collection; the collection may be changing as you iterate over it.

Method Summary
 void clear()
          Clears all error messages stored in the program.
 Error get(int i)
          Gets an Error object that stores details of an error.
 int getCount()
          Gets the number of errors currently stored in the program.
 java.util.Iterator<Error> 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

clear

public void clear()
Clears all error messages stored in the program.


get

public Error get(int i)
Gets an Error object that stores details of an error. The error is identified by its zero-based index in the collection.

Parameters:
i - The zero-based index of the error to be returned.
Returns:
A new error object containing the details of this error. The error object returned is a freshly allocated object containing the error details at this point in time. Accessing this object significantly later will still give the details of an old error. It will not give the details of the i'th error at that time.

getCount

public int getCount()
Gets the number of errors currently stored in the program. You may want to consider iterating over the collection rather than using this method.

Returns:
The count
See Also:
get(int)

iterator

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

Specified by:
iterator in interface java.lang.Iterable<Error>


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