Java Code Examples for com.apple.jobjc.foundation.NSStringClass#description()

The following examples show how to use com.apple.jobjc.foundation.NSStringClass#description() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 2
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 3
Source Project: jdk8u60   File: IntroTest.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 4
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 5
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 6
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 7
Source Project: hottub   File: IntroTest.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 8
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 9
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 10
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 11
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }
 
Example 12
public void testFrameworks(){
        // First, get an instance of JObjC:
        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();

        // It's your gateway to the frameworks.
        final FoundationFramework FND = JOBJC.Foundation();
        final AppKitFramework APP = JOBJC.AppKit();

        // From which you can then access...

        // enums, defines, constants
        int nsmye = FND.NSMaxYEdge();
        boolean debug = FND.NSDebugEnabled();

        // structs
        NSPoint p = FND.makeNSPoint();
        p.setX(3);
        assertEquals(3.0, p.x());

        // C functions
        NSPoint p2 = FND.NSMakePoint(12, 34);
        assertEquals(12.0, p2.x());

        // ... Let's create an AutoreleasePool before we go on
        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();

        // Objective-C classes
        NSStringClass nsc = FND.NSString();

        // class-methods
        NSString nsStringClassDescr = nsc.description();

        // instances
        NSString nsi = ((NSString) FND.NSString().alloc()).init();

        // instance methods
        NSString d = nsi.description();

        // The bridge marshals some types for you, but it doesn't
        // convert between NSString and Java String automatically.
        // For that we use Utils.get().strings().nsString(String)
        // and Utils.get().strings().javaString(NSString);

        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));

        NSString format = Utils.get().strings().nsString("Foo bar %d baz");

        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
        String jformatted = Utils.get().strings().javaString(formatted);

        assertEquals("Foo bar 34 baz", jformatted);

        // Reveal in Finder
//        NSString file = Utils.get().strings().nsString(
//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
//        APP.NSWorkspace().sharedWorkspace()
//           .selectFile_inFileViewerRootedAtPath(file, null);

        pool.drain();
    }