jeudi 17 mars 2016

Is it possible to load some class fields and methods after checking some condition in Java

If I have a java class with some fields and methods and if I want to use certain fields and methods if only some condition is true ,how can I do it in java ? is it possible with java reflexion or statically somehow ? In details I can explain it as follows, suppose I have a java class

Public Class Myclass{
public int Version;
private long Field01;
private long Field02;
private void Method01();
private void Method02();
//some other methods ..
} 

now I want the field "Field01" and method "Method01()" only be loaded if the filed "Version" is equal int value of 4 ( it can be any int number as I wish). Is there any way to do that in Java ? may be statically ?





Aucun commentaire:

Enregistrer un commentaire