Package com.sun.star.lib.uno.typedesc

Examples of com.sun.star.lib.uno.typedesc.TypeDescription


        TypeClass typeClass = TypeClass.fromInt(b & 0x7F);
        if (TypeDescription.isTypeClassSimple(typeClass)) {
            return TypeDescription.getTypeDescription(typeClass);
        } else {
            int index = read16Bit();
            TypeDescription type = null;
            if ((b & 0x80) != 0) {
                try {
                    type = TypeDescription.getTypeDescription(
                        readStringValue());
                } catch (ClassNotFoundException e) {
View Full Code Here


    private Type readTypeValue() {
        return new Type(readType());
    }

    private Object readAnyValue() {
        TypeDescription type = readType();
        switch (type.getTypeClass().getValue()) {
        case TypeClass.VOID_value:
            return Any.VOID;

        case TypeClass.BOOLEAN_value:
            return readBooleanValue();

        case TypeClass.BYTE_value:
            return readByteValue();

        case TypeClass.SHORT_value:
            return readShortValue();

        case TypeClass.UNSIGNED_SHORT_value:
            return new Any(Type.UNSIGNED_SHORT, readShortValue());

        case TypeClass.LONG_value:
            return readLongValue();

        case TypeClass.UNSIGNED_LONG_value:
            return new Any(Type.UNSIGNED_LONG, readLongValue());

        case TypeClass.HYPER_value:
            return readHyperValue();

        case TypeClass.UNSIGNED_HYPER_value:
            return new Any(Type.UNSIGNED_HYPER, readHyperValue());

        case TypeClass.FLOAT_value:
            return readFloatValue();

        case TypeClass.DOUBLE_value:
            return readDoubleValue();

        case TypeClass.CHAR_value:
            return readCharValue();

        case TypeClass.STRING_value:
            return readStringValue();

        case TypeClass.TYPE_value:
            return readTypeValue();

        case TypeClass.SEQUENCE_value:
            {
                Object value = readSequenceValue(type);
                TypeDescription ctype = (TypeDescription)
                    type.getComponentType();
                while (ctype.getTypeClass() == TypeClass.SEQUENCE) {
                    ctype = (TypeDescription) ctype.getComponentType();
                }
                switch (ctype.getTypeClass().getValue()) {
                case TypeClass.UNSIGNED_SHORT_value:
                case TypeClass.UNSIGNED_LONG_value:
                case TypeClass.UNSIGNED_HYPER_value:
                    return new Any(new Type(type), value);

                case TypeClass.STRUCT_value:
                    if (ctype.hasTypeArguments()) {
                        return new Any(new Type(type), value);
                    }
                default:
                    return value;
                }
View Full Code Here

        }
    }

    private Object readSequenceValue(TypeDescription type) {
        int len = readCompressedNumber();
        TypeDescription ctype = (TypeDescription) type.getComponentType();
        if (ctype.getTypeClass() == TypeClass.BYTE) {
            byte[] data = new byte[len];
            readBytes(data);
            return data;
        } else {
            Object value = Array.newInstance(
                ctype.getTypeClass() == TypeClass.ANY
                ? Object.class : ctype.getZClass(), len);
            for (int i = 0; i < len; ++i) {
                Array.set(value, i, readValue(ctype));
            }
            return value;
        }
View Full Code Here

    {
        synchronized (output) {
            writeQueuedReleases();
            int header = HEADER_LONGHEADER;
            PendingRequests.Item pending = pendingIn.pop(tid);
            TypeDescription resultType;
            ITypeDescription[] argTypes;
            Object[] args;
            if (exception) {
                header |= HEADER_EXCEPTION;
                resultType = TypeDescription.getTypeDescription(TypeClass.ANY);
View Full Code Here

            testObject,
            testObject,
            new TestInterfaceStruct(testObject, null)
        };

        TypeDescription dataTypes[] = new TypeDescription[] {
            TypeDescription.getTypeDescription(com.sun.star.uno.RuntimeException.class),
            TypeDescription.getTypeDescription(com.sun.star.uno.Exception.class),
            TypeDescription.getTypeDescription(Boolean.class),
            TypeDescription.getTypeDescription(Byte.class),
            TypeDescription.getTypeDescription(Character.class),
View Full Code Here

        // read the bounds of an string
        write_long( 0 );
        break;

      case TCKind.tk_sequence_value:
        TypeDescription elementTypeDescription = typeDescription.getComponentType()// get the element type
        writeTypeDescription(elementTypeDescription);
        if( elementTypeDescription != null ){
          TypeName = "]" + elementTypeDescription.getTypeName();
          write_long(0);
        }
        break;

      case TCKind.tk_array_value:
View Full Code Here

 
  void writeAny(Object object) throws Exception {
    if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeAny:" + object);

    TypeDescription typeDescription = null;

    if(object == null)
      typeDescription = TypeDescription.__void_TypeDescription;

    else if(object instanceof Any) {
View Full Code Here

      writeObject(Unmarshal.__IORTypeDescription, ior);
  }

  private void writeCorbaUnion(CorbaUnion corbaUnion) throws Exception {
    TypeDescription typeDescription = TypeDescription.getTypeDescription(corbaUnion.getClass());

    Field descriminatorField = typeDescription.getZClass().getField("nDiscriminator");
   
    short index = descriminatorField.getShort(corbaUnion);
    write_short(index);

    Field fields[] = typeDescription.getFields();
    writeObject(TypeDescription.getTypeDescription(fields[index + 2].getType()), fields[index + 2].get(corbaUnion));
  }
View Full Code Here

    return result;
  }


  private TypeDescription readTypeDescription() throws Exception {
    TypeDescription result = null;

    //Class return = null;
    String TypeName = null;
    int kind = read_long();

    int nCount = 0;
    int nBound = 0;

    switch(kind) {
    case TCKind.tk_Principal_value:  todo()break;
    case TCKind.tk_objref_value:
      TypeName = read_asciistring();
      read_asciistring()// dummy
      break;

    case TCKind.tk_struct_value:
      TypeName = read_asciistring();
      read_asciistring();// dummy
      nCount = read_long();
      for(int i = 0; i < nCount; ++ i) {
        read_asciistring()// member name
        readTypeDescription();
      }
      break;

    case TCKind.tk_union_value:
      TypeName = read_asciistring();
      read_asciistring()// dummy

      TypeDescription descreminator = readTypeDescription();// Descriminator type code
      int nDefault = read_long()// index of default
      nCount = read_long();// count of members

      for(int i = 0; i < nCount; ++ i) {// add members of the unions
        // value of descriminator
        todo();
        // member name
        read_asciistring();
        //typecode of the member
        readTypeDescription();
      }
      break;

    case TCKind.tk_enum_value:
      TypeName = read_asciistring();
      read_asciistring()// dummy
      nCount = read_long();// all enum names
      for(int i = 0; i < nCount; ++ i)
        read_asciistring()// member name

      break;

    case TCKind.tk_string_value:
      // read the bounds of an string
      nBound = read_long();
      break;

    case TCKind.tk_sequence_value:
      TypeDescription elementType = readTypeDescription();
      TypeName = "[]" + elementType.getTypeName();

      nBound = read_long();
      if(nBound != 0)
        todo();
     
View Full Code Here

  }


  Throwable readThrowable() throws Exception {
    String typeName = read_asciistring();
    TypeDescription typeDescription = TypeDescription.getTypeDescription(typeName);

    String message = read_unicodestring();

    Constructor constructor = typeDescription.getZClass().getConstructor(new Class[]{String.class});
    Throwable throwable = (Throwable)constructor.newInstance(new Object[]{message});

    readStruct(typeDescription, throwable);

    if(DEBUG) System.err.println("##### " + getClass().getName() + ".readThrowable:" + throwable);
View Full Code Here

TOP

Related Classes of com.sun.star.lib.uno.typedesc.TypeDescription

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.