Java Java String Format toJavaImplSig(String jsig)

Here you can find the source of toJavaImplSig(String jsig)

Description

Given a Java type signature, return the implementation class signature for methods and fields: java/lang/Object => fan/sys/FanObj java/lang/Long => fan/sys/FanInt Anything returns itself.

License

Academic Free License

Declaration

public static String toJavaImplSig(String jsig) 

Method Source Code

//package com.java2s;
// Licensed under the Academic Free License version 3.0

public class Main {
    /**//w  w  w .j a  va  2s .  co  m
     * Given a Java type signature, return the implementation
     * class signature for methods and fields:
     *   java/lang/Object  =>  fan/sys/FanObj
     *   java/lang/Long    =>  fan/sys/FanInt
     * Anything returns itself.
     */
    public static String toJavaImplSig(String jsig) {
        if (jsig.length() == 1) {
            switch (jsig.charAt(0)) {
            case 'Z':
                return "fan/sys/FanBool";
            case 'J':
                return "fan/sys/FanInt";
            case 'D':
                return "fan/sys/FanFloat";
            default:
                throw new IllegalStateException(jsig);
            }
        }

        if (jsig.charAt(0) == 'j') {
            if (jsig.equals("java/lang/Object"))
                return "fan/sys/FanObj";
            if (jsig.equals("java/lang/Boolean"))
                return "fan/sys/FanBool";
            if (jsig.equals("java/lang/String"))
                return "fan/sys/FanStr";
            if (jsig.equals("java/lang/Long"))
                return "fan/sys/FanInt";
            if (jsig.equals("java/lang/Double"))
                return "fan/sys/FanFloat";
            if (jsig.equals("java/lang/Number"))
                return "fan/sys/FanNum";
            if (jsig.equals("java/math/BigDecimal"))
                return "fan/sys/FanDecimal";
        }
        return jsig;
    }
}

Related

  1. toJavaIdentifier(String str, String repl)
  2. toJavaIdentifier(String text, Boolean uppercaseFirst)
  3. toJavaIdentifierCamelCase(String tmp)
  4. toJavaIdentifierString(String className)
  5. toJavaImplClassName(String podName, String typeName)
  6. toJavaMethodName(String sqlNotation)
  7. toJavaMethodName(String... words)
  8. toJavaName(String name)
  9. toJavaName(String name)