private void generate(Class<? extends Message> cls) throws Exception {
  assert cls != null;
  if (cls.isInterface())   return;
  if (cls.isAnnotationPresent(IgniteCodeGeneratingFail.class))   throw new IllegalStateException("@IgniteCodeGeneratingFail is provided for class: " + cls.getName());
  write.clear();
  read.clear();
  fields=new ArrayList<>();
  Field[] declaredFields=cls.getDeclaredFields();
  for (  Field field : declaredFields) {
    int mod=field.getModifiers();
    if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class))     fields.add(field);
  }
  Collections.sort(fields,FIELD_CMP);
  int state=startState(cls);
  totalFieldCnt=state + fields.size();
  indent=2;
  boolean hasSuper=cls.getSuperclass() != Object.class;
  start(write,hasSuper ? "writeTo" : null,true);
  start(read,hasSuper ? "readFrom" : null,false);
  indent++;
  for (  Field field : fields)   processField(field,state++);
  indent--;
  finish(write,null);
  finish(read,cls.getSimpleName());
}

private void generate ( Class < ? extends Message > cls ) throws Exception { assert cls != null ; if ( cls . isInterface ( ) ) return ; if ( cls . isAnnotationPresent ( IgniteCodeGeneratingFail . class ) ) throw new IllegalStateException ( "@IgniteCodeGeneratingFail is provided for class: " + cls . getName ( ) ) ; write . clear ( ) ; read . clear ( ) ; fields = new ArrayList < > ( ) ; Field [ ] declaredFields = cls . getDeclaredFields ( ) ; for ( Field field : declaredFields ) { int mod = field . getModifiers ( ) ; if ( ! isStatic ( mod ) && ! isTransient ( mod ) && ! field . isAnnotationPresent ( GridDirectTransient . class ) ) fields . add ( field ) ; } Collections . sort ( fields , FIELD_CMP ) ; int state = startState ( cls ) ; totalFieldCnt = state + fields . size ( ) ; indent = 2 ; boolean hasSuper = cls . getSuperclass ( ) != Object . class ; start ( write , hasSuper ? "writeTo" : null , true ) ; start ( read , hasSuper ? "readFrom" : null , false ) ; indent ++ ; for ( Field field : fields ) processField ( field , state ++ ) ; indent -- ; finish ( write , null ) ; finish ( read , cls . getSimpleName ( ) ) ; }
generates code for provided class .
