public class GroupDef extends Annotated
{
  public NsName getName () { return m_Name; }
  public void setName (NsName v) { m_Name = v; }
  public long getId () { return m_Id; }
  public boolean hasId () { return has_Id; }
  public void clearId () { has_Id = false; }
  public void setId (long v) { m_Id = v; has_Id = true; }
  public FieldDef [] getFields () { return m_Fields; }
  public void setFields (FieldDef [] v) { m_Fields = v; }
  public NsName getSuper () { return m_Super; }
  public boolean hasSuper () { return m_Super != null; }
  public void clearSuper () { m_Super = null; }
  public void setSuper (NsName v) { m_Super = v; }
  
  private boolean has_Id;
  
  private NsName m_Name;
  private long m_Id;
  private FieldDef [] m_Fields;
  private NsName m_Super;
} public class Define extends Annotated
{
  public NsName getName () { return m_Name; }
  public void setName (NsName v) { m_Name = v; }
  public int getId () { return m_Id; }
  public boolean hasId () { return has_Id; }
  public void clearId () { has_Id = false; }
  public void setId (int v) { m_Id = v; has_Id = true; }
  public TypeDef getType () { return m_Type; }
  public void setType (TypeDef v) { m_Type = v; }
  
  private boolean has_Id;
  
  private NsName m_Name;
  private int m_Id;
  private TypeDef m_Type;
} public class FieldDef extends Annotated
{
  public java.lang.String getName () { return m_Name; }
  public void setName (java.lang.String v) { m_Name = v; }
  public int getId () { return m_Id; }
  public boolean hasId () { return has_Id; }
  public void clearId () { has_Id = false; }
  public void setId (int v) { m_Id = v; has_Id = true; }
  public TypeDef getType () { return m_Type; }
  public void setType (TypeDef v) { m_Type = v; }
  public boolean getOptional () { return m_Optional; }
  public void setOptional (boolean v) { m_Optional = v; }
  
  private boolean has_Id;
  
  private java.lang.String m_Name;
  private int m_Id;
  private TypeDef m_Type;
  private boolean m_Optional;
} public class TypeDef extends Annotated
{
  
} public class Sequence extends TypeDef
{
  public TypeDef getType () { return m_Type; }
  public void setType (TypeDef v) { m_Type = v; }
  
  private TypeDef m_Type;
} public class Ref extends TypeDef
{
  public NsName getType () { return m_Type; }
  public void setType (NsName v) { m_Type = v; }
  
  private NsName m_Type;
} public class DynRef extends TypeDef
{
  public NsName getType () { return m_Type; }
  public void setType (NsName v) { m_Type = v; }
  
  private NsName m_Type;
} public class Bool extends TypeDef
{
  
} public class I8 extends TypeDef
{
  
} public class U8 extends TypeDef
{
  
} public class I16 extends TypeDef
{
  
} public class U16 extends TypeDef
{
  
} public class I32 extends TypeDef
{
  
} public class U32 extends TypeDef
{
  
} public class I64 extends TypeDef
{
  
} public class U64 extends TypeDef
{
  
} public class F64 extends TypeDef
{
  
} public class Decimal extends TypeDef
{
  
} public class FixedDec extends TypeDef
{
  public byte getScale () { return m_Scale; }
  public void setScale (byte v) { m_Scale = v; }
  
  private byte m_Scale;
} public class Binary extends TypeDef
{
  public byte getMaxSize () { return m_MaxSize; }
  public boolean hasMaxSize () { return has_MaxSize; }
  public void clearMaxSize () { has_MaxSize = false; }
  public void setMaxSize (byte v) { m_MaxSize = v; has_MaxSize = true; }
  
  private boolean has_MaxSize;
  
  private byte m_MaxSize;
} public class Fixed extends TypeDef
{
  public int getSize () { return m_Size; }
  public void setSize (int v) { m_Size = v; }
  
  private int m_Size;
} public class Symbol extends Annotated
{
  public java.lang.String getName () { return m_Name; }
  public void setName (java.lang.String v) { m_Name = v; }
  public int getValue () { return m_Value; }
  public void setValue (int v) { m_Value = v; }
  
  private java.lang.String m_Name;
  private int m_Value;
} public class NanoTime extends TypeDef
{
  
} public class MilliTime extends TypeDef
{
  
} public class TimeOfDayMilli extends TypeDef
{
  
} public class TimeOfDayNano extends TypeDef
{
  
} public class SchemaAnnotation
{
  public Annotation [] getAnnotations () { return m_Annotations; }
  public void setAnnotations (Annotation [] v) { m_Annotations = v; }
  public java.lang.String getNs () { return m_Ns; }
  public boolean hasNs () { return m_Ns != null; }
  public void clearNs () { m_Ns = null; }
  public void setNs (java.lang.String v) { m_Ns = v; }
  
  private Annotation [] m_Annotations;
  private java.lang.String m_Ns;
} public class Enum extends TypeDef
{
  public Symbol [] getSymbols () { return m_Symbols; }
  public void setSymbols (Symbol [] v) { m_Symbols = v; }
  
  private Symbol [] m_Symbols;
}
import com.pantor.blink.msg.blink.GroupDef;
import com.pantor.blink.msg.blink.Define;
import com.pantor.blink.msg.blink.FieldDef;
import com.pantor.blink.msg.blink.TypeDef;
import com.pantor.blink.msg.blink.Sequence;
import com.pantor.blink.msg.blink.Ref;
import com.pantor.blink.msg.blink.DynRef;
import com.pantor.blink.msg.blink.Bool;
import com.pantor.blink.msg.blink.I8;
import com.pantor.blink.msg.blink.U8;
import com.pantor.blink.msg.blink.I16;
import com.pantor.blink.msg.blink.U16;
import com.pantor.blink.msg.blink.I32;
import com.pantor.blink.msg.blink.U32;
import com.pantor.blink.msg.blink.I64;
import com.pantor.blink.msg.blink.U64;
import com.pantor.blink.msg.blink.F64;
import com.pantor.blink.msg.blink.Decimal;
import com.pantor.blink.msg.blink.FixedDec;
import com.pantor.blink.msg.blink.Binary;
import com.pantor.blink.msg.blink.Fixed;
import com.pantor.blink.msg.blink.Symbol;
import com.pantor.blink.msg.blink.NanoTime;
import com.pantor.blink.msg.blink.MilliTime;
import com.pantor.blink.msg.blink.TimeOfDayMilli;
import com.pantor.blink.msg.blink.TimeOfDayNano;
import com.pantor.blink.msg.blink.SchemaAnnotation;
import com.pantor.blink.msg.blink.Enum;
import java.io.IOException;
         setAnnotations (def, d);
         if (def.hasId ())
            d.setId (String.valueOf (def.getId ()));
      }
      catch (BlinkException e)
      {
         throw new RuntimeException (e);
      }
   }

   public void onSchemaAnnotation (SchemaAnnotation sa)
   {
      AnnotSet annots = new AnnotSet ();
      for (com.pantor.blink.msg.blink.Annotation a : sa.getAnnotations ())
         annots.set (makeName (a.getName ()), a.getValue ());
      String ns = sa.getNs ();
      if (ns != null)
         schema.addAnnotations (annots, ns);
      else
         schema.addAnnotations (annots);
   }
   
   private Schema.Type makeType (TypeDef t)
      throws BlinkException
   {
      if (t instanceof Sequence)
      {
         disp.dispatch (((Sequence)t).getType ());
         assert curType != null;
         curType.setRank (Schema.Rank.Sequence);
      }
      else
         disp.dispatch (t);

      assert curType != null;
      
      setAnnotations (t, curType);
      return curType;
   }
   
   public void onRef (Ref ref)
   {
      curType = new Schema.Ref (makeName (ref.getType ()), Schema.Layout.Static);
   }

   public void onDynRef (DynRef ref)
   {
      curType =
         new Schema.Ref (makeName (ref.getType ()), Schema.Layout.Dynamic);
   }

   public void onString (com.pantor.blink.msg.blink.String str)
   {
      Schema.StrType s = new Schema.StrType ();
      curType = s;
      if (str.hasMaxSize ())
         s.setMaxSize (str.getMaxSize ());
   }

   public void onBinary (Binary str)
   {
      Schema.StrType s = new Schema.StrType (Schema.TypeCode.Binary);
      curType = s;
      if (str.hasMaxSize ())
         s.setMaxSize (str.getMaxSize ());
   }

   public void onFixed (Fixed f)
   {
      curType = new Schema.FixedType (f.getSize ());
   }

   public void onFixedDec (FixedDec fd)
   {
      curType = new Schema.FixedDecType (fd.getScale ());
   }

   public void onEnum (Enum from)
   {
      try
      {
         Schema.Enum to = new Schema.Enum ();
         curType = to;
         for (Symbol sym : from.getSymbols ())
         {
            Schema.Symbol s = to.addSymbol (sym.getName (), sym.getValue ());
            setAnnotations (sym, s);
         }
      }
      catch (BlinkException e)
      {
         throw new RuntimeException (e);
      }
   }

   public void onU8 (U8 t) { curType = new Schema.Type (Schema.TypeCode.U8); }
   public void onI8 (I8 t) { curType = new Schema.Type (Schema.TypeCode.I8); }
   public void onU16 (U16 t) { curType = new Schema.Type (Schema.TypeCode.U16); }
   public void onI16 (I16 t) { curType = new Schema.Type (Schema.TypeCode.I16); }
   public void onU32 (U32 t) { curType = new Schema.Type (Schema.TypeCode.U32); }
   public void onI32 (I32 t) { curType = new Schema.Type (Schema.TypeCode.I32); }
   public void onU64 (U64 t) { curType = new Schema.Type (Schema.TypeCode.U64); }
   public void onI64 (I64 t) { curType = new Schema.Type (Schema.TypeCode.I64); }
   public void onF64 (I64 t) { curType = new Schema.Type (Schema.TypeCode.F64); }

   public void onBool (Bool t)
   {
      curType = new Schema.Type (Schema.TypeCode.Bool);
   }

   public void onDecimal (Decimal t)
   {
      curType = new Schema.Type (Schema.TypeCode.Decimal);
   }

   public void onNanoTime (NanoTime t)
   {
      curType = new Schema.Type (Schema.TypeCode.Nanotime);
   }

   public void onMilliTime (MilliTime t)