Here you can find the source of getClassDescriptor(Class> type)
Parameter | Description |
---|---|
type | Class to determine the corresponding JNI descriptor for. |
public static String getClassDescriptor(Class<?> type)
//package com.java2s; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.util.HashMap; public class Main { private static final HashMap<String, String> CLASS_DESCRIPTORS = new HashMap<String, String>(); /**//from w ww . ja v a 2s. c o m * Get the JNI class descriptor corresponding to the provided type parameter. * * @param type Class to determine the corresponding JNI descriptor for. * @return Class descripor as a String */ public static String getClassDescriptor(Class<?> type) { final String name = type.getName().replace('.', '/'); if (CLASS_DESCRIPTORS.containsKey(name)) { return CLASS_DESCRIPTORS.get(name); } if (type.isArray()) { // Array names are already in class descriptor form. return name; } return "L" + name + ';'; } }