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.meta.prop;
18  
19  
20  /***
21   * Some utility methods for classname conversion.
22   */
23  final class NameHelper
24  {
25      /***
26       *  Converts a classname given in a given VM-similar notation(with slashes)
27       *  into a canonical notation (with dots).
28       *
29       *  @param  classname The VM-similar notation of the classname.
30       *  @return  The canonical classname.
31       *  @see  #fromCanonicalClassName
32       */
33      static String toCanonicalClassName(String classname)
34      {
35          return classname.replace('/', '.');
36      }
37  
38      /***
39       *  Converts a classname given in a canonical form(with dots) into
40       *  a VM-similar notation (with slashes)
41       *
42       *  @param  classname  The canonical classname.
43       *  @return  The VM-similar classname notation.
44       *  @see  #toCanonicalClassName
45       */
46      static String fromCanonicalClassName(String classname)
47      {
48          return classname.replace('.', '/');
49      }
50  }