Mar 13 2008

Spring AOP with aspectJ and JDK5 annotations

Published by Gilles at 4:01 pm under Spring

Simple Class to play with
Our simple class called "Person" will be used to explain the different kinds of code advices:
person.java

JAVA:
  1. package be.loadit.service;
  2. public interface Person {
  3.     String getName();
  4.     void setName(String name);
  5.     int getAge();
  6.     void setAge(int age);
  7. }

Implementation
personimpl.java

JAVA:
  1. package be.loadit.service.impl;
  2. import be.loadit.service.Person;
  3. public class PersonImpl implements Person {
  4. private int age= 0;
  5. private String name = null;
  6. public int getAge() {
  7. return age;
  8. }
  9. public String getName() {
  10. return name;
  11. }
  12. public void setAgeAndName(String name,int age){
  13. this.age = age;
  14. this.name = name;
  15. }
  16.  
  17. public void setAge(int age) {
  18. this.age = age;
  19. }
  20.  
  21. public void setName(String name) {
  22. this.name = name;
  23. }
  24. }

Pages: 1 2 3 4 5 6

Trackback URI | Comments RSS

Leave a Reply