private static boolean __isTypeClassPrimitive(TypeClass typeClass) { return typeClass.getValue() < __typeClassToTypeName.length; }
private static boolean __isTypeClassPrimitive(TypeClass typeClass) { return typeClass.getValue() < __typeClassToTypeName.length; }
public static boolean isUnsigned(ITypeDescription desc) { switch (getElementTypeClass(desc).getValue()) { case TypeClass.UNSIGNED_SHORT_value: case TypeClass.UNSIGNED_LONG_value: case TypeClass.UNSIGNED_HYPER_value: return true; default: return false; } }
/** Examines the argument <em>object</em> if is correspond to the type in argument <em>what</em>. <em>object</em> is either matched directly against the type or if it is an any then the contained object is matched against the type. */ static private boolean containsType( TypeClass what, Object object){ return (getType(object).getTypeClass().getValue() == what.getValue()); }
public static boolean isUnsigned(TypeDescription desc) { switch (getElementTypeClass(desc).getValue()) { case TypeClass.UNSIGNED_SHORT_value: case TypeClass.UNSIGNED_LONG_value: case TypeClass.UNSIGNED_HYPER_value: return true; default: return false; } }
/** * Examines the argument <em>object</em> if is correspond to the type in * argument <em>what</em>. * * <p><em>object</em> is either matched directly against the type or if it is * an any then the contained object is matched against the type.</p> */ private static boolean containsType( TypeClass what, Object object){ return (getType(object).getTypeClass().getValue() == what.getValue()); }
/** * Constructs a new <code>Type</code> with the given type class. * * @param typeClass the type class of this type; must not be * <code>null</code>. Only type classes for simple types are allowed * here. * * @throws IllegalArgumentException if the given <code>typeClass</code> is * not simple (for example, a struct or an interface type). This * constructor could not find out the type name in such a case. */ public Type(TypeClass typeClass) { if(__isTypeClassPrimitive(typeClass)) { _typeClass = typeClass; _typeName = __typeClassToTypeName[typeClass.getValue()]; } else throw new IllegalArgumentException(typeClass + " is not primitive"); }
/** * Constructs a new <code>Type</code> with the given type class. * * @param typeClass the type class of this type; must not be * <code>null</code>. Only type classes for simple types are allowed * here. * * @throws IllegalArgumentException if the given <code>typeClass</code> is * not simple (for example, a struct or an interface type). This * constructor could not find out the type name in such a case. */ public Type(TypeClass typeClass) { if(__isTypeClassPrimitive(typeClass)) { _typeClass = typeClass; _typeName = __typeClassToTypeName[typeClass.getValue()]; } else throw new IllegalArgumentException(typeClass + " is not primitive"); }
/** checks if the any contains an interface, struct, exception, sequence or enum. If <em>object</em> is an any with an interface type, then true is also returned if the any contains a null reference. This is because interfaces are allowed to have a null value contrary to other UNO types. @param object the object to check @return true if the any contains an object */ static public boolean isObject(Object object) { int tc = getType(object).getTypeClass().getValue(); return (TypeClass.INTERFACE_value == tc || TypeClass.STRUCT_value == tc || TypeClass.EXCEPTION_value == tc || TypeClass.SEQUENCE_value == tc || TypeClass.ENUM_value == tc); }
/** * Checks if the any contains an interface, struct, exception, sequence or enum. * * <p>If <em>object</em> is an any with an interface type, then true is also * returned if the any contains a null reference. This is because interfaces * are allowed to have a null value contrary to other UNO types.</p> * * @param object the object to check. * @return true if the any contains an object. */ public static boolean isObject(Object object) { int tc = getType(object).getTypeClass().getValue(); return (TypeClass.INTERFACE_value == tc || TypeClass.STRUCT_value == tc || TypeClass.EXCEPTION_value == tc || TypeClass.SEQUENCE_value == tc || TypeClass.ENUM_value == tc); }
return false; switch (_typeClass.getValue()) { case TypeClass.SEQUENCE_value: case TypeClass.ENUM_value:
public void writeType(TypeDescription type) { try { TypeClass typeClass = type.getTypeClass(); if (TypeDescription.isTypeClassSimple(typeClass)) { write8Bit(typeClass.getValue()); } else { boolean[] found = new boolean[1]; int index = typeCache.add(found, type.getTypeName()); write8Bit(typeClass.getValue() | (found[0] ? 0 : 0x80)); write16Bit(index); if (!found[0]) { writeStringValue(type.getTypeName()); } } } catch (IOException e) { throw new RuntimeException(e); } }
public void writeType(TypeDescription type) { TypeClass typeClass = type.getTypeClass(); if (TypeDescription.isTypeClassSimple(typeClass)) { write8Bit(typeClass.getValue()); } else { boolean[] found = new boolean[1]; int index = typeCache.add(found, type.getTypeName()); write8Bit(typeClass.getValue() | (found[0] ? 0 : 0x80)); write16Bit(index); if (!found[0]) { writeStringValue(type.getTypeName()); } } }
/** Determines the type of an any object. @param object any object @return type object */ static public Type getType( Object object ) { Type t; if (null == object) { t = m_XInterface_type; } else if (object instanceof Any) { t = ((Any)object).getType(); // nested any if (TypeClass.ANY_value == t.getTypeClass().getValue()) return getType( ((Any)object).getObject() ); } else { t = new Type( object.getClass() ); } return t; }
/** * Determines the type of an any object. * * @param object any object. * @return type object. */ public static Type getType( Object object ) { Type t; if (null == object) { t = m_XInterface_type; } else if (object instanceof Any) { t = ((Any)object).getType(); // nested any if (TypeClass.ANY_value == t.getTypeClass().getValue()) return getType( ((Any)object).getObject() ); } else { t = new Type( object.getClass() ); } return t; }
public Object readValue(TypeDescription type) { try { switch (type.getTypeClass().getValue()) { case TypeClass.VOID_value: return null;
public Object readValue(TypeDescription type) { switch (type.getTypeClass().getValue()) { case TypeClass.VOID_value: return null;
public void writeValue(TypeDescription type, Object value) { switch(type.getTypeClass().getValue()) { case TypeClass.VOID_value: break;
public static TypeDescription getTypeDescription(TypeClass typeClass) { switch (typeClass.getValue()) { case TypeClass.VOID_value: return getDefinitely(Type.VOID);
public static TypeDescription getTypeDescription(TypeClass typeClass) { switch (typeClass.getValue()) { case TypeClass.VOID_value: return getDefinitely(Type.VOID);