/** 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()); }
private final XMultiServiceFactory getSMgr( XComponentContext xContext ) { if (xContext != null) { return UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); } else { return _xMultiServiceFactory; } }
/** Creates an instance of this class. *@param obj XWeak implementation */ public WeakReference(Object obj) { XWeak weak= UnoRuntime.queryInterface(XWeak.class, obj); if (weak != null) { XAdapter adapter= (XAdapter) weak.queryAdapter(); if (adapter != null) m_listener= new OWeakRefListener(adapter); } } /** Returns a hard reference to the object that is kept weak by this class.
/** * Constructs a new any. * <p> * @param zInterface the type of the any. * @param object the data of the any. * @deprecated as of UDK 2.0 */ public Any(Class zInterface, Object object) { this(new Type(zInterface), object); }
/** checks if the any contains a value of the idl type <code>byte</code>. @param object the object to check @return true when the any contains a byte, false otherwise. */ static public boolean isByte(Object object){ return containsType(TypeClass.BYTE, object); }
/** * Constructs a new <code>Type</code> from the given type description. * * @param typeDescription a type description. Must not be * <code>null</code>. */ public Type(ITypeDescription typeDescription) { _typeName = typeDescription.getTypeName(); _typeClass = typeDescription.getTypeClass(); _iTypeDescription = typeDescription; }
/** converts a string or an any containing a string into a string. @param object the object to convert @throws com.sun.star.lang.IllegalArgumentException in case no string is contained within object. @return the string contained within the object */ static public String toString(Object object) throws com.sun.star.lang.IllegalArgumentException { return (String) convertSimple( TypeClass.STRING, null, object); }
/** * Constructs a new <code>Type</code> which defaults to <code>VOID</code>. */ public Type() { init(null, void.class, false, false, false); }
/** * Retrieves the object identifier for a registered interface from this * environment. * * @param object a registered interface * @see com.sun.star.uno.IEnvironment#getRegisteredObjectIdentifier */ public String getRegisteredObjectIdentifier(Object object) { return UnoRuntime.generateOid(object); }
/** The constructor registered this object with adapter. *@param adapter the XAdapter implementation. */ OWeakRefListener( XAdapter adapter) { m_adapter= adapter; m_adapter.addReference(this); } /** Method of com.sun.star.uno.XReference. When called, it deregisteres this
private final XMultiServiceFactory getSMgr( XComponentContext xContext ) { if (xContext != null) { return UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); } else { return _xMultiServiceFactory; } }
/** * Creates an instance of this class. * * @param obj XWeak implementation. */ public WeakReference(Object obj) { XWeak weak= UnoRuntime.queryInterface(XWeak.class, obj); if (weak != null) { XAdapter adapter= weak.queryAdapter(); if (adapter != null) m_listener= new OWeakRefListener(adapter); } }
/** * 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()); }
/** checks if the any contains a value of the idl type <code>hyper</code> (which maps to a java-long). @param object the object to check @return true when the any contains a long, false otherwise. */ static public boolean isLong(Object object){ return containsType(TypeClass.HYPER, object); }
/** converts an array or an any containing an array into an array. @param object the object to convert @throws com.sun.star.lang.IllegalArgumentException in case no array is contained within object. @return the array contained within the object */ static public Object toArray( Object object) throws com.sun.star.lang.IllegalArgumentException { return convertSimple( TypeClass.SEQUENCE, null, object); }
private Type( Class<?> zClass, boolean alternative, boolean sequenceComponentType) { init(null, zClass, alternative, false, sequenceComponentType); }
/** checks if the any contains a value of the idl type <code>long</code> (which maps to a java-int). @param object the object to check @return true when the any contains a int, false otherwise. */ static public boolean isInt(Object object){ return containsType(TypeClass.LONG, object); }
/** checks if the any contains a value of the idl type <code>double</code>. @param object the object to check @return true when the any contains a double, false otherwise. */ static public boolean isDouble(Object object){ return containsType(TypeClass.DOUBLE, object); }
/** checks if the any contains UNO idl sequence value (meaning a java array containing elements which are values of UNO idl types). @param object the object to check @return true when the any contains an object which implements interfaces, false otherwise. */ static public boolean isArray(Object object){ return containsType(TypeClass.SEQUENCE, object); }