Package etch.bindings.java.msg

Examples of etch.bindings.java.msg.Type


  @SuppressWarnings("deprecation")
  private ArrayValue startArray() throws IOException
  {
    byte type = buf.getByte();
   
    Type customStructType;
    if (type == TypeCode.CUSTOM || type == TypeCode.STRUCT)
      customStructType = readType();
    else
      customStructType = null;
   
View Full Code Here


    Object obj = readValue( intOrStrValidator, false );
   
    if (obj instanceof Integer)
    {
      Integer id = (Integer) obj;
      Type type = vf.getType( id );
     
      if (type == null)
        type = new Type( id, id.toString() );
     
      return type;
    }
   
    Assertion.check( obj instanceof String, "obj instanceof String" );
    String name = (String) obj;
    Type type = vf.getType( name );
   
    if (type == null)
      type = new Type( name );
   
    return type;
  }
View Full Code Here

  public void put( Class<?> c, Type t )
  {
    if (locked)
      throw new IllegalStateException( "locked" );
   
    Type x = c2t.get( c );
    if (x != null)
    {
      if (!x.equals( t ))
        throw new IllegalArgumentException( String.format(
          "type %s: class %s is already mapped to type %s",
          t, c, x ) );
     
      // x.equals( t ) therefore our work is finished.
View Full Code Here

  protected final Pool _free;

  @SuppressWarnings("unchecked")
  public final boolean sessionMessage( Who sender, Message msg ) throws Exception
  {
    Type type = msg.type();
   
    StubHelper<T> helper = (StubHelper<T>) type.getStubHelper();
    if (helper == null)
      return false;
   
    switch (type.getAsyncMode())
    {
      case QUEUED:
        try
        {
          _queued.run( new StubPoolRunnable( sender, msg, helper ) );
        }
        catch ( Exception e )
        {
          sessionNotify( _obj, e );
        }
        break;
      case FREE:
        try
        {
          _free.run( new StubPoolRunnable( sender, msg, helper ) );
        }
        catch ( Exception e )
        {
          sessionNotify( _obj, e );
        }
        break;
      case NONE:
        try
        {
          helper.run( _svc, _obj, sender, msg );
        }
        catch ( Exception e )
        {
          sessionNotify( _obj, e );
        }
        break;
            default:
                throw new IllegalArgumentException("unknown async mode "+type.getAsyncMode());
    }
   
    return true;
  }
View Full Code Here

    endArray( av );
  }

  private void writeKeysAndValues( StructValue sv ) throws IOException
  {
    Type t = sv.type();
    for (Map.Entry<Field, Object> me: sv)
    {
      Field f = me.getKey();
      writeField( f );
      writeValue( t.getValidator( f ), me.getValue() );
    }
  }
View Full Code Here

 
  private ValueFactory[] mixins = {};
 
  public final Type getType( Integer id )
  {
    Type type = types.get( id );
    if (type != null)
      return type;
   
    for (ValueFactory vf: mixins)
      if ((type = vf.getType( id )) != null)
View Full Code Here

    }
  }

  public final Type getType( String name )
  {
    Type type = types.get( name );
    if (type != null)
      return type;
   
    for (ValueFactory vf: mixins)
      if ((type = vf.getType( name )) != null)
View Full Code Here

  public final StructValue exportCustomValue( Object value )
  {
    Class<?> clss = value.getClass();
   
    Type type = getCustomStructType( clss );
   
    if (type == null && clss == StructValue.class)
    {
      StructValue struct = (StructValue) value;
      type = struct.type();
    }
   
    if (type == null)
    {
      if (Throwable.class.isAssignableFrom( clss ))
        type = _mt__Etch_RuntimeException;
      else if (List.class.isAssignableFrom( clss ))
        type = _mt__Etch_List;
      else if (Map.class.isAssignableFrom( clss ))
        type = _mt__Etch_Map;
      else if (Set.class.isAssignableFrom( clss ))
        type = _mt__Etch_Set;
      else
        return null;
    }
   
    ImportExportHelper helper = type.getImportExportHelper();
   
    if (helper == null)
      return null;
   
    return helper.exportValue( this, value );
View Full Code Here

    return helper.importValue( struct );
  }

  public final Type getCustomStructType( Class<?> c )
  {
    Type type = class2type.get( c );
    if (type != null)
      return type;
   
    for (ValueFactory vf: mixins)
      if ((type = vf.getCustomStructType( c )) != null)
View Full Code Here

      types.get( ETCH_AUTH_EXCEPTION_TYPE_NAME ), class2type );

    // ------------------ _mt__Etch_AuthException ------------------
   
    {
      final Type t = types.get( ETCH_EXCEPTION_MESSAGE_NAME );
      t.putValidator( _mf_result, Validator_RuntimeException.get() );
      t.putValidator( _mf__messageId, Validator_long.get( 0 ) );
      t.putValidator( _mf__inReplyTo, Validator_long.get( 0 ) );
    }
  }
View Full Code Here

TOP

Related Classes of etch.bindings.java.msg.Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.