View Javadoc
1   package org.apache.maven.shared.utils.reflection;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *  http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  /**
22   *
23   * @author stephenc
24   */
25  class ReflectorTestHelper
26  {
27      static String PACKAGE_STATIC_STRING = "package static string";
28      protected static String PROTECTED_STATIC_STRING = "protected static string";
29      public static String PUBLIC_STATIC_STRING = "public static string";
30  
31      private ReflectorTestHelper()
32      {
33      }
34  
35      ReflectorTestHelper( Boolean throwSomething )
36      {
37          if ( Boolean.TRUE.equals( throwSomething ) )
38          {
39              throw new HelperException( "Something" );
40          }
41      }
42  
43      protected ReflectorTestHelper( Integer throwCount )
44      {
45          if ( throwCount != null && throwCount > 0 )
46          {
47              throw new HelperException( "Something" );
48          }
49      }
50  
51      public ReflectorTestHelper( String throwMessage )
52      {
53          if ( throwMessage != null && throwMessage.length() > 0  )
54          {
55              throw new HelperException( throwMessage );
56          }
57      }
58  
59      static ReflectorTestHelper getInstance( Boolean throwSomething )
60      {
61          if ( Boolean.TRUE.equals( throwSomething ) )
62          {
63              throw new HelperException( "Something" );
64          }
65          return new ReflectorTestHelper();
66      }
67  
68      protected static ReflectorTestHelper getInstance( Integer throwCount )
69      {
70          if ( throwCount != null && throwCount > 0 )
71          {
72              throw new HelperException( "Something" );
73          }
74          return new ReflectorTestHelper();
75      }
76  
77      public static ReflectorTestHelper getInstance( String throwMessage )
78      {
79          if ( throwMessage != null && throwMessage.length() > 0 )
80          {
81              throw new HelperException( throwMessage );
82          }
83          return new ReflectorTestHelper();
84      }
85  
86      public ReflectorTestHelper getInstance( String aString, Boolean aBoolean )
87      {
88          return new ReflectorTestHelper();
89      }
90  
91      public static class HelperException
92          extends RuntimeException
93      {
94          /**
95           * 
96           */
97          private static final long serialVersionUID = -3395757415194358525L;
98  
99          public HelperException()
100         {
101             super();    //To change body of overridden methods use File | Settings | File Templates.
102         }
103 
104         public HelperException( String message )
105         {
106             super( message );    //To change body of overridden methods use File | Settings | File Templates.
107         }
108 
109         public HelperException( String message, Throwable cause )
110         {
111             super( message, cause );    //To change body of overridden methods use File | Settings | File Templates.
112         }
113 
114         public HelperException( Throwable cause )
115         {
116             super( cause );    //To change body of overridden methods use File | Settings | File Templates.
117         }
118     }
119 }