Procházet zdrojové kódy

add functions for getting the parameter names of method

tags/rel_3_28_0_ga
eshizhan před 3 roky
rodič
revize
084c8e89b5

+ 16
- 0
src/main/javassist/bytecode/LocalVariableAttribute.java Zobrazit soubor

return getConstPool().getUtf8Info(nameIndex(i)); return getConstPool().getUtf8Info(nameIndex(i));
} }


/**
* Returns the name of the local variable with given index.
* If you want get the parameter name of method with correct order,
* should using this method.
*
* @param index the index of the local variable.
*/
public String variableNameByIndex(int index) {
for (int i = 0; i < tableLength(); i++) {
if (index(i) == index) {
return getConstPool().getUtf8Info(nameIndex(i));
}
}
throw new ArrayIndexOutOfBoundsException();
}

/** /**
* Returns the value of * Returns the value of
* <code>local_variable_table[i].descriptor_index</code>. * <code>local_variable_table[i].descriptor_index</code>.

+ 8
- 0
src/main/javassist/bytecode/MethodParametersAttribute.java Zobrazit soubor

return ByteArray.readU16bit(info, i * 4 + 1); return ByteArray.readU16bit(info, i * 4 + 1);
} }


/**
* Returns the name of the i-th element of <code>parameters</code>.
* @param i the position of the parameter.
*/
public String parameterName(int i) {
return getConstPool().getUtf8Info(name(i));
}

/** /**
* Returns the value of <code>access_flags</code> of the i-th element of <code>parameters</code>. * Returns the value of <code>access_flags</code> of the i-th element of <code>parameters</code>.
* *

Načítá se…
Zrušit
Uložit