View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at 
7    * 
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software 
11   * distributed under the License is distributed on an "AS IS" BASIS, 
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License.
15   */
16  
17  package org.apache.jdo.impl.enhancer.util;
18  
19  import java.io.PrintWriter;
20  
21  
22  
23  /***
24   * Base class for resource locators.
25   */
26  abstract class ResourceLocatorBase
27      extends Support
28      implements ResourceLocator
29  {
30      // misc
31      protected final PrintWriter out;
32      protected final boolean verbose;
33  
34      /***
35       * Creates an instance.
36       */
37      public ResourceLocatorBase(PrintWriter out,
38                                 boolean verbose)
39      {
40          affirm(out != null);
41          this.out = out;
42          this.verbose = verbose;
43      }
44  
45      /***
46       *  Prints out a verbose message.
47       *
48       *  @param msg the message
49       */
50      public void printMessage(String msg)
51      {
52          if (verbose) {
53              out.println(getI18N("enhancer.message", msg));
54          }
55      }
56  }