UDK 3.2.0 Java API Reference

com.sun.star.uno
クラス UnoRuntime

java.lang.Object
  拡張com.sun.star.uno.UnoRuntime

public class UnoRuntime
extends Object

The central class needed for implementing or using UNO components in Java.

The methods generateOid, queryInterface and areSame delegate calls to the implementing objects and are used instead of hashCode, casts, instanceof, ==, and equals.

For historic reasons, this class is not final, and has a public constructor. These artifacts are considered mistakes, which might be corrected in a future version of this class, so client code should not rely on them.

関連項目:
IBridge, IEnvironment, IQueryInterface

フィールドの概要
static boolean DEBUG
          推奨されていません。 As of UDK 3.2.0, do not use this internal field.
 
コンストラクタの概要
UnoRuntime()
          推奨されていません。 As of UDK 3.2.0, do not create instances of this class. It is considered a historic mistake to have a public constructor for this class, which only has static members. Also, this class might be changed to become final in a future version.
 
メソッドの概要
static boolean areSame(Object object1, Object object2)
          Tests if the given references represent facets of the same UNO object.
static String generateOid(Object object)
          Generates a world wide unique object identifier (OID) for the given object.
static IBridge getBridge(IEnvironment from, IEnvironment to, Object[] args)
          推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.
static IBridge getBridgeByName(String from, Object fromContext, String to, Object toContext, Object[] args)
          推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.
static IBridge[] getBridges()
          推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.
static XCurrentContext getCurrentContext()
          Gets the current context of the current thread, or null if no context has been set for the current thread.
static IEnvironment getEnvironment(String name, Object context)
          推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.
static IMapping getMapping(IEnvironment from, IEnvironment to)
          推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.
static IMapping getMappingByName(String from, String to)
          推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.
static String getUniqueKey()
          Generates a world wide unique identifier string.
static Object queryInterface(Class zInterface, Object object)
          Queries the given UNO object for the given Java class (which must represent a UNO interface type).
static Object queryInterface(Type type, Object object)
          Queries the given UNO object for the given UNO interface type.
static boolean reset()
          推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.
static void setCurrentContext(XCurrentContext context)
          Sets the current context for the current thread.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

DEBUG

public static final boolean DEBUG
推奨されていません。 As of UDK 3.2.0, do not use this internal field.

関連項目:
定数フィールド値
コンストラクタの詳細

UnoRuntime

public UnoRuntime()
推奨されていません。 As of UDK 3.2.0, do not create instances of this class. It is considered a historic mistake to have a public constructor for this class, which only has static members. Also, this class might be changed to become final in a future version.

メソッドの詳細

getUniqueKey

public static String getUniqueKey()
Generates a world wide unique identifier string.

It is guaranteed that every invocation of this method generates a new ID, which is unique within the VM. The quality of “world wide unique” will depend on the actual implementation, you should look at the source to determine if it meets your requirements.

戻り値:
a unique String

generateOid

public static String generateOid(Object object)
Generates a world wide unique object identifier (OID) for the given object.

It is guaranteed that subsequent calls to this method with the same object will give the same ID.

パラメータ:
object - any object for which a OID shall be generated; must not be null
戻り値:
the generated OID
関連項目:
IQueryInterface.getOid()

queryInterface

public static Object queryInterface(Type type,
                                    Object object)
Queries the given UNO object for the given UNO interface type.

This method returns null in case the given UNO object does not support the given UNO interface type (or is itself null). Otherwise, a reference to a Java object implementing the Java interface type corresponding to the given UNO interface is returned. In the latter case, it is unspecified whether the returned Java object is the same as the given object, or is another facet of that UNO object.

パラメータ:
type - the requested UNO interface type; must be a Type object representing a UNO interface type
object - a reference to any Java object representing (a facet of) a UNO object; may be null
戻り値:
a reference to the requested UNO interface type if available, otherwise null
関連項目:
IQueryInterface.queryInterface(com.sun.star.uno.Type)

queryInterface

public static Object queryInterface(Class zInterface,
                                    Object object)
Queries the given UNO object for the given Java class (which must represent a UNO interface type).

パラメータ:
object - a reference to any Java object representing (a facet of) a UNO object; may be null
戻り値:
a reference to the requested UNO interface type if available, otherwise null
関連項目:
queryInterface(Type, Object)

areSame

public static boolean areSame(Object object1,
                              Object object2)
Tests if the given references represent facets of the same UNO object.

For UNO objects, it does not work to check object identity with == or equals, as there may for example be multiple Java proxies for the same UNO object, each proxy implementing different interfaces.

パラメータ:
object1 - a reference to any Java object representing (a facet of) a UNO object; may be null
object2 - a reference to any Java object representing (a facet of) a UNO object; may be null
戻り値:
true if and only if object1 and object2 are both null, or both represent the same UNO object
関連項目:
IQueryInterface.isSame(java.lang.Object)

getCurrentContext

public static XCurrentContext getCurrentContext()
Gets the current context of the current thread, or null if no context has been set for the current thread.

The current context is thread local, which means that this method returns the context that was last set for this thread.

戻り値:
the current context of the current thread, or null if no context has been set for the current thread

setCurrentContext

public static void setCurrentContext(XCurrentContext context)
Sets the current context for the current thread.

The current context is thread local. To support a stacking behaviour, every function that sets the current context should reset it to the original value when exiting (for example, within a finally block).

パラメータ:
context - the context to be set; if null, any previously set context will be removed

getEnvironment

public static IEnvironment getEnvironment(String name,
                                          Object context)
                                   throws Exception
推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.

Retrieves an environment of type name with context context.

Environments are held weakly by this class. If the requested environment already exists, this methods simply returns it. Otherwise, this method looks for it under com.sun.star.lib.uno.environments.name.name_environment.

パラメータ:
name - the name of the environment
context - the context of the environment
例外:
Exception
関連項目:
IEnvironment

getBridge

public static IBridge getBridge(IEnvironment from,
                                IEnvironment to,
                                Object[] args)
                         throws Exception
推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.

Gets a bridge from environment from to environment to.

Creates a new bridge, if the requested bridge does not yet exist, and hands the arguments to the bridge.

If the requested bridge does not exist, it is searched for in package com.sun.star.lib.uno.bridges.from_to; and the root classpath as from_to_bridge.

パラメータ:
from - the source environment
to - the target environment
args - the initial arguments for the bridge
戻り値:
the requested bridge
例外:
Exception
関連項目:
getBridgeByName(java.lang.String, java.lang.Object, java.lang.String, java.lang.Object, java.lang.Object[]), IBridge, IEnvironment

getBridgeByName

public static IBridge getBridgeByName(String from,
                                      Object fromContext,
                                      String to,
                                      Object toContext,
                                      Object[] args)
                               throws Exception
推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.

Gets a bridge from environment from to environment to.

Creates a new bridge, if the requested bridge does not yet exist, and hands the arguments to the bridge.

If the requested bridge does not exist, it is searched for in package com.sun.star.lib.uno.bridges.from_to; and the root classpath as from_to_bridge. The used environments are retrieved through getEnvironment.

パラメータ:
from - the name of the source environment
fromContext - the context for the source environment
to - the name of the target environment
toContext - the context for the target environment
args - the initial arguments for the bridge
戻り値:
the requested bridge
例外:
Exception
関連項目:
getBridge(com.sun.star.uno.IEnvironment, com.sun.star.uno.IEnvironment, java.lang.Object[]), getEnvironment(java.lang.String, java.lang.Object), IBridge, IEnvironment

getBridges

public static IBridge[] getBridges()
推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.

Returns an array of all active bridges.

戻り値:
an array of IBridge objects
関連項目:
IBridge

getMapping

public static IMapping getMapping(IEnvironment from,
                                  IEnvironment to)
                           throws Exception
推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.

Gets a mapping from environment from to environment to.

Mappings are like bridges, except that with mappings one can only map in one direction. Mappings are here for compatibility with the binary UNO API. Mappings are implemented as wrappers around bridges.

パラメータ:
from - the source environment
to - the target environment
戻り値:
the requested mapping
例外:
Exception
関連項目:
IEnvironment, IMapping

getMappingByName

public static IMapping getMappingByName(String from,
                                        String to)
                                 throws Exception
推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.

Gets a mapping from environment from to environment to.

The used environments are retrieved through getEnvironment.

パラメータ:
from - the name of the source environment
to - the name of the target environment
戻り値:
the requested mapping
例外:
Exception
関連項目:
getEnvironment(java.lang.String, java.lang.Object), getMapping(com.sun.star.uno.IEnvironment, com.sun.star.uno.IEnvironment), IMapping

reset

public static boolean reset()
推奨されていません。 As of UDK 3.2.0, this method is deprecated, without offering a replacement.

Resets this UnoRuntime to its initial state.

Releases all references to bridges and environments.


UDK 3.2.0 Java API Reference