1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.beanutils.bugs.other;
18  
19  import org.apache.commons.beanutils.bugs.Jira273TestCase;
20  
21  /***
22   * Factory which creates beans for {@link Jira273TestCase}.
23   *
24   * @version $Revision: 555172 $ $Date: 2007-07-11 06:18:17 +0100 (Wed, 11 Jul 2007) $
25   */
26  public class Jira273BeanFactory {
27  
28      /***
29       * Factory method which creates annonymous
30       * {@link PublicBeanWithMethod} with method NOT overriden.
31       *
32       * @return a new annonymous {@link PublicBeanWithMethod}.
33       */
34      public static Object createAnnonymousOverriden() {
35          return new PublicBeanWithMethod() {
36              public String getBeanValue() {
37                  return "AnnonymousOverriden";
38              }
39          };
40      }
41  
42      /***
43       * Factory method which creates annonymous
44       * {@link PublicBeanWithMethod} with method overriden.
45       *
46       * @return a new annonymous {@link PublicBeanWithMethod}.
47       */
48      public static Object createAnnonymousNotOverriden() {
49          return new PublicBeanWithMethod() {
50          };
51      }
52  
53      /***
54       * Factory method which creates {@link PrivatePublicOverriden}.
55       *
56       * @return a new {@link PrivatePublicOverriden}.
57       */
58      public static Object createPrivatePublicOverriden() {
59          return new PrivatePublicOverriden();
60      }
61  
62      /***
63       * Factory method which creates {@link PrivatePrivatePublicOverriden}.
64       *
65       * @return a new {@link PrivatePrivatePublicOverriden}.
66       */
67      public static Object createPrivatePrivatePublicOverriden() {
68          return new PrivatePrivatePublicOverriden();
69      }
70  
71      /***
72       * Factory method which creates {@link PrivatePrivatePublicNotOverriden}.
73       *
74       * @return a new {@link PrivatePrivatePublicNotOverriden}.
75       */
76      public static Object createPrivatePrivatePublicNotOverriden() {
77          return new PrivatePrivatePublicNotOverriden();
78      }
79  
80      /***
81       * Factory method which creates {@link PrivatePublicNotOverriden}.
82       *
83       * @return a new {@link PrivatePublicNotOverriden}.
84       */
85      public static Object createPrivatePublicNotOverriden() {
86          return new PrivatePublicNotOverriden();
87      }
88  
89      private static class PrivateBeanWithMethod {
90          public String getBeanValue() {
91              return "PrivateBeanWithMethod";
92          }
93      }
94  
95      public static class PublicBeanWithMethod {
96          public String getBeanValue() {
97              return "PublicBeanWithMethod";
98          }
99      }
100     private static class PrivatePublicOverriden extends PublicBeanWithMethod {
101         public String getBeanValue() {
102             return "PrivatePublicOverriden";
103         }
104     }
105     private static class PrivatePublicNotOverriden extends PublicBeanWithMethod {
106     }
107     private static class PrivatePrivatePublicOverriden extends PrivatePublicNotOverriden {
108         public String getBeanValue() {
109             return "PrivatePrivatePublicOverriden";
110         }
111     }
112     private static class PrivatePrivatePublicNotOverriden extends PrivatePublicNotOverriden {
113     }
114 }