JAVA functions in NetRexx

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JAVA functions in NetRexx

Robert L Hamilton
I finally found the example in TNRL where NetRexx meets Java. NetRexx can parse built in functions from Java, e.g. Date().

Is there a list of Java 'things' that can be used in NetRexx?

bobh

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JAVA functions in NetRexx

Patric Bechtel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Hamilton schrieb am 15.04.2010 12:09:
> I finally found the example in TNRL where NetRexx meets Java. NetRexx
> can parse built in functions from Java, e.g. Date().
>
> Is there a list of Java 'things' that can be used in NetRexx?

Short answer: all. There's almost nothing in Java which cannot be used
in NetRexx, just in a nicer, more concise syntax. The only things
missing is generics (though the classes can be used, just the type info
is gone, so you have to cast, though), annotations and anonymous inner
classes (who doesn't hate these, anyway?).

- --
Patric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: GnuPT 2.5.2

iEYEARECAAYFAkvG6BMACgkQfGgGu8y7ypBOFACfR7zlg2dxIsdVLOvff8q6M3DS
s2wAoJUqBQXY3R9cAMgYXPgR+83k4N6s
=H54Z
-----END PGP SIGNATURE-----
_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JAVA functions in NetRexx

David Requena
In reply to this post by Robert L Hamilton
Robert,

The answer would be: the full java library. Some syntax constructs are not available as Patrick pointed out though.

Mind there's an implied misconception in your question: Java (hence NetRexx) has no such concept as 'built-in functions', or any kind of functions for that matter...

Being a fully object oriented language you only get methods; be it instance methods or class methods (static methods in java parlance).
A special kind of method is one with the same name as a class. This is called a constructor and instantiates an object of that class.

So in your example Date() would just construct an object. This, not being assigned to anything, would just be eventually garbage collected.

A little working example could be:

dt1 = Date()
        -- a java.util.Date object with 'now' value is built and assigned to dt1
dt2 = Date()        -- same with a latter 'now'. Assigned to dt2
dt3 = java.text.DateFormat.getInstance().parse("07/10/96 4:5 PM, PDT") -- see note bellow

-- now you can call any of java.util.Date's intance methods on dt1, dt2 and dt3 as in:

say dt1.toString()  -- prints 'Thu Apr 15 13:03:06 CEST 2010'
say dt2.toString()  -- prints 'Thu Apr 15 13:03:17 CEST 2010'
say dt3.toString()  -- prints 'Mon Oct 07 04:05:00 CEST 1996'
say dt1.after(dt2)  -- prints '0' (false)
say dt2.after(dt1)  -- prints '1' (true)
say dt3.before(dt1) & dt3.before(dt2) -- prints '1'


note: most of Date's methods are deprecated since java 1.1. Java documentation states:

"As of JDK 1.1, the Calendar class should be used to convert between dates and time
fields and the DateFormat class should be used to format and parse date strings.
The corresponding methods in Date are deprecated."

That is why dt3 is instantiated like it is here. Admittedly it is a bit long winded but the fact is that date handling/manipulation is a complex domain in itself. There is just an awful lot of calendars, time zones, locale conventions, etc. in effect.
---
Saludos / Kind regards.
David Requena

El 15/04/2010 12:09, Robert Hamilton escribió:
I finally found the example in TNRL where NetRexx meets Java. NetRexx can parse built in functions from Java, e.g. Date().

Is there a list of Java 'things' that can be used in NetRexx?

bobh
_______________________________________________ Ibm-netrexx mailing list [hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JAVA functions in NetRexx

rkumar
In reply to this post by Robert L Hamilton
Java training by SevenMentor Institute in Pune stands out as a premier program for mastering Java programming. Renowned for its industry-focused curriculum, the institute provides in-depth training on core and advanced Java concepts, ensuring learners gain hands-on expertise in object-oriented programming, data structures, web development, and frameworks like Spring and Hibernate. The trainers are experienced professionals who bring real-world insights into the classroom, making the sessions engaging and practical.

SevenMentor emphasizes a project-based approach, enabling students to apply their knowledge to real-time scenarios, thereby building confidence and skills required by the industry. With state-of-the-art facilities and flexible training schedules, including online and classroom options, the institute caters to students and working professionals alike. Their excellent placement support, coupled with resume-building and interview preparation sessions, helps learners secure rewarding job opportunities. For anyone looking to excel in Java, SevenMentor in Pune offers a comprehensive and enriching learning experience.
Visit us:
Java training classes in Pune                               
Java training course in Pune                       
Java course in Pune