com.sun.star.uno.Any.getType()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中com.sun.star.uno.Any.getType()方法的一些代码示例,展示了Any.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Any.getType()方法的具体详情如下:
包路径:com.sun.star.uno.Any
类名称:Any
方法名:getType

Any.getType介绍

[英]Gets the type of the value within the any.
[中]获取any中的值的类型。

代码示例

代码示例来源: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.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.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/jurt

type = a.getType();

代码示例来源: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: org.libreoffice/jurt

type = a.getType();

代码示例来源: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/jurt

/**
 * 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;
}

代码示例来源: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;

代码示例来源: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;

代码示例来源:origin: org.libreoffice/jurt

if (a.getType().getTypeClass() == TypeClass.INTERFACE) {
  result = a.getObject();
} else {

代码示例来源:origin: org.openoffice/jurt

if (a.getType().getTypeClass() == TypeClass.INTERFACE) {
  result = a.getObject();
} else {

代码示例来源:origin: org.libreoffice/juh

convObj= new Any( ((Any)curVal[0]).getType(), null);

代码示例来源:origin: org.openoffice/juh

convObj= new Any( ((Any)curVal[0]).getType(), null);

相关文章

微信公众号

最新文章

更多