mirror of
https://github.com/revanced/smali.git
synced 2025-06-13 04:27:38 +02:00
Add static utility methods to StringIdItem and TypeIdItem for getting their string representations
This commit is contained in:
@ -32,6 +32,8 @@ import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
import org.jf.dexlib.Util.Input;
|
||||
import org.jf.dexlib.Util.Utf8Utils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class StringIdItem extends Item<StringIdItem> {
|
||||
private StringDataItem stringDataItem;
|
||||
|
||||
@ -133,6 +135,16 @@ public class StringIdItem extends Item<StringIdItem> {
|
||||
return stringDataItem.getStringValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>String</code> value that the given <code>StringIdItem</code> represents
|
||||
* @param stringIdItem The <code>StringIdItem</code> to get the string value of
|
||||
* @return the <code>String</code> value that the given <code>StringIdItem</code> represents
|
||||
*/
|
||||
@Nullable
|
||||
public static String getStringValue(@Nullable StringIdItem stringIdItem) {
|
||||
return stringIdItem==null?null:stringIdItem.getStringValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>StringDataItem</code> that this <code>StringIdItem</code> references
|
||||
* @return the <code>StringDataItem</code> that this <code>StringIdItem</code> references
|
||||
|
@ -31,6 +31,8 @@ package org.jf.dexlib;
|
||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
import org.jf.dexlib.Util.Input;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TypeIdItem extends Item<TypeIdItem> {
|
||||
private StringIdItem typeDescriptor;
|
||||
|
||||
@ -146,6 +148,16 @@ public class TypeIdItem extends Item<TypeIdItem> {
|
||||
return typeDescriptor.getStringValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type descriptor as a <code>String</code> for the given type
|
||||
* @param typeIdItem The <code>TypeIdItem</code> to get the type descriptor of
|
||||
* @return the type descriptor as a <code>String</code> for the gvien type
|
||||
*/
|
||||
@Nullable
|
||||
public static String getTypeDescriptor(@Nullable TypeIdItem typeIdItem) {
|
||||
return typeIdItem==null?null:typeIdItem.getTypeDescriptor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the "shorty" representation of this type, used to create the shorty prototype string for a method
|
||||
* @return the "shorty" representation of this type, used to create the shorty prototype string for a method
|
||||
|
Reference in New Issue
Block a user