Blog: 2010 June

Interceptors with PHP

June 23, 2010, (updated on September 6, 2014), 2 comments, Software Development

Interceptors are used for aspect oriented programming (AOP). With the given interceptor, method calls can be extended or suppressed. PHP interceptors are implemented using the _call magic method. Problems A big problem implementing interceptors in PHP is the fact that method calls of the same class will not be intercepted. To solve the problem, simply call a method with $this->intercepted->myMethod() instead of $this->myMethod(). Methods which are called on intercepted will be intercepted. Another problem is that the AbstractInterceptor‘s methods (e.g. callMethod()) must not be called on the intercepted object from outside. Implementation Important: Within the interceptor methods, all calls on […] Read more...

Tags: ,

Event-based XML parsing in Java

June 22, 2010, (updated on September 6, 2014), Software Development

Introduction On some inefficient devices or some programming languages there are only event-based XML parsers available. In this article I will show how to use such a parser in an easy way and how to read hierarchical XML structures. To use the described method the following artifacts are needed: A method for finding a start tag, with the name of the tag as a parameter A method for finding an end tag, with two parameters: One is the name and one is the value of the tag A stack for the created objects Implementation In the start method, the program […] Read more...

Tags: ,


  Page 1 of 1