Throws

The Throws aspect is used to add a Throws Definition for Java platform methods. Its behavior matches the notify modifier for Oxygene methods.

While the Elements compiler does not currently enforce or use throws definitions on Java, they can be used to let the Oracle Java compiler know what exceptions this method can raise/throw, for example when using an Elements-built class library from a Java application. The aspect takes one parameter, which is the typeOf() of the exception that the method throws. The aspect can be applied multiple times, if the method throws more than one exception.

type
  MyProperties = public class 
  public
    [Throws(typeOf(CustomException))] 
    method MyMethod;
    method MyMethod2; raises CustomException;
  end;
public class MyClass
{
    [Throws(typeof(CustomException))]
    public void MyMethod() 
    {
        ...
    }
}
public class MyClass {

    @Throws(dynamicType(Exception))
    public func MyMethod() {
        ...
    }
}
public class MyClass {

    @Throws(typeOf(CustomException))]
    public void MyMethod() {
        ...
    }

    public void MyMethod2() throws CustomException {
        ...
    }
}

Defined in RemObjects.Elements.Cirrus.dll

See Also