diff --git a/src/headfirst/designpatterns/proxy/javaproxy/MatchMakingTestDrive.java b/src/headfirst/designpatterns/proxy/javaproxy/MatchMakingTestDrive.java index 19d893eb..5e8f46de 100755 --- a/src/headfirst/designpatterns/proxy/javaproxy/MatchMakingTestDrive.java +++ b/src/headfirst/designpatterns/proxy/javaproxy/MatchMakingTestDrive.java @@ -4,7 +4,7 @@ import java.util.*; public class MatchMakingTestDrive { - HashMap datingDB = new HashMap(); + HashMap datingDB = new HashMap(); public static void main(String[] args) { MatchMakingTestDrive test = new MatchMakingTestDrive(); @@ -16,8 +16,8 @@ public MatchMakingTestDrive() { } public void drive() { - PersonBean joe = getPersonFromDatabase("Joe Javabean"); - PersonBean ownerProxy = getOwnerProxy(joe); + Person joe = getPersonFromDatabase("Joe Javabean"); + Person ownerProxy = getOwnerProxy(joe); System.out.println("Name is " + ownerProxy.getName()); ownerProxy.setInterests("bowling, Go"); System.out.println("Interests set from owner proxy"); @@ -28,7 +28,7 @@ public void drive() { } System.out.println("Rating is " + ownerProxy.getGeekRating()); - PersonBean nonOwnerProxy = getNonOwnerProxy(joe); + Person nonOwnerProxy = getNonOwnerProxy(joe); System.out.println("Name is " + nonOwnerProxy.getName()); try { nonOwnerProxy.setInterests("bowling, Go"); @@ -40,34 +40,34 @@ public void drive() { System.out.println("Rating is " + nonOwnerProxy.getGeekRating()); } - PersonBean getOwnerProxy(PersonBean person) { + Person getOwnerProxy(Person person) { - return (PersonBean) Proxy.newProxyInstance( + return (Person) Proxy.newProxyInstance( person.getClass().getClassLoader(), person.getClass().getInterfaces(), new OwnerInvocationHandler(person)); } - PersonBean getNonOwnerProxy(PersonBean person) { + Person getNonOwnerProxy(Person person) { - return (PersonBean) Proxy.newProxyInstance( + return (Person) Proxy.newProxyInstance( person.getClass().getClassLoader(), person.getClass().getInterfaces(), new NonOwnerInvocationHandler(person)); } - PersonBean getPersonFromDatabase(String name) { - return (PersonBean)datingDB.get(name); + Person getPersonFromDatabase(String name) { + return (Person)datingDB.get(name); } void initializeDatabase() { - PersonBean joe = new PersonBeanImpl(); + Person joe = new PersonImpl(); joe.setName("Joe Javabean"); joe.setInterests("cars, computers, music"); joe.setGeekRating(7); datingDB.put(joe.getName(), joe); - PersonBean kelly = new PersonBeanImpl(); + Person kelly = new PersonImpl(); kelly.setName("Kelly Klosure"); kelly.setInterests("ebay, movies, music"); kelly.setGeekRating(6); diff --git a/src/headfirst/designpatterns/proxy/javaproxy/NonOwnerInvocationHandler.java b/src/headfirst/designpatterns/proxy/javaproxy/NonOwnerInvocationHandler.java index 89be5d26..4b10150f 100755 --- a/src/headfirst/designpatterns/proxy/javaproxy/NonOwnerInvocationHandler.java +++ b/src/headfirst/designpatterns/proxy/javaproxy/NonOwnerInvocationHandler.java @@ -3,9 +3,9 @@ import java.lang.reflect.*; public class NonOwnerInvocationHandler implements InvocationHandler { - PersonBean person; + Person person; - public NonOwnerInvocationHandler(PersonBean person) { + public NonOwnerInvocationHandler(Person person) { this.person = person; } diff --git a/src/headfirst/designpatterns/proxy/javaproxy/OwnerInvocationHandler.java b/src/headfirst/designpatterns/proxy/javaproxy/OwnerInvocationHandler.java index 525a56d7..ced2307f 100755 --- a/src/headfirst/designpatterns/proxy/javaproxy/OwnerInvocationHandler.java +++ b/src/headfirst/designpatterns/proxy/javaproxy/OwnerInvocationHandler.java @@ -3,9 +3,9 @@ import java.lang.reflect.*; public class OwnerInvocationHandler implements InvocationHandler { - PersonBean person; + Person person; - public OwnerInvocationHandler(PersonBean person) { + public OwnerInvocationHandler(Person person) { this.person = person; } diff --git a/src/headfirst/designpatterns/proxy/javaproxy/PersonBean.java b/src/headfirst/designpatterns/proxy/javaproxy/Person.java similarity index 90% rename from src/headfirst/designpatterns/proxy/javaproxy/PersonBean.java rename to src/headfirst/designpatterns/proxy/javaproxy/Person.java index fab2bb98..7de0a073 100755 --- a/src/headfirst/designpatterns/proxy/javaproxy/PersonBean.java +++ b/src/headfirst/designpatterns/proxy/javaproxy/Person.java @@ -1,6 +1,6 @@ package headfirst.designpatterns.proxy.javaproxy; -public interface PersonBean { +public interface Person { String getName(); String getGender(); diff --git a/src/headfirst/designpatterns/proxy/javaproxy/PersonBeanImpl.java b/src/headfirst/designpatterns/proxy/javaproxy/PersonImpl.java similarity index 93% rename from src/headfirst/designpatterns/proxy/javaproxy/PersonBeanImpl.java rename to src/headfirst/designpatterns/proxy/javaproxy/PersonImpl.java index 76aafd84..e8a13ed4 100755 --- a/src/headfirst/designpatterns/proxy/javaproxy/PersonBeanImpl.java +++ b/src/headfirst/designpatterns/proxy/javaproxy/PersonImpl.java @@ -1,6 +1,6 @@ package headfirst.designpatterns.proxy.javaproxy; -public class PersonBeanImpl implements PersonBean { +public class PersonImpl implements Person { String name; String gender; String interests;