本文整理匯總了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;
}
示例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(".", "/");
}
示例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));
}
示例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();
}
示例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;
}