Java via Epsilon Tools [message #482096] |
Tue, 25 August 2009 11:23 |
Eclipse User |
|
|
|
Originally posted by: d.clowes.lboro.ac.uk
Hi All,
I'm trying to execute some regular expression searches in a
transformation. The Java I need to execute uses the
Java.utils.regex.Pattern and Java.utils.regex.Matcher. Dimtitris kindly
pointed me to the Epsilon Tools documentation and I can follow the JFrame
example. However from what I can tell there is no default constructor for
Pattern, which is what I believe to be causing me the problems.
Pattern is typically called in Java by:
Pattern p = Pattern.compile('regex Srring');
I have tried:
# var pattern : new Native('java.util.regex.Pattern') :=
pattern.compile('Section ((\\d)[(\\.\\d)]*)');
# var pattern : new Native('java.util.regex.Pattern') :=
Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
# var pattern : new Native('java.util.regex.Pattern') :=
java.util.regex.Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
# var pattern : new Native('java.util.regex.Pattern');
All of which result in an EXCEPTION: Internal error:
java.lang.InstantiationException: java.util.regex.Pattern
Has anyone any suggestions to try.
Many thanks,
Darren
|
|
|
|
Re: Java via Epsilon Tools [message #482114 is a reply to message #482108] |
Tue, 25 August 2009 12:22 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi Darren,
If you are using Epsilon from source, please update and then you can
simply write the following:
var pattern = Native('java.util.regex.Pattern').compile('\\d');
var matcher = pattern.matcher('Some text and 1 digit');
while (matcher.find()) {
matcher.start().println();
matcher.group().println();
matcher.end().println();
}
The change will appear in 0.8.7 - which should be released within the
next couple of days. I'll also update the EGL/Tomcat integration shortly.
Cheers,
Dimitris
Dimitris Kolovos wrote:
> Hi Darren,
>
> Since Pattern doesn't provide an accessible constructor - only the
> static "compile" method, you should create your own tool that wraps
> Pattern (using Java) and then call it from Epsilon.
>
> Having said this, calling static methods seems like a useful feature
> that should be supported natively by Epsilon. Would you mind opening an
> enhancement request in the bugzilla for this?
>
> Cheers,
> Dimitris
>
> Darren Clowes wrote:
>> Hi All,
>>
>> I'm trying to execute some regular expression searches in a
>> transformation. The Java I need to execute uses the
>> Java.utils.regex.Pattern and Java.utils.regex.Matcher. Dimtitris
>> kindly pointed me to the Epsilon Tools documentation and I can follow
>> the JFrame example. However from what I can tell there is no default
>> constructor for Pattern, which is what I believe to be causing me the
>> problems.
>>
>> Pattern is typically called in Java by:
>> Pattern p = Pattern.compile('regex Srring');
>>
>> I have tried:
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> java.util.regex.Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern');
>>
>> All of which result in an EXCEPTION: Internal error:
>> java.lang.InstantiationException: java.util.regex.Pattern
>>
>> Has anyone any suggestions to try.
>>
>> Many thanks,
>>
>> Darren
>>
|
|
|
|
|
|
Re: Java via Epsilon Tools [message #579520 is a reply to message #482108] |
Tue, 25 August 2009 12:22 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi Darren,
If you are using Epsilon from source, please update and then you can
simply write the following:
var pattern = Native('java.util.regex.Pattern').compile('\\d');
var matcher = pattern.matcher('Some text and 1 digit');
while (matcher.find()) {
matcher.start().println();
matcher.group().println();
matcher.end().println();
}
The change will appear in 0.8.7 - which should be released within the
next couple of days. I'll also update the EGL/Tomcat integration shortly.
Cheers,
Dimitris
Dimitris Kolovos wrote:
> Hi Darren,
>
> Since Pattern doesn't provide an accessible constructor - only the
> static "compile" method, you should create your own tool that wraps
> Pattern (using Java) and then call it from Epsilon.
>
> Having said this, calling static methods seems like a useful feature
> that should be supported natively by Epsilon. Would you mind opening an
> enhancement request in the bugzilla for this?
>
> Cheers,
> Dimitris
>
> Darren Clowes wrote:
>> Hi All,
>>
>> I'm trying to execute some regular expression searches in a
>> transformation. The Java I need to execute uses the
>> Java.utils.regex.Pattern and Java.utils.regex.Matcher. Dimtitris
>> kindly pointed me to the Epsilon Tools documentation and I can follow
>> the JFrame example. However from what I can tell there is no default
>> constructor for Pattern, which is what I believe to be causing me the
>> problems.
>>
>> Pattern is typically called in Java by:
>> Pattern p = Pattern.compile('regex Srring');
>>
>> I have tried:
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> java.util.regex.Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern');
>>
>> All of which result in an EXCEPTION: Internal error:
>> java.lang.InstantiationException: java.util.regex.Pattern
>>
>> Has anyone any suggestions to try.
>>
>> Many thanks,
>>
>> Darren
>>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03092 seconds