org.openide.util.Utilities.toPrimitiveArray()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(102)

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

Utilities.toPrimitiveArray介绍

[英]Convert an array of objects to an array of primitive types. E.g. an Integer[] would be changed to an int[].
[中]将对象数组转换为基元类型数组。例如,Integer[]将被更改为int[]

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-nodes

public void setValue(T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
  if (!canWrite()) {
    throw new IllegalAccessException();
  }
  Object validInstance = Beans.getInstanceOf(instance, setter.getDeclaringClass());
  Object value = val;
  if (
    (val != null) && (setter.getParameterTypes()[0].getComponentType().isPrimitive()) &&
      (!val.getClass().getComponentType().isPrimitive())
  ) {
    value = Utilities.toPrimitiveArray((Object[]) val);
  }
  setter.invoke(validInstance, value);
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public Object getValue() {
  if (array == null) {
    return null;
  }
  if (indexedProperty.getElementType().isPrimitive()) {
    return Utilities.toPrimitiveArray(array);
  }
  return array;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public Object getValue() {
  if (array == null) {
    return null;
  }
  if (indexedProperty.getElementType().isPrimitive()) {
    return Utilities.toPrimitiveArray(array);
  }
  return array;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public Object getValue() {
  if (array == null) {
    return null;
  }
  if (indexedProperty.getElementType().isPrimitive()) {
    return Utilities.toPrimitiveArray(array);
  }
  return array;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public void setValue (Object val) throws
  IllegalAccessException, IllegalArgumentException, InvocationTargetException {
  if (!canWrite ()) throw new IllegalAccessException ();
  Object validInstance = Beans.getInstanceOf (instance, setter.getDeclaringClass());
  if ((val!=null)&&(setter.getParameterTypes()[0].getComponentType().isPrimitive())&&(!val.getClass().getComponentType().isPrimitive())) {
    val = Utilities.toPrimitiveArray ((Object[])val);
  }
  setter.invoke (validInstance, new Object [] {val});
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public void setValue (Object val) throws
  IllegalAccessException, IllegalArgumentException, InvocationTargetException {
  if (!canWrite ()) throw new IllegalAccessException ();
  Object validInstance = Beans.getInstanceOf (instance, setter.getDeclaringClass());
  if ((val!=null)&&(setter.getParameterTypes()[0].getComponentType().isPrimitive())&&(!val.getClass().getComponentType().isPrimitive())) {
    val = Utilities.toPrimitiveArray ((Object[])val);
  }
  setter.invoke (validInstance, new Object [] {val});
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

clearSelection();
} else {
  int[] rows = (int[]) Utilities.toPrimitiveArray(
      list.toArray(new Integer[list.size()])
    );

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

clearSelection();
} else {
  int[] rows = (int[]) Utilities.toPrimitiveArray(
    (Integer[]) list.toArray(new Integer[list.size()]));
  tree.setSelectionRows(rows);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

clearSelection();
} else {
  int[] rows = (int[]) Utilities.toPrimitiveArray(
    (Integer[]) list.toArray(new Integer[list.size()]));
  tree.setSelectionRows(rows);

相关文章