java - Javassist - get array length -


can please me in method finding array length in javassist? have class 1 static array inside:

public class someclass {     private static string arr[] = new string[]{"1", "2", "3"}; } 

now, in other class, i'm loading someclass , trying length of arr array.

classpool classpool = classpool.getdefault(); ctclass ctclass = classpool.get("someclass");  ctclass.getfield("arr") //<---------- how length here? 

thanks!

your code represents following class:

public class someclass {   private static string[] arr;    static {     arr = new string[] {"1", "2", "3"};   } } 

in order read array's length, need parse class initializer , interpret byte code. javassist has no built-in functionality extracting information.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -