| 
      
      
      From: <php...@li...> - 2009-07-02 10:51:34
       | 
| Hi everybody, first of all thanks for this great piece of software that makes it easy to use powerful Java libs in a PHP based application. That's really awesome. Currently I'm working on a PDF generation using iText and I'm surprised that it's quite easy to find my way around. But of course I wouldn't post this if there wasn't this one thing that is not working for me: writing a PHP class that derives from a Java class. Before you guys scream "RTFM!", I really tried to find this out myself but all I could find was the FAQ file in the documentation. This points to java_closure() and to an example in the file script_api.php in the tests folder. Reading the documentation of java_closure() and the example only the implementation of java interfaces in a PHP class is described (which will definitely be useful for me later - I'm sure). So my question: can someone please explain how a PHP class can extend a Java class? Any hint would be appreciated. Thank you very much. Regards, Alexander Thomas | 
| 
      
      
      From: <php...@li...> - 2009-07-02 13:22:30
       | 
| You could use the visitor- or the decorator design pattern to intercept the method calls from your Java class. It all depends on your requirements. If your java class is a data structure with a few methods, I would use a visitor. To override specific methods from the superclass I would use a decorator. Please see a standard text book or wikipedia.org for details. As far as the bridge is concerned, all you need is java_closure() to convert your PHP object into a Java object. After that you can apply whatever pattern you prefer to merge the two java instances. Regards, Jost Boekemeier 2. Jul 2009 12:52 nachm. schrieb am < php...@li...>: Hi everybody, first of all thanks for this great piece of software that makes it easy to use powerful Java libs in a PHP based application. That's really awesome. Currently I'm working on a PDF generation using iText and I'm surprised that it's quite easy to find my way around. But of course I wouldn't post this if there wasn't this one thing that is not working for me: writing a PHP class that derives from a Java class. Before you guys scream "RTFM!", I really tried to find this out myself but all I could find was the FAQ file in the documentation. This points to java_closure() and to an example in the file script_api.php in the tests folder. Reading the documentation of java_closure() and the example only the implementation of java interfaces in a PHP class is described (which will definitely be useful for me later - I'm sure). So my question: can someone please explain how a PHP class can extend a Java class? Any hint would be appreciated. Thank you very much. Regards, Alexander Thomas ------------------------------------------------------------------------------ _______________________________________________ php-java-bridge-users mailing list php...@li... https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users | 
| 
      
      
      From: <php...@li...> - 2009-07-03 08:45:09
       | 
| Thank you. Now I see how it has to be done. Although it's not as fluffy as I would have wished but I guess it will work. :-) Cheers, Alexander Thomas Am 02.07.2009 um 14:54 schrieb php...@li... : > You could use the visitor- or the decorator design pattern to > intercept the > method calls from your Java class. > > It all depends on your requirements. If your java class is a data > structure > with a few methods, I would use a visitor. To override specific > methods from > the superclass I would use a decorator. > > Please see a standard text book or wikipedia.org for details. > > As far as the bridge is concerned, all you need is java_closure() to > convert > your PHP object into a Java object. After that you can apply whatever > pattern you prefer to merge the two java instances. > > Regards, > Jost Boekemeier > > 2. Jul 2009 12:52 nachm. schrieb am < > php...@li...>: > > Hi everybody, > > first of all thanks for this great piece of software that makes it > easy to use powerful Java libs in a PHP based application. That's > really awesome. > > Currently I'm working on a PDF generation using iText and I'm > surprised that it's quite easy to find my way around. But of course I > wouldn't post this if there wasn't this one thing that is not working > for me: writing a PHP class that derives from a Java class. > > Before you guys scream "RTFM!", I really tried to find this out myself > but all I could find was the FAQ file in the documentation. This > points to java_closure() and to an example in the file script_api.php > in the tests folder. > > Reading the documentation of java_closure() and the example only the > implementation of java interfaces in a PHP class is described (which > will definitely be useful for me later - I'm sure). > > So my question: can someone please explain how a PHP class can extend > a Java class? > > Any hint would be appreciated. > > Thank you very much. > > Regards, > Alexander Thomas > > ------------------------------------------------------------------------------ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > ------------------------------------------------------------------------------ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users | 
| 
      
      
      From: <php...@li...> - 2009-07-03 10:46:09
       | 
| Well, if you use php 5.3 it is indeed easier. In PHP 5.3 you can autoload
Java libraries and import Java classes like ordinary PHP classes. The
following example extends java.lang.String:
<?php java_autoload();
use java\lang\String as JString;
class String extends JString {
  function toString(){
    return "I am " . parent::toString();
  }
  function __toString() {return this->toString();}
}
echo new String("foo");
?>
=> I am foo
Regards,
Jost Boekemeier
3. Jul 2009 10:46 vorm. schrieb am <
php...@li...>:
Thank you. Now I see how it has to be done.
Although it's not as fluffy as I would have wished but I guess it will
work. :-)
Cheers,
Alexander Thomas
Am 02.07.2009 um 14:54 schrieb php...@li...
:
> You could use the visitor- or the decorator design pattern to > intercept
the > method calls fr...
 | 
| 
      
      
      From: <php...@li...> - 2009-07-03 10:56:09
       | 
| Ok. Now I'm impressed.
Are there any security issues that might go with java_autoload()?
Alex
Am 03.07.2009 um 12:46 schrieb php...@li... 
:
> Well, if you use php 5.3 it is indeed easier. In PHP 5.3 you can  
> autoload
> Java libraries and import Java classes like ordinary PHP classes. The
> following example extends java.lang.String:
>
> <?php java_autoload();
>
> use java\lang\String as JString;
>
> class String extends JString {
>  function toString(){
>    return "I am " . parent::toString();
>  }
>  function __toString() {return this->toString();}
> }
>
> echo new String("foo");
> ?>
> => I am foo
>
> Regards,
> Jost Boekemeier
>
> 3. Jul 2009 10:46 vorm. schrieb am <
> php...@li...>:
>
> Thank you. Now I see how it has to be done.
>
> Although it's not as fluffy as I would have wished but I guess it will
> work. :-)
>
> Cheers,
> Alexander Thomas
>
> Am 02.07.2009 um 14:54 schrieb php...@li...
> :
>
>> You could use the visitor- or the decorator design pattern to >  
>> intercept
> the > method calls fr...
> ------------------------------------------------------------------------------
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
 | 
| 
      
      
      From: <php...@li...> - 2009-07-03 11:06:02
       | 
| No. Its only slightly more work for the syntax transformer, that's all.
If you load additional libraries like java_autoload("c:/lucene.jar") the
first request must also load and cache the additional libs.
Regards,
Jost Boekemeier
3. Jul 2009 12:58 nachm. schrieb am <
php...@li...>:
Ok. Now I'm impressed.
Are there any security issues that might go with java_autoload()?
Alex
Am 03.07.2009 um 12:46 schrieb php...@li...
:
> Well, if you use php 5.3 it is indeed easier. In PHP 5.3 you can >
autoload > Java libraries an...
>
------------------------------------------------------------------------------
> _________________...
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users-----------------------------...
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
 | 
| 
      
      
      From: <php...@li...> - 2009-07-03 11:10:52
       | 
| Thank you very much. That was indeed helpful.
Am 03.07.2009 um 13:06 schrieb php...@li... 
:
> No. Its only slightly more work for the syntax transformer, that's  
> all.
>
> If you load additional libraries like java_autoload("c:/lucene.jar")  
> the
> first request must also load and cache the additional libs.
>
> Regards,
> Jost Boekemeier
>
> 3. Jul 2009 12:58 nachm. schrieb am <
> php...@li...>:
>
> Ok. Now I'm impressed.
>
> Are there any security issues that might go with java_autoload()?
>
> Alex
>
> Am 03.07.2009 um 12:46 schrieb php...@li...
> :
>
>> Well, if you use php 5.3 it is indeed easier. In PHP 5.3 you can >
> autoload > Java libraries an...
>
>>
> ------------------------------------------------------------------------------
>> _________________...
>
>> php...@li...
>
>> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users----------------------------- 
>> ...
>
> php...@li...
>
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
> ------------------------------------------------------------------------------
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
 |