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

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

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

Utilities.toObjectArray介绍

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

代码示例

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

public void setValue(Object value) {
  if (value == null) {
    array = null;
    firePropertyChange();
    return;
  }
  if (!value.getClass ().isArray ()) {
    throw new IllegalArgumentException(env != null ? "Property whose value is not an array " + env.getFeatureDescriptor().getName() : "Unknown property - not attached yet.");  //NOI18N
  }
  if (value.getClass().getComponentType().isPrimitive()) {
    array = Utilities.toObjectArray (value);
  } else {
    array = (Object[])Array.newInstance(
      value.getClass().getComponentType(), 
      ((Object[])value).length);
    System.arraycopy(value, 0, array, 0, array.length);
  }
    
  firePropertyChange();
}

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

public void setValue(Object value) {
  if (value == null) {
    array = null;
    firePropertyChange();
    return;
  }
  if (!value.getClass ().isArray ()) {
    throw new IllegalArgumentException(env != null ? "Property whose value is not an array " + env.getFeatureDescriptor().getName() : "Unknown property - not attached yet.");  //NOI18N
  }
  if (value.getClass().getComponentType().isPrimitive()) {
    array = Utilities.toObjectArray (value);
  } else {
    array = (Object[])Array.newInstance(
      value.getClass().getComponentType(), 
      ((Object[])value).length);
    System.arraycopy(value, 0, array, 0, array.length);
  }
    
  firePropertyChange();
}

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

public void setValue(Object value) {
  if (value == null) {
    array = null;
    firePropertyChange();
    return;
  }
  if (!value.getClass().isArray()) {
    throw new IllegalArgumentException(
      (env != null) ? ("Property whose value is not an array " + env.getFeatureDescriptor().getName())
             : "Unknown property - not attached yet."
    ); //NOI18N
  }
  if (value.getClass().getComponentType().isPrimitive()) {
    array = Utilities.toObjectArray(value);
  } else {
    array = (Object[]) Array.newInstance(value.getClass().getComponentType(), ((Object[]) value).length);
    System.arraycopy(value, 0, array, 0, array.length);
  }
  firePropertyChange();
}

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

assert !Arrays.asList(arr).contains(null) : "Null element in reorderer list " + Arrays.asList(arr) + "; list=" + list + " indxs=" + Arrays.asList(org.openide.util.Utilities.toObjectArray(indxs));
list.clear ();
list.addAll (Arrays.asList (arr));

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

assert !Arrays.asList(arr).contains(null) : "Null element in reorderer list " + Arrays.asList(arr) + "; list=" + list + " indxs=" + Arrays.asList(org.openide.util.Utilities.toObjectArray(indxs));
list.clear ();
list.addAll (Arrays.asList (arr));

相关文章