svnno****@sourc*****
svnno****@sourc*****
2009年 10月 8日 (木) 22:05:57 JST
Revision: 3735 http://sourceforge.jp/projects/jiemamy/svn/view?view=rev&revision=3735 Author: ashigeru Date: 2009-10-08 22:05:56 +0900 (Thu, 08 Oct 2009) Log Message: ----------- factory-enhancer-example 0.2.0 RC Modified Paths: -------------- leto/factory-enhancer-example/trunk/pom.xml Added Paths: ----------- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java leto/factory-enhancer-example/trunk/src/main/resources/org/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties Removed Paths: ------------- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties Property Changed: ---------------- leto/factory-enhancer-example/trunk/ Property changes on: leto/factory-enhancer-example/trunk ___________________________________________________________________ Added: svn:mergeinfo + /leto/factory-enhancer-example/branches/interface-enhancer:3703-3733 Modified: leto/factory-enhancer-example/trunk/pom.xml =================================================================== --- leto/factory-enhancer-example/trunk/pom.xml 2009-10-08 13:05:37 UTC (rev 3734) +++ leto/factory-enhancer-example/trunk/pom.xml 2009-10-08 13:05:56 UTC (rev 3735) @@ -65,5 +65,10 @@ <artifactId>factory-enhancer</artifactId> <version>0.2.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>aopalliance</groupId> + <artifactId>aopalliance</artifactId> + <version>1.0</version> + </dependency> </dependencies> </project> Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,29 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._06interface; - -/** - * {@link GreetingsInterface}オブジェクトのみを生成するファクトリのインターフェース。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface GreetingsFactory { - - /** - * @return greetings - */ - GreetingsInterface newGreetings(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._06interface; + +/** + * {@link GreetingsInterface}オブジェクトのみを生成するファクトリのインターフェース。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface GreetingsFactory { + + /** + * @return greetings + */ + GreetingsInterface newGreetings(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,29 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._06interface; - -/** - * 単純なオブジェクト。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface GreetingsInterface { - - /** - * say Hello - */ - void say(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/GreetingsInterface.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._06interface; + +/** + * 単純なオブジェクト。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface GreetingsInterface { + + /** + * say Hello + */ + void say(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,59 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._06interface; - -import java.util.Arrays; - -import org.jiemamy.utils.enhancer.Enhance; -import org.jiemamy.utils.enhancer.Enhancer; -import org.jiemamy.utils.enhancer.InterfaceEnhancer; - -/** - * このパッケージのプログラムエントリ。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class Main { - - /** - * プログラムエントリ。 - * @param args 無視される - * @throws Exception うまくいかない場合 - */ - public static void main(String...args) throws Exception { - Enhancer<GreetingsFactory> enhancer = new InterfaceEnhancer<GreetingsFactory>( - GreetingsFactory.class, - Object.class, - Arrays.<Enhance>asList(new Enhance[] { - // とりあえず何もしない - }) - ); - System.out.println("ファクトリを生成"); - GreetingsFactory factory = enhancer.getFactory().newInstance(); - - System.out.println("プロダクトを生成"); - GreetingsInterface greetings = factory.newGreetings(); - - System.out.println("greetings.say()の実行...だけど"); - try { - greetings.say(); - } - catch (AbstractMethodError e) { - System.out.println("そんなメソッドはだれも実装していない"); - e.printStackTrace(System.out); - } - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_06interface/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,59 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._06interface; + +import java.util.Arrays; + +import org.jiemamy.utils.enhancer.Enhance; +import org.jiemamy.utils.enhancer.Enhancer; +import org.jiemamy.utils.enhancer.InterfaceEnhancer; + +/** + * このパッケージのプログラムエントリ。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class Main { + + /** + * プログラムエントリ。 + * @param args 無視される + * @throws Exception うまくいかない場合 + */ + public static void main(String...args) throws Exception { + Enhancer<GreetingsFactory> enhancer = new InterfaceEnhancer<GreetingsFactory>( + GreetingsFactory.class, + Object.class, + Arrays.<Enhance>asList(new Enhance[] { + // とりあえず何もしない + }) + ); + System.out.println("ファクトリを生成"); + GreetingsFactory factory = enhancer.getFactory().newInstance(); + + System.out.println("プロダクトを生成"); + GreetingsInterface greetings = factory.newGreetings(); + + System.out.println("greetings.say()の実行...だけど"); + try { + greetings.say(); + } + catch (AbstractMethodError e) { + System.out.println("そんなメソッドはだれも実装していない"); + e.printStackTrace(System.out); + } + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,29 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._07hookmethod; - -/** - * {@link GreetingsInterface}オブジェクトのみを生成するファクトリのインターフェース。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface GreetingsFactory { - - /** - * @return greetings - */ - GreetingsInterface newGreetings(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._07hookmethod; + +/** + * {@link GreetingsInterface}オブジェクトのみを生成するファクトリのインターフェース。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface GreetingsFactory { + + /** + * @return greetings + */ + GreetingsInterface newGreetings(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,29 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._07hookmethod; - -/** - * 単純なオブジェクト。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface GreetingsInterface { - - /** - * say Hello - */ - void say(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/GreetingsInterface.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._07hookmethod; + +/** + * 単純なオブジェクト。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface GreetingsInterface { + + /** + * say Hello + */ + void say(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,56 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._07hookmethod; - -import java.util.Arrays; - -import org.jiemamy.utils.enhancer.Enhance; -import org.jiemamy.utils.enhancer.Enhancer; -import org.jiemamy.utils.enhancer.InterfaceEnhancer; - -/** - * このパッケージのプログラムエントリ。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class Main { - - /** - * プログラムエントリ。 - * @param args 無視される - * @throws Exception うまくいかない場合 - */ - public static void main(String...args) throws Exception { - Enhancer<GreetingsFactory> enhancer = new InterfaceEnhancer<GreetingsFactory>( - GreetingsFactory.class, - Object.class, - Arrays.<Enhance>asList(new Enhance[] { - // Greetings.say()をフックして、実際に呼び出さないようにする - new Enhance(new SayPointcut(), new SuppressHandle()) - }) - ); - System.out.println("ファクトリを生成"); - GreetingsFactory factory = enhancer.getFactory().newInstance(); - - System.out.println("プロダクトを生成"); - GreetingsInterface greetings = factory.newGreetings(); - - System.out.println("greetings.say()の実行"); - greetings.say(); - - System.out.println("ハンドルしたので正常終了"); - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,56 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._07hookmethod; + +import java.util.Arrays; + +import org.jiemamy.utils.enhancer.Enhance; +import org.jiemamy.utils.enhancer.Enhancer; +import org.jiemamy.utils.enhancer.InterfaceEnhancer; + +/** + * このパッケージのプログラムエントリ。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class Main { + + /** + * プログラムエントリ。 + * @param args 無視される + * @throws Exception うまくいかない場合 + */ + public static void main(String...args) throws Exception { + Enhancer<GreetingsFactory> enhancer = new InterfaceEnhancer<GreetingsFactory>( + GreetingsFactory.class, + Object.class, + Arrays.<Enhance>asList(new Enhance[] { + // Greetings.say()をフックして、実際に呼び出さないようにする + new Enhance(new SayPointcut(), new SuppressHandle()) + }) + ); + System.out.println("ファクトリを生成"); + GreetingsFactory factory = enhancer.getFactory().newInstance(); + + System.out.println("プロダクトを生成"); + GreetingsInterface greetings = factory.newGreetings(); + + System.out.println("greetings.say()の実行"); + greetings.say(); + + System.out.println("ハンドルしたので正常終了"); + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,40 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._07hookmethod; - -import javassist.CtBehavior; -import javassist.CtClass; - -import org.jiemamy.utils.enhancer.InvocationPointcut; - -/** - * {@link GreetingsInterface#say()}のみを対象とするポイントカット。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class SayPointcut implements InvocationPointcut { - - public boolean isTarget(CtClass self, CtBehavior behavior) { - - // GreetingInterfaceのみに制限 - if (self.getName().equals(GreetingsInterface.class.getName()) == false) { - return false; - } - - // sayという名前だけに制限 - return behavior.getName().equals("say"); - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SayPointcut.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,40 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._07hookmethod; + +import javassist.CtBehavior; +import javassist.CtClass; + +import org.jiemamy.utils.enhancer.InvocationPointcut; + +/** + * {@link GreetingsInterface#say()}のみを対象とするポイントカット。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class SayPointcut implements InvocationPointcut { + + public boolean isTarget(CtClass self, CtBehavior behavior) { + + // GreetingInterfaceのみに制限 + if (self.getName().equals(GreetingsInterface.class.getName()) == false) { + return false; + } + + // sayという名前だけに制限 + return behavior.getName().equals("say"); + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,33 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._07hookmethod; - -import org.jiemamy.utils.enhancer.Invocation; -import org.jiemamy.utils.enhancer.InvocationHandler; - -/** - * {@link AbstractMethodError}を抑制する。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class SuppressHandle implements InvocationHandler { - - public Object handle(Invocation invocation) throws Throwable { - System.out.printf("%s の呼び出しをフック%n", invocation.getTarget()); - System.out.println("invocation.proceed()するとAbstractMethodErrorがスローされるからやめとく"); - return null; - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_07hookmethod/SuppressHandle.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,33 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._07hookmethod; + +import org.jiemamy.utils.enhancer.Invocation; +import org.jiemamy.utils.enhancer.InvocationHandler; + +/** + * {@link AbstractMethodError}を抑制する。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class SuppressHandle implements InvocationHandler { + + public Object handle(Invocation invocation) throws Throwable { + System.out.printf("%s の呼び出しをフック%n", invocation.getTarget()); + System.out.println("invocation.proceed()するとAbstractMethodErrorがスローされるからやめとく"); + return null; + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,29 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._08extends; - -/** - * {@link GreetingsInterface}オブジェクトのみを生成するファクトリのインターフェース。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface GreetingsFactory { - - /** - * @return greetings - */ - GreetingsInterface newGreetings(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._08extends; + +/** + * {@link GreetingsInterface}オブジェクトのみを生成するファクトリのインターフェース。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface GreetingsFactory { + + /** + * @return greetings + */ + GreetingsInterface newGreetings(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,29 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._08extends; - -/** - * 単純なオブジェクト。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface GreetingsInterface { - - /** - * say Hello - */ - void say(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/GreetingsInterface.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._08extends; + +/** + * 単純なオブジェクト。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface GreetingsInterface { + + /** + * say Hello + */ + void say(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,57 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._08extends; - -import java.util.Arrays; -import java.util.Date; - -import org.jiemamy.utils.enhancer.Enhance; -import org.jiemamy.utils.enhancer.Enhancer; -import org.jiemamy.utils.enhancer.InterfaceEnhancer; - -/** - * このパッケージのプログラムエントリ。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class Main { - - /** - * プログラムエントリ。 - * @param args 無視される - * @throws Exception うまくいかない場合 - */ - public static void main(String...args) throws Exception { - Enhancer<GreetingsFactory> enhancer = new InterfaceEnhancer<GreetingsFactory>( - GreetingsFactory.class, - Date.class, // Dateを実装するようにする - Arrays.<Enhance>asList(new Enhance[] { - // メソッドなどはフックしない - }) - ); - System.out.println("ファクトリを生成"); - GreetingsFactory factory = enhancer.getFactory().newInstance(); - - System.out.println("プロダクトを生成"); - GreetingsInterface greetings = factory.newGreetings(); - - if (greetings instanceof Date) { - System.out.println("なぜかDateを実装しているので"); - System.out.println(greetings); - System.out.println("今の時刻が表示される"); - } - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_08extends/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,57 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._08extends; + +import java.util.Arrays; +import java.util.Date; + +import org.jiemamy.utils.enhancer.Enhance; +import org.jiemamy.utils.enhancer.Enhancer; +import org.jiemamy.utils.enhancer.InterfaceEnhancer; + +/** + * このパッケージのプログラムエントリ。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class Main { + + /** + * プログラムエントリ。 + * @param args 無視される + * @throws Exception うまくいかない場合 + */ + public static void main(String...args) throws Exception { + Enhancer<GreetingsFactory> enhancer = new InterfaceEnhancer<GreetingsFactory>( + GreetingsFactory.class, + Date.class, // Dateを実装するようにする + Arrays.<Enhance>asList(new Enhance[] { + // メソッドなどはフックしない + }) + ); + System.out.println("ファクトリを生成"); + GreetingsFactory factory = enhancer.getFactory().newInstance(); + + System.out.println("プロダクトを生成"); + GreetingsInterface greetings = factory.newGreetings(); + + if (greetings instanceof Date) { + System.out.println("なぜかDateを実装しているので"); + System.out.println(greetings); + System.out.println("今の時刻が表示される"); + } + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,31 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._09dao; - -/** - * 単純なオブジェクト。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface Dao { - - /** - * どこかで見たメソッド。 - * @param key キー名 - * @return なにか - */ - String getProperty(String key); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Dao.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,31 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._09dao; + +/** + * 単純なオブジェクト。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface Dao { + + /** + * どこかで見たメソッド。 + * @param key キー名 + * @return なにか + */ + String getProperty(String key); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,34 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._09dao; - -import java.io.IOException; -import java.net.URL; - -/** - * {@link Dao}オブジェクトのみを生成するファクトリのインターフェース。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface DaoFactory { - - /** - * @param url 設定情報? - * @return 生成したDao - * @throws IOException 初期化に失敗した場合 - */ - Dao newInstance(URL url) throws IOException; -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,34 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._09dao; + +import java.io.IOException; +import java.net.URL; + +/** + * {@link Dao}オブジェクトのみを生成するファクトリのインターフェース。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface DaoFactory { + + /** + * @param url 設定情報? + * @return 生成したDao + * @throws IOException 初期化に失敗した場合 + */ + Dao newInstance(URL url) throws IOException; +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,70 +0,0 @@ -/* - * Copyright 2009 the Seasar Foundation and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._09dao; - -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; -import java.net.URL; -import java.util.Arrays; -import java.util.Properties; - -import org.jiemamy.utils.enhancer.Invocation; -import org.jiemamy.utils.enhancer.InvocationHandler; - -/** - * {@link DaoFactory#newInstance(URL)}のあたりをフックする。 - * @version $Date$ - * @author Suguru ARAKAWA - */ -public class DaoInitializer implements InvocationHandler { - - public Object handle(Invocation invocation) throws Throwable { - System.out.printf("%s の呼び出しをフック%n", invocation); - - System.out.println("とりあえずインスタンスを生成"); - Object result; - try { - result = invocation.proceed(); - } - catch (InvocationTargetException e) { - throw e.getCause(); - } - - // なぜかインスタンスがProperties - System.out.printf("%sの親クラスは%s%n", - result.getClass().getName(), - result.getClass().getSuperclass().getName()); - - // そして引数にはURLが来てる - System.out.printf("そして引数には%sが来る%n", Arrays.toString(invocation.getArguments())); - URL url = (URL) invocation.getArguments()[0]; - - // ロードしておく - System.out.printf("プロパティを%sの内容で初期化%n", url); - InputStream in = url.openStream(); - try { - ((Properties) result).load(in); - } - finally { - in.close(); - } - - System.out.printf("初期化が終わったインスタンスの内容は%s%n", result.toString()); - - // 最後にnewした結果として返す - return result; - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/DaoInitializer.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,70 @@ +/* + * Copyright 2009 the Seasar Foundation and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._09dao; + +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.net.URL; +import java.util.Arrays; +import java.util.Properties; + +import org.jiemamy.utils.enhancer.Invocation; +import org.jiemamy.utils.enhancer.InvocationHandler; + +/** + * {@link DaoFactory#newInstance(URL)}のあたりをフックする。 + * @version $Date$ + * @author Suguru ARAKAWA + */ +public class DaoInitializer implements InvocationHandler { + + public Object handle(Invocation invocation) throws Throwable { + System.out.printf("%s の呼び出しをフック%n", invocation); + + System.out.println("とりあえずインスタンスを生成"); + Object result; + try { + result = invocation.proceed(); + } + catch (InvocationTargetException e) { + throw e.getCause(); + } + + // なぜかインスタンスがProperties + System.out.printf("%sの親クラスは%s%n", + result.getClass().getName(), + result.getClass().getSuperclass().getName()); + + // そして引数にはURLが来てる + System.out.printf("そして引数には%sが来る%n", Arrays.toString(invocation.getArguments())); + URL url = (URL) invocation.getArguments()[0]; + + // ロードしておく + System.out.printf("プロパティを%sの内容で初期化%n", url); + InputStream in = url.openStream(); + try { + ((Properties) result).load(in); + } + finally { + in.close(); + } + + System.out.printf("初期化が終わったインスタンスの内容は%s%n", result.toString()); + + // 最後にnewした結果として返す + return result; + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,56 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._09dao; - -import java.util.Arrays; -import java.util.Properties; - -import org.jiemamy.utils.enhancer.Enhance; -import org.jiemamy.utils.enhancer.Enhancer; -import org.jiemamy.utils.enhancer.InterfaceEnhancer; - -/** - * このパッケージのプログラムエントリ。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class Main { - - /** - * プログラムエントリ。 - * @param args 無視される - * @throws Exception うまくいかない場合 - */ - public static void main(String...args) throws Exception { - Enhancer<DaoFactory> enhancer = new InterfaceEnhancer<DaoFactory>( - DaoFactory.class, - Properties.class, // Propertiesを実装するようにする - Arrays.<Enhance>asList( - // Daoの実装を生成する際に、 DaoFactory.newInstanceの引数でうまい具合に初期化 - new Enhance(new NewPointcut(), new DaoInitializer()) - ) - ); - System.out.println("ファクトリを生成"); - DaoFactory factory = enhancer.getFactory().newInstance(); - - System.out.println("プロダクトを生成"); - Dao dao = factory.newInstance(Main.class.getResource("example.properties")); - - System.out.println("helloプロパティの表示"); - String hello = dao.getProperty("hello"); - System.out.printf("dao.getProperty(\"hello\") = %s%n", hello); - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,56 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._09dao; + +import java.util.Arrays; +import java.util.Properties; + +import org.jiemamy.utils.enhancer.Enhance; +import org.jiemamy.utils.enhancer.Enhancer; +import org.jiemamy.utils.enhancer.InterfaceEnhancer; + +/** + * このパッケージのプログラムエントリ。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class Main { + + /** + * プログラムエントリ。 + * @param args 無視される + * @throws Exception うまくいかない場合 + */ + public static void main(String...args) throws Exception { + Enhancer<DaoFactory> enhancer = new InterfaceEnhancer<DaoFactory>( + DaoFactory.class, + Properties.class, // Propertiesを実装するようにする + Arrays.<Enhance>asList( + // Daoの実装を生成する際に、 DaoFactory.newInstanceの引数でうまい具合に初期化 + new Enhance(new NewPointcut(), new DaoInitializer()) + ) + ); + System.out.println("ファクトリを生成"); + DaoFactory factory = enhancer.getFactory().newInstance(); + + System.out.println("プロダクトを生成"); + Dao dao = factory.newInstance(Main.class.getResource("example.properties")); + + System.out.println("helloプロパティの表示"); + String hello = dao.getProperty("hello"); + System.out.printf("dao.getProperty(\"hello\") = %s%n", hello); + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,58 +0,0 @@ -/* - * Copyright 2009 the Seasar Foundation and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._09dao; - -import java.net.URL; - -import javassist.CtBehavior; -import javassist.CtClass; -import javassist.CtConstructor; -import javassist.NotFoundException; - -import org.jiemamy.utils.enhancer.InvocationPointcut; - -/** - * {@link Dao}をnewする(実際にはその実装)個所をフック。 - * @version $Date$ - * @author Suguru ARAKAWA - */ -public class NewPointcut implements InvocationPointcut { - - public boolean isTarget(CtClass self, CtBehavior behavior) { - try { - // Daoのみ - if (self.getName().equals(Dao.class.getName()) == false) { - return false; - } - - // newのみ - if ((behavior instanceof CtConstructor) == false) { - return false; - } - - // 引数は(URL)のみ - CtClass[] params = behavior.getParameterTypes(); - if (params.length != 1 || params[0].getName().equals(URL.class.getName()) == false) { - return false; - } - - return true; - } - catch (NotFoundException e) { - return false; - } - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_09dao/NewPointcut.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,58 @@ +/* + * Copyright 2009 the Seasar Foundation and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._09dao; + +import java.net.URL; + +import javassist.CtBehavior; +import javassist.CtClass; +import javassist.CtConstructor; +import javassist.NotFoundException; + +import org.jiemamy.utils.enhancer.InvocationPointcut; + +/** + * {@link Dao}をnewする(実際にはその実装)個所をフック。 + * @version $Date$ + * @author Suguru ARAKAWA + */ +public class NewPointcut implements InvocationPointcut { + + public boolean isTarget(CtClass self, CtBehavior behavior) { + try { + // Daoのみ + if (self.getName().equals(Dao.class.getName()) == false) { + return false; + } + + // newのみ + if ((behavior instanceof CtConstructor) == false) { + return false; + } + + // 引数は(URL)のみ + CtClass[] params = behavior.getParameterTypes(); + if (params.length != 1 || params[0].getName().equals(URL.class.getName()) == false) { + return false; + } + + return true; + } + catch (NotFoundException e) { + return false; + } + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,36 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._10proxy; - -import java.util.concurrent.Callable; - -/** - * {@link Runnable}と{@link Callable}を生成するファクトリ。 - * @version $Date: 2009-10-05 20:36:43 +0900 (月, 05 10 2009) $ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface ExecutableFactory { - - /** - * @return a runnable - */ - Runnable newRunnable(); - - /** - * @return a callable - */ - Callable<String> newCallable(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/ExecutableFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,36 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._10proxy; + +import java.util.concurrent.Callable; + +/** + * {@link Runnable}と{@link Callable}を生成するファクトリ。 + * @version $Date: 2009-10-05 20:36:43 +0900 (月, 05 10 2009) $ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface ExecutableFactory { + + /** + * @return a runnable + */ + Runnable newRunnable(); + + /** + * @return a callable + */ + Callable<String> newCallable(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,80 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._10proxy; - -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.concurrent.Callable; - -import org.jiemamy.utils.enhancer.Enhance; -import org.jiemamy.utils.enhancer.Enhancer; -import org.jiemamy.utils.enhancer.InterfaceEnhancer; -import org.jiemamy.utils.enhancer.driver.ProxyDriver; - -/** - * このパッケージのプログラムエントリ。 - * @version $Date: 2009-10-05 20:36:43 +0900 (月, 05 10 2009) $ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class Main { - - /** - * プログラムエントリ。 - * @param args 無視される - * @throws Exception うまくいかない場合 - */ - public static void main(String...args) throws Exception { - Enhancer<ExecutableFactory> enhancer = new InterfaceEnhancer<ExecutableFactory>( - ExecutableFactory.class, - Object.class, // 今回はnew時にproceed()を呼ばないので親クラスは関係ない - Arrays.asList(new Enhance[] { - // Runnableのインスタンス生成の代わりに、下記のハンドラが登録されたProxyを返す - ProxyDriver.newEnhance(Runnable.class, new java.lang.reflect.InvocationHandler() { - public Object invoke(Object proxy, Method method, Object[] a) { - System.out.printf("Runnableのメソッドが呼ばれた(%s)%n", method); - System.out.println("ここでは特に何もしない"); - return null; - } - }), - // Callableのインスタンス生成の代わりに、下記のハンドラが登録されたProxyを返す - ProxyDriver.newEnhance(Callable.class, new java.lang.reflect.InvocationHandler() { - public Object invoke(Object proxy, Method method, Object[] a) { - System.out.printf("Callableのメソッドが呼ばれた(%s)%n", method); - System.out.println("ので、\"Hello\"を返しておく"); - return "Hello"; - } - }), - }) - ); - System.out.println("ファクトリを生成"); - ExecutableFactory factory = enhancer.getFactory().newInstance(); - - System.out.println("プロダクトを生成"); - Runnable runnable = factory.newRunnable(); - Callable<String> callable = factory.newCallable(); - - System.out.println("プロダクトはいずれもProxyになってるはず"); - System.out.printf("runnable.getClass() is proxy = %s%n", Proxy.isProxyClass(runnable.getClass())); - System.out.printf("callable.getClass() is proxy = %s%n", Proxy.isProxyClass(callable.getClass())); - - System.out.println("run()メソッドの呼び出し"); - runnable.run(); - - System.out.println("call()メソッドの呼び出し"); - System.out.printf("callable.call() = \"%s\"%n", callable.call()); - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_10proxy/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,80 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._10proxy; + +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.concurrent.Callable; + +import org.jiemamy.utils.enhancer.Enhance; +import org.jiemamy.utils.enhancer.Enhancer; +import org.jiemamy.utils.enhancer.InterfaceEnhancer; +import org.jiemamy.utils.enhancer.driver.ProxyDriver; + +/** + * このパッケージのプログラムエントリ。 + * @version $Date: 2009-10-05 20:36:43 +0900 (月, 05 10 2009) $ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class Main { + + /** + * プログラムエントリ。 + * @param args 無視される + * @throws Exception うまくいかない場合 + */ + public static void main(String...args) throws Exception { + Enhancer<ExecutableFactory> enhancer = new InterfaceEnhancer<ExecutableFactory>( + ExecutableFactory.class, + Object.class, // 今回はnew時にproceed()を呼ばないので親クラスは関係ない + Arrays.asList(new Enhance[] { + // Runnableのインスタンス生成の代わりに、下記のハンドラが登録されたProxyを返す + ProxyDriver.newEnhance(Runnable.class, new java.lang.reflect.InvocationHandler() { + public Object invoke(Object proxy, Method method, Object[] a) { + System.out.printf("Runnableのメソッドが呼ばれた(%s)%n", method); + System.out.println("ここでは特に何もしない"); + return null; + } + }), + // Callableのインスタンス生成の代わりに、下記のハンドラが登録されたProxyを返す + ProxyDriver.newEnhance(Callable.class, new java.lang.reflect.InvocationHandler() { + public Object invoke(Object proxy, Method method, Object[] a) { + System.out.printf("Callableのメソッドが呼ばれた(%s)%n", method); + System.out.println("ので、\"Hello\"を返しておく"); + return "Hello"; + } + }), + }) + ); + System.out.println("ファクトリを生成"); + ExecutableFactory factory = enhancer.getFactory().newInstance(); + + System.out.println("プロダクトを生成"); + Runnable runnable = factory.newRunnable(); + Callable<String> callable = factory.newCallable(); + + System.out.println("プロダクトはいずれもProxyになってるはず"); + System.out.printf("runnable.getClass() is proxy = %s%n", Proxy.isProxyClass(runnable.getClass())); + System.out.printf("callable.getClass() is proxy = %s%n", Proxy.isProxyClass(callable.getClass())); + + System.out.println("run()メソッドの呼び出し"); + runnable.run(); + + System.out.println("call()メソッドの呼び出し"); + System.out.printf("callable.call() = \"%s\"%n", callable.call()); + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,29 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._11aopalliance; - -/** - * {@link GreetingsInterface}オブジェクトのみを生成するファクトリのインターフェース。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface GreetingsFactory { - - /** - * @return greetings - */ - GreetingsInterface newGreetings(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsFactory.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._11aopalliance; + +/** + * {@link GreetingsInterface}オブジェクトのみを生成するファクトリのインターフェース。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface GreetingsFactory { + + /** + * @return greetings + */ + GreetingsInterface newGreetings(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,29 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._11aopalliance; - -/** - * 単純なオブジェクト。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public interface GreetingsInterface { - - /** - * say Hello - */ - void say(); -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/GreetingsInterface.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._11aopalliance; + +/** + * 単純なオブジェクト。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public interface GreetingsInterface { + + /** + * say Hello + */ + void say(); +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,59 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._11aopalliance; - -import java.util.Arrays; - -import org.jiemamy.utils.enhancer.Enhance; -import org.jiemamy.utils.enhancer.Enhancer; -import org.jiemamy.utils.enhancer.InterfaceEnhancer; -import org.jiemamy.utils.enhancer.driver.AopAllianceDriver; - -/** - * このパッケージのプログラムエントリ。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class Main { - - /** - * プログラムエントリ。 - * @param args 無視される - * @throws Exception うまくいかない場合 - */ - public static void main(String...args) throws Exception { - Enhancer<GreetingsFactory> enhancer = new InterfaceEnhancer<GreetingsFactory>( - GreetingsFactory.class, - Object.class, - Arrays.<Enhance>asList(new Enhance[] { - // 07と同じだが、AOP Allianceのインターフェースを利用しているのでドライバを使う - new Enhance( - new SayPointcut(), - AopAllianceDriver.toHandler(new SuppressInterceptor())) - }) - ); - System.out.println("ファクトリを生成"); - GreetingsFactory factory = enhancer.getFactory().newInstance(); - - System.out.println("プロダクトを生成"); - GreetingsInterface greetings = factory.newGreetings(); - - System.out.println("greetings.say()の実行"); - greetings.say(); - - System.out.println("ハンドルしたので正常終了"); - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/Main.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,59 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._11aopalliance; + +import java.util.Arrays; + +import org.jiemamy.utils.enhancer.Enhance; +import org.jiemamy.utils.enhancer.Enhancer; +import org.jiemamy.utils.enhancer.InterfaceEnhancer; +import org.jiemamy.utils.enhancer.driver.AopAllianceDriver; + +/** + * このパッケージのプログラムエントリ。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class Main { + + /** + * プログラムエントリ。 + * @param args 無視される + * @throws Exception うまくいかない場合 + */ + public static void main(String...args) throws Exception { + Enhancer<GreetingsFactory> enhancer = new InterfaceEnhancer<GreetingsFactory>( + GreetingsFactory.class, + Object.class, + Arrays.<Enhance>asList(new Enhance[] { + // 07と同じだが、AOP Allianceのインターフェースを利用しているのでドライバを使う + new Enhance( + new SayPointcut(), + AopAllianceDriver.toHandler(new SuppressInterceptor())) + }) + ); + System.out.println("ファクトリを生成"); + GreetingsFactory factory = enhancer.getFactory().newInstance(); + + System.out.println("プロダクトを生成"); + GreetingsInterface greetings = factory.newGreetings(); + + System.out.println("greetings.say()の実行"); + greetings.say(); + + System.out.println("ハンドルしたので正常終了"); + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,40 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._11aopalliance; - -import javassist.CtBehavior; -import javassist.CtClass; - -import org.jiemamy.utils.enhancer.InvocationPointcut; - -/** - * {@link GreetingsInterface#say()}のみを対象とするポイントカット。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class SayPointcut implements InvocationPointcut { - - public boolean isTarget(CtClass self, CtBehavior behavior) { - - // GreetingInterfaceのみに制限 - if (self.getName().equals(GreetingsInterface.class.getName()) == false) { - return false; - } - - // sayという名前だけに制限 - return behavior.getName().equals("say"); - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SayPointcut.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,40 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._11aopalliance; + +import javassist.CtBehavior; +import javassist.CtClass; + +import org.jiemamy.utils.enhancer.InvocationPointcut; + +/** + * {@link GreetingsInterface#say()}のみを対象とするポイントカット。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class SayPointcut implements InvocationPointcut { + + public boolean isTarget(CtClass self, CtBehavior behavior) { + + // GreetingInterfaceのみに制限 + if (self.getName().equals(GreetingsInterface.class.getName()) == false) { + return false; + } + + // sayという名前だけに制限 + return behavior.getName().equals("say"); + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -1,33 +0,0 @@ -/* - * Copyright 2009 Jiemamy Project and the Others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.util.enhancer.example._11aopalliance; - -import org.aopalliance.intercept.MethodInterceptor; -import org.aopalliance.intercept.MethodInvocation; - -/** - * {@link AbstractMethodError}を抑制するAOP Allianceのインターセプタ。 - * @version $Date$ - * @author Suguru ARAKAWA (Gluegent, Inc.) - */ -public class SuppressInterceptor implements MethodInterceptor { - - public Object invoke(MethodInvocation invocation) throws Throwable { - System.out.printf("%s の呼び出しをフック%n", invocation.getMethod()); - System.out.println("invocation.proceed()するとAbstractMethodErrorがスローされるからやめとく"); - return null; - } -} Copied: leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/java/org/jiemamy/util/enhancer/example/_11aopalliance/SuppressInterceptor.java 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1,33 @@ +/* + * Copyright 2009 Jiemamy Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.util.enhancer.example._11aopalliance; + +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; + +/** + * {@link AbstractMethodError}を抑制するAOP Allianceのインターセプタ。 + * @version $Date$ + * @author Suguru ARAKAWA (Gluegent, Inc.) + */ +public class SuppressInterceptor implements MethodInterceptor { + + public Object invoke(MethodInvocation invocation) throws Throwable { + System.out.printf("%s の呼び出しをフック%n", invocation.getMethod()); + System.out.println("invocation.proceed()するとAbstractMethodErrorがスローされるからやめとく"); + return null; + } +} Deleted: leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties =================================================================== --- leto/factory-enhancer-example/branches/interface-enhancer/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties 2009-10-08 12:45:24 UTC (rev 3733) +++ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties 2009-10-08 13:05:56 UTC (rev 3735) @@ -1 +0,0 @@ -hello=world Copied: leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties (from rev 3733, leto/factory-enhancer-example/branches/interface-enhancer/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties) =================================================================== --- leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties (rev 0) +++ leto/factory-enhancer-example/trunk/src/main/resources/org/jiemamy/util/enhancer/example/_09dao/example.properties 2009-10-08 13:05:56 UTC (rev 3735) @@ -0,0 +1 @@ +hello=world