Package org.rococoa.cocoa.foundation

Examples of org.rococoa.cocoa.foundation.NSError$_Class


    @Test public void testError() {
        File file = new File("NOSUCH");
        ObjCObjectByReference errorReference = new ObjCObjectByReference();
    QTMovie movie = QTMovie.movieWithFile_error(file, errorReference);
        assertNull(movie);
        NSError error = errorReference.getValueAs(NSError.class);
    assertEquals(-2000, error.code().intValue());
    }
View Full Code Here


     @throws IllegalArgumentException if an error occurs while reading the property
     */
    public NSObject getProperty(SpeechProperty property) throws IllegalArgumentException {
         ObjCObjectByReference errorPtr = new ObjCObjectByReference();
         NSObject result = objectForProperty_error(property.getNativeValue(), errorPtr);
         NSError error = errorPtr.getValueAs(NSError.class);
         //objectForProperty:error isn't well documented, so be very conservative
         if ( result != null && !result.id().isNull() && (error == null || error.id().isNull() || error.code().intValue() == 0) ) {
             return result;
         } else {
             throw new IllegalArgumentException("Could not get property: " + property + ", error: " + error.localizedDescription());
         }
    }
View Full Code Here

     @throws IllegalArgumentException if an error occurs while setting the property
     */
    public void setProperty(SpeechProperty property, NSObject value) throws IllegalArgumentException {
        ObjCObjectByReference errorPtr = new ObjCObjectByReference();
        if ( !setObject_forProperty_error(value, property.getNativeValue(), errorPtr) ) {
            NSError error = errorPtr.getValueAs(NSError.class);
            throw new IllegalArgumentException("Could not set property: " + property + " to value " + value + ", error: " + error.localizedDescription());
        }
    }
View Full Code Here

TOP

Related Classes of org.rococoa.cocoa.foundation.NSError$_Class

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.