當前位置: 首頁>>代碼示例>>Java>>正文


Java Type.getClassName方法代碼示例

本文整理匯總了Java中org.objectweb.asm.Type.getClassName方法的典型用法代碼示例。如果您正苦於以下問題:Java Type.getClassName方法的具體用法?Java Type.getClassName怎麽用?Java Type.getClassName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.objectweb.asm.Type的用法示例。


在下文中一共展示了Type.getClassName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getClassDependencies

import org.objectweb.asm.Type; //導入方法依賴的package包/類
private Set<String> getClassDependencies(ClassRelevancyFilter filter, ClassReader reader) {
    Set<String> out = new HashSet<String>();
    char[] charBuffer = new char[reader.getMaxStringLength()];
    for (int i = 1; i < reader.getItemCount(); i++) {
        int itemOffset = reader.getItem(i);
        if (itemOffset > 0 && reader.readByte(itemOffset - 1) == 7) {
            // A CONSTANT_Class entry, read the class descriptor
            String classDescriptor = reader.readUTF8(itemOffset, charBuffer);
            Type type = Type.getObjectType(classDescriptor);
            while (type.getSort() == Type.ARRAY) {
                type = type.getElementType();
            }
            if (type.getSort() != Type.OBJECT) {
                // A primitive type
                continue;
            }
            String name = type.getClassName();
            if (filter.isRelevant(name)) {
                out.add(name);
            }
        }
    }
    return out;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:25,代碼來源:DefaultClassDependenciesAnalyzer.java

示例2: getTypeStr

import org.objectweb.asm.Type; //導入方法依賴的package包/類
/**
 * Converts a given type to a string. Output will be simplified if enabled
 * in passed options.
 * 
 * @param type
 *            The type object.
 * @param options
 *            Options object.
 * @return String representation of the type object.
 * @see me.coley.recaf.config.UiConfig
 */
default String getTypeStr(Type type, ConfUI options) {
	String s = type.getDescriptor();
	// Check if field type. If so, then format as class name.
	if (!s.contains("(") && (s.length() == 1 || s.startsWith("L") || s.startsWith("["))) {
		s = type.getClassName();
	}
	// If simplification is on, substring away package.
	if (options != null && options.opcodeSimplifyDescriptors && s.contains(".")) {
		s = s.substring(s.lastIndexOf(".") + 1);
	}
	// Return name in internal style
	return s.replace(".", "/");
}
 
開發者ID:Col-E,項目名稱:Recaf,代碼行數:25,代碼來源:RenderFormatter.java

示例3: forPrimitive

import org.objectweb.asm.Type; //導入方法依賴的package包/類
private static AccessInfo forPrimitive(String memberType, Type type) {
	String camelCaseClassName = WordUtils.capitalize(type.getClassName());
	String capitalizedMemberType = WordUtils.capitalize(memberType);
	
	return new AccessInfo(
			memberType,
			"get" + camelCaseClassName + capitalizedMemberType,
			"set" + camelCaseClassName + capitalizedMemberType,
			type.getClassName(),
			type.getDescriptor(),
			type.getOpcode(ILOAD),
			type.getOpcode(IRETURN));
}
 
開發者ID:Javalbert,項目名稱:faster-than-reflection,代碼行數:14,代碼來源:ClassAccessFactory.java

示例4: NameSpecification

import org.objectweb.asm.Type; //導入方法依賴的package包/類
public NameSpecification(Type type) {
    if (type == null || type.getClassName() == null)
        throw new RuntimeException("null");
    this.className = type.getClassName();
    transformPrimitives();
}
 
開發者ID:PizzaCrust,項目名稱:Passion,代碼行數:7,代碼來源:NameSpecification.java

示例5: fromTypes

import org.objectweb.asm.Type; //導入方法依賴的package包/類
private String[] fromTypes(Type[] types) throws ClassNotFoundException {
  if (types == null) throw new IllegalArgumentException("Types was null!");
  String[] clz = new String[types.length];
  for (int i = 0; i < clz.length; i++) {
    Type t = types[i];
    switch (t.getSort()) {
      case Type.OBJECT:
        clz[i] = t.getClassName();
        break;
      case Type.LONG:
        clz[i] = Long.TYPE.getName();
        break;
      case Type.FLOAT:
        clz[i] = Float.TYPE.getName();
        break;
      case Type.DOUBLE:
        clz[i] = Double.TYPE.getName();
        break;
      case Type.BYTE:
        clz[i] = Byte.TYPE.getName();
        break;
      case Type.INT:
        clz[i] = Integer.TYPE.getName();
        break;
      case Type.BOOLEAN:
        clz[i] = Boolean.TYPE.getName();
        break;
      case Type.SHORT:
        clz[i] = Short.TYPE.getName();
        break;
      case Type.CHAR:
        clz[i] = Character.TYPE.getName();
        break;
      case Type.ARRAY:
        clz[i] = t.getDescriptor().replace("/", ".");
        break;
      default:
        throw new IllegalArgumentException("Invalid argument type: " + t.getSort());
    }
  }
  return clz;
}
 
開發者ID:mnemonic-no,項目名稱:common-services,代碼行數:43,代碼來源:ServiceMessageClient.java


注:本文中的org.objectweb.asm.Type.getClassName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。