Package org.apache.etch.bindings.java.msg

Examples of org.apache.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

    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

  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

    TagElement te = new XmlParser().parseOne( rdr, null, MESSAGE_TAG );
    stack.push( te );
    elementList.push( te.getChildren() );
   
    Integer id = te.getIntAttr( null, STRUCT_TYPE_ATTR );
    Type type = vf.getType( id );
    return new Message( type, vf );
  }
View Full Code Here

  {
    TagElement te = stack.peek();
    elementList.push( te.getChildren() );
   
    Integer id = te.getIntAttr( null, STRUCT_TYPE_ATTR );
    Type type = vf.getType( id );
    return new StructValue( type, vf );
  }
View Full Code Here

  {
    TagElement te = readNextTagElement();
    if (te == null)
      return false;
   
    Type t = null; // TODO this needs to come from somewhere.
    Integer id = te.getIntAttr( null, KEY_ATTR );
    se.key = t.getField( id );
   
    stack.push( te );
    se.value = intReadValue();
    stack.pop();
   
View Full Code Here

    // now we want the type code for c, and if the type code is custom,
    // we'll also want the struct type code.
   
    byte typeCode = getNativeTypeCode( c );
   
    Type customStructType;
    if (typeCode == TypeCode.CUSTOM || typeCode == TypeCode.STRUCT)
    {
      customStructType = getCustomStructType( c );
     
      if (customStructType == null && c == StructValue.class)
View Full Code Here

 
  /** @throws Exception */
  @Test
  public void inReplyTo() throws Exception
  {
    Type mt_foo = new Type( "foo" );
    mt_foo.putValidator( DefaultValueFactory._mf__inReplyTo, Validator_long.get( 0 ) );
   
    Message msg = new Message( mt_foo, vf );
   
    assertNull( vf.getInReplyTo( msg ) );
   
View Full Code Here

TOP

Related Classes of org.apache.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.