Package org.fusesource.hawtbuf.proto

Examples of org.fusesource.hawtbuf.proto.PBMessage


    private void encodeProtobuf(Class<?> type, Object arg, DataByteArrayOutputStream target) throws IOException {
        if( !PBMessage.class.isAssignableFrom(type) ) {
            throw new IllegalArgumentException("Invalid "+name()+" serialization method: method argument not a "+PBMessage.class.getName());
        }
        PBMessage msg = (PBMessage) arg;
        if( msg==null ) {
            return;
        }
        msg.freeze().writeUnframed(target);
    }
View Full Code Here


            throw new IllegalArgumentException("Invalid "+name()+" serialization method: method argument not a "+PBMessage.class.getName());
        }

        // Get the factory instance...
        PBMessageFactory factory = (PBMessageFactory) type.getEnclosingClass().getField("FACTORY").get(null);
        PBMessage msg = factory.parseUnframed(source);
        String name = type.getName();
        Object rc;
        if( name.endsWith("$Getter") || name.endsWith("$Buffer") ) {
            // Interface is ok we us giving them a read only impl.
            rc = msg;
        } else {
            // They want a read/write impl.
            rc = msg.copy();
        }
        return rc;
    }
View Full Code Here

TOP

Related Classes of org.fusesource.hawtbuf.proto.PBMessage

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.