View Javadoc

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  
18  package org.apache.jdo.impl.enhancer.util;
19  
20  import java.io.PrintWriter;
21  
22  
23  
24  /***
25   * Base class for resource locators.
26   */
27  abstract class ResourceLocatorBase
28      extends Support
29      implements ResourceLocator
30  {
31      // misc
32      protected final PrintWriter out;
33      protected final boolean verbose;
34  
35      /***
36       * Creates an instance.
37       */
38      public ResourceLocatorBase(PrintWriter out,
39                                 boolean verbose)
40      {
41          affirm(out != null);
42          this.out = out;
43          this.verbose = verbose;
44      }
45  
46      /***
47       *  Prints out a verbose message.
48       *
49       *  @param msg the message
50       */
51      public void printMessage(String msg)
52      {
53          if (verbose) {
54              out.println(getI18N("enhancer.message", msg));
55          }
56      }
57  }