org.apache.sis.util.Numbers.wrapperToPrimitive()方法的使用及代码示例

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

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

Numbers.wrapperToPrimitive介绍

[英]Changes a wrapper class to its primitive (for example Integer to int). If the specified class is not a wrapper type, then it is returned unchanged.
[中]将包装器类更改为其原语(例如Integer更改为int)。如果指定的类不是包装器类型,那么它将原封不动地返回。

代码示例

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Verifies that a value of the given type can be casted to the expected type.
 * The expected type must be one of the {@link Numbers} constants.
 */
final void verifyType(final Class<? extends Number> type, final byte expected) {
  final byte t = Numbers.getEnumConstant(type);
  if (t < Numbers.BYTE || t > expected) {
    throw new ClassCastException(Errors.format(Errors.Keys.CanNotConvertFromType_2,
      type, Numbers.wrapperToPrimitive(getElementType())));
  }
}

代码示例来源:origin: apache/sis

/**
 * Verifies that a value of the given type can be casted to the expected type.
 * The expected type must be one of the {@link Numbers} constants.
 */
final void verifyType(final Class<? extends Number> type, final byte expected) {
  final byte t = Numbers.getEnumConstant(type);
  if (t < Numbers.BYTE || t > expected) {
    throw new ClassCastException(Errors.format(Errors.Keys.CanNotConvertFromType_2,
      type, Numbers.wrapperToPrimitive(getElementType())));
  }
}

代码示例来源:origin: org.apache.sis.core/sis-utility

baseValueClass = (baseValueClass != null) ? Numbers.wrapperToPrimitive(baseValueClass) : Object.class;
return types;

代码示例来源:origin: apache/sis

baseValueClass = (baseValueClass != null) ? Numbers.wrapperToPrimitive(baseValueClass) : Object.class;
return types;

代码示例来源:origin: apache/sis

/**
 * Tests {@link Numbers#wrapperToPrimitive(Class)}.
 */
@Test
public void testWrapperToPrimitive() {
  assertEquals(Byte   .TYPE, wrapperToPrimitive(Byte   .TYPE));
  assertEquals(Short  .TYPE, wrapperToPrimitive(Short  .TYPE));
  assertEquals(Integer.TYPE, wrapperToPrimitive(Integer.TYPE));
  assertEquals(Long   .TYPE, wrapperToPrimitive(Long   .TYPE));
  assertEquals(Float  .TYPE, wrapperToPrimitive(Float  .TYPE));
  assertEquals(Double .TYPE, wrapperToPrimitive(Double .TYPE));
  assertEquals(Byte   .TYPE, wrapperToPrimitive(Byte   .class));
  assertEquals(Short  .TYPE, wrapperToPrimitive(Short  .class));
  assertEquals(Integer.TYPE, wrapperToPrimitive(Integer.class));
  assertEquals(Long   .TYPE, wrapperToPrimitive(Long   .class));
  assertEquals(Float  .TYPE, wrapperToPrimitive(Float  .class));
  assertEquals(Double .TYPE, wrapperToPrimitive(Double .class));
}

代码示例来源:origin: apache/sis

Class<?> type = elementType;
if (type != Boolean.class) {        // Because there is no Arrays.binarySearch(boolean[], …) method.
  type = wrapperToPrimitive(type);

代码示例来源:origin: org.apache.sis.core/sis-utility

Class<?> type = elementType;
if (type != Boolean.class) {        // Because there is no Arrays.binarySearch(boolean[], …) method.
  type = wrapperToPrimitive(type);

代码示例来源:origin: apache/sis

primaryKeyClass = Numbers.wrapperToPrimitive(primaryKeyClass);

相关文章