View Javadoc

1   /*
2    * Copyright 2001-2004 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  package org.apache.geronimo.ews.jaxrpcmapping;
17  
18  /***
19   * @author Ias (iasandcb@tmax.co.kr)
20   */
21  public class J2eeUtils {
22      public static String jni2javaName(String returnType) {
23          if (returnType == null)
24              return null;
25          if (!returnType.startsWith("[")) {
26              return returnType;
27          } else {
28              returnType = returnType.substring(1);
29          }
30          String end = "[]";
31          while (returnType.startsWith("[")) {
32              end = end + "[]";
33              returnType = returnType.substring(1);
34          }
35          if (returnType.startsWith("B")) {
36              returnType = "byte";
37          } else if (returnType.startsWith("I")) {
38              returnType = "int";
39          } else if (returnType.startsWith("D")) {
40              returnType = "double";
41          } else if (returnType.startsWith("J")) {
42              returnType = "long";
43          } else if (returnType.startsWith("Z")) {
44              returnType = "boolean";
45          } else if (returnType.startsWith("F")) {
46              returnType = "float";
47          } else if (returnType.startsWith("S")) {
48              returnType = "short";
49          } else if (returnType.startsWith("L")) {
50              int index = returnType.indexOf(";@");
51              returnType.substring(1, index);
52          }
53          return returnType + end;
54      }
55  
56  }