本文整理了Java中com.sun.star.uno.Any
类的一些代码示例,展示了Any
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Any
类的具体详情如下:
包路径:com.sun.star.uno.Any
类名称:Any
[英]The UNO IDL type any is mapped to java type java.lang.Object
.
In special cases it is necessary to have an explicit any to additionally transport an exact type. For instance if you want to pass an object reference via an interprocess connection using an any, you should use this class to add an explicit interface type, so the remote counterpart doesn't need to invoke a queryInterface).
[中]UNO IDL类型any映射到java类型java.lang.Object
。
在特殊情况下,有必要使用显式any来额外传输精确类型。例如,如果您希望使用any通过进程间连接传递对象引用,则应使用此类添加显式接口类型,以便远程对等方不需要调用queryInterface)。
代码示例来源:origin: com.haulmont.yarg/yarg
public static Any createAny(Object o) {
return new Any(new Type(o.getClass()), o);
}
}
代码示例来源:origin: org.openoffice/ridl
if (a.getType().getTypeClass() == TypeClass.INTERFACE) {
object = a.getObject();
if (object instanceof Any) {
Any a = (Any) object;
object = a.getType().getTypeClass() == TypeClass.INTERFACE
? a.getObject() : null;
代码示例来源:origin: org.openoffice/juh
boolean bAnyVal= setVal instanceof Any;
if (bAnyVal)
bVoidValue= ((Any) setVal).getObject() == null;
else
bVoidValue= setVal == null;
convObj= new Any(new Type(XInterface.class), xint);
convObj= new Any(new Type(), null);
else
convObj= new Any( ((Any)curVal[0]).getType(), null);
convObj= new Any(new Type(setVal.getClass()), setVal);
代码示例来源:origin: org.openoffice/ridl
Any a1 = Any.complete(any1);
Any a2 = Any.complete(any2);
Type t = a1.getType();
if (!a2.getType().equals(t)) {
return false;
Object v1 = a1.getObject();
Object v2 = a2.getObject();
switch (t.getTypeClass().getValue()) {
case TypeClass.VOID_value:
代码示例来源:origin: cuba-platform/yarg
public static XTextTable getTableByName(XComponent xComponent, String tableName) throws NoSuchElementException, WrappedTargetException {
XNameAccess tables = as(XTextTablesSupplier.class, xComponent).getTextTables();
return (XTextTable) ((Any) tables.getByName(tableName)).getObject();
}
代码示例来源:origin: org.libreoffice/juh
boolean bAnyVal= setVal instanceof Any;
if (bAnyVal)
bVoidValue= ((Any) setVal).getObject() == null;
else
bVoidValue= setVal == null;
convObj= new Any(new Type(XInterface.class), xint);
convObj= new Any(new Type(), null);
else
convObj= new Any( ((Any)curVal[0]).getType(), null);
convObj= new Any(new Type(setVal.getClass()), setVal);
代码示例来源:origin: org.libreoffice/ridl
Any a1 = Any.complete(any1);
Any a2 = Any.complete(any2);
Type t = a1.getType();
if (!a2.getType().equals(t)) {
return false;
Object v1 = a1.getObject();
Object v2 = a2.getObject();
switch (t.getTypeClass().getValue()) {
case TypeClass.VOID_value:
代码示例来源:origin: com.haulmont.yarg/yarg
public static XTextTable getTableByName(XComponent xComponent, String tableName) throws NoSuchElementException, WrappedTargetException {
XNameAccess tables = as(XTextTablesSupplier.class, xComponent).getTextTables();
return (XTextTable) ((Any) tables.getByName(tableName)).getObject();
}
代码示例来源:origin: org.libreoffice/ridl
if (a.getType().getTypeClass() == TypeClass.INTERFACE) {
object = a.getObject();
if (object instanceof Any) {
Any a = (Any) object;
object = a.getType().getTypeClass() == TypeClass.INTERFACE
? a.getObject() : null;
代码示例来源:origin: cuba-platform/yarg
public static Any createAny(Object o) {
return new Any(new Type(o.getClass()), o);
}
}
代码示例来源:origin: org.libreoffice/juh
if (obj == null || (obj instanceof Any && ((Any) obj).getObject() == null))
{}
else if(cl.equals(Object.class))
obj= ((Any) obj).getObject();
retVal= obj;
代码示例来源:origin: org.openoffice/jurt
private void writeAnyValue(Object value) {
TypeDescription type;
if (value == null || value instanceof XInterface) {
type = TypeDescription.getTypeDescription(XInterface.class);
} else if (value instanceof Any) {
Any any = (Any) value;
try {
type = TypeDescription.getTypeDescription(any.getType());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e.toString());
}
value = any.getObject();
} else if (value.getClass() == Object.class) {
// Avoid StackOverflowError:
throw new IllegalArgumentException(
"Object instance does not represent UNO value");
} else {
type = TypeDescription.getTypeDescription(value.getClass());
}
writeType(type);
writeValue(type, value);
}
代码示例来源:origin: org.openoffice/ridl
/**
Complete a UNO <code>ANY</code> (make sure it is wrapped up as an
<code>Any</code> instance).
@param any a Java value representing a UNO <code>ANY</code> value.
@return a complete Java value (that is, an <code>Any</code> instance)
representing the same UNO <code>ANY</code> value as the given argument.
@since UDK 3.2.3
*/
public static final Any complete(Object any) {
return any instanceof Any
? (Any) any
: new Any(
new Type(any == null ? XInterface.class : any.getClass()), any);
}
代码示例来源:origin: org.openoffice/juh
if (obj == null || (obj instanceof Any && ((Any) obj).getObject() == null))
retVal= null;
else if(cl.equals(Object.class))
obj= ((Any) obj).getObject();
retVal= obj;
代码示例来源:origin: org.libreoffice/jurt
private void writeAnyValue(Object value) throws ClassNotFoundException {
TypeDescription type;
if (value == null || value instanceof XInterface) {
type = TypeDescription.getTypeDescription(XInterface.class);
} else if (value instanceof Any) {
Any any = (Any) value;
type = TypeDescription.getTypeDescription(any.getType());
value = any.getObject();
} else if (value.getClass() == Object.class) {
// Avoid StackOverflowError:
throw new IllegalArgumentException(
"Object instance does not represent UNO value");
} else {
type = TypeDescription.getTypeDescription(value.getClass());
}
writeType(type);
writeValue(type, value);
}
代码示例来源:origin: org.libreoffice/ridl
/**
* Complete a UNO <code>ANY</code> (make sure it is wrapped up as an
* <code>Any</code> instance).
*
* @param any a Java value representing a UNO <code>ANY</code> value.
* @return a complete Java value (that is, an <code>Any</code> instance)
* representing the same UNO <code>ANY</code> value as the given argument.
* @since UDK 3.2.3
*/
public static final Any complete(Object any) {
return any instanceof Any
? (Any) any
: new Any(
new Type(any == null ? XInterface.class : any.getClass()), any);
}
代码示例来源:origin: org.openoffice/juh
bVoidValue= ((Any) value).getObject() == null;
else
bVoidValue= value == null;
bValueOk= checkType(((Any) value).getObject());
else
bValueOk= checkType(value);
代码示例来源:origin: org.openoffice/jurt
/** 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;
}
代码示例来源:origin: org.libreoffice/officebean
/**
* Returns an Any containing a sequences of com.sun.star.beans.NamedValue. One NamedValue
* contains the name "WINDOW" and the value is a Long representing the window handle.
* The second NamedValue has the name "XEMBED" and the value is true, when the XEmbed
* protocol shall be used fore embedding the native Window.
*/
protected Any getWrappedWindowHandle()
{
NamedValue window = new NamedValue(
"WINDOW", new Any(new Type(Long.class), Long.valueOf(getNativeWindow())));
NamedValue xembed = new NamedValue(
"XEMBED", new Any(new Type(Boolean.class), Boolean.FALSE));
if (getNativeWindowSystemType() == SystemDependent.SYSTEM_XWINDOW )
{
String vendor = System.getProperty("java.vendor");
if ((vendor.equals("Sun Microsystems Inc.") || vendor.equals("Oracle Corporation"))
&& Boolean.getBoolean("sun.awt.xembedserver"))
{
xembed = new NamedValue(
"XEMBED",
new Any(new Type(Boolean.class), Boolean.TRUE));
}
}
return new Any(
new Type("[]com.sun.star.beans.NamedValue"),
new NamedValue[] {window, xembed});
}
代码示例来源:origin: org.libreoffice/juh
bVoidValue= ((Any) value).getObject() == null;
else
bVoidValue= value == null;
bValueOk= checkType(((Any) value).getObject());
else
bValueOk= checkType(value);
内容来源于网络,如有侵权,请联系作者删除!