Read optimization of beetl 2 method

original
2013/11/04 10:52
Reading 273
 import com.beetl.performance.lab.User;  public class UserAsmAccessor implements Access {  public Object get(Object o,int index) throws ASMCastException{  User user = null;  try{  user = (User)o;  }catch(Exception ex){  throw new ASMCastException();  }  switch(index){  case 1:return user.getName();  case 2:return user.getId();  }  throw new RuntimeException();  }  }


In the template ${user. name}, map the user to UserAsmAccessor  , name corresponds to index=1, so that the object properties can be obtained and the maximum performance can be reached



Expand to read the full text
Loading
Click to join the discussion 🔥 (1) Post and join the discussion 🔥
Reward
one comment
zero Collection
zero fabulous
 Back to top
Top