java.lang.Byte.intValue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(117)

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

Byte.intValue介绍

[英]Returns the value of this Byte as an int.
[中]以int形式返回此字节的值。

代码示例

代码示例来源:origin: jfinal/jfinal

public Integer toInt(Byte self) {
  return self.intValue();
}

代码示例来源:origin: apache/incubator-pinot

@Override
public Integer toInteger(Object value) {
 return ((Byte) value).intValue();
}

代码示例来源:origin: stackoverflow.com

Byte b = rno[0]; // Boxing conversion converts `byte` to `Byte`
int i = b.intValue();

代码示例来源:origin: traccar/traccar

public void set(String key, Byte value) {
  if (value != null) {
    attributes.put(key, value.intValue());
  }
}

代码示例来源:origin: square/moshi

@Override public void toJson(JsonWriter writer, Byte value) throws IOException {
 writer.value(value.intValue() & 0xff);
}

代码示例来源:origin: CalebFenton/simplify

public static BuilderInstruction buildConstant(Byte value, int register) {
  return buildConstant(value.intValue(), register);
}

代码示例来源:origin: voldemort/voldemort

private Integer coerceToInteger(Object o) {
  if(o == null)
    return null;
  Class<?> c = o.getClass();
  if(c == Integer.class)
    return (Integer) o;
  else if(c == Byte.class)
    return ((Byte) o).intValue();
  else if(c == Short.class)
    return ((Short) o).intValue();
  else
    throw new SerializationException("Object of type " + c.getName()
                     + " cannot be coerced to type " + JsonTypes.INT32
                     + " as the schema specifies.");
}

代码示例来源:origin: prestodb/presto

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 */
@Override
public ValueNode numberNode(Byte value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.intValue());
}

代码示例来源:origin: redisson/redisson

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 */
@Override
public ValueNode numberNode(Byte value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.intValue());
}

代码示例来源:origin: pxb1988/dex2jar

protected void printAnnotationArrayValue(final Object value) {
  if (value instanceof String[]) {
    print(((String[]) value)[1]);
  } else if (value instanceof AnnotationNode) {
    printAnnotation((AnnotationNode) value, 0, -1);
  } else if (value instanceof String) {
    print(value);
  } else if (value instanceof Byte) {
    pw.print(((Byte) value).intValue());
  } else if (value instanceof Boolean) {
    pw.print(((Boolean) value).booleanValue() ? 1 : 0);
  } else if (value instanceof Character) {
    pw.print(new Integer(((Character) value).charValue()));
  } else if (value instanceof Short) {
    pw.print(((Short) value).intValue());
  } else if (value instanceof Type) {
    pw.print(((Type) value).getDescriptor());
  } else {
    print(value);
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index, SharedSessionContractImplementor session)
    throws HibernateException, SQLException {
  IntegerType.INSTANCE.nullSafeSet(
      preparedStatement,
      (value == null ? null : ( (RevisionType) value ).getRepresentation().intValue()),
      index,
      session
  );
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Byte value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.intValue());
}

代码示例来源:origin: alibaba/canal

public Object getValFromData(ESMapping mapping, Map<String, Object> dmlData, String fieldName, String columnName) {
  String esType = getEsType(mapping, fieldName);
  Object value = dmlData.get(columnName);
  if (value instanceof Byte) {
    if ("boolean".equals(esType)) {
      value = ((Byte) value).intValue() != 0;
    }
  }
  // 如果是对象类型
  if (mapping.getObjFields().containsKey(fieldName)) {
    return ESSyncUtil.convertToEsObj(value, mapping.getObjFields().get(fieldName));
  } else {
    return ESSyncUtil.typeConvert(value, esType);
  }
}

代码示例来源:origin: wildfly/wildfly

public Integer getIntProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
 Object value = doGetProperty(key);
 if (value == null) {
   return Integer.valueOf(null);
 } else if (value instanceof Integer) {
   return (Integer) value;
 } else if (value instanceof Byte) {
   return ((Byte) value).intValue();
 } else if (value instanceof Short) {
   return ((Short) value).intValue();
 } else if (value instanceof SimpleString) {
   return Integer.parseInt(((SimpleString) value).toString());
 }
 throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
}

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

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 */
@Override
public ValueNode numberNode(Byte value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.intValue());
}

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

@Override
 public Object convert(Object input) {
  if (input == null) {
   return null;
  }
  Object inputFieldValue = inputOI.getField(input);
  byte inputFieldTag = inputOI.getTag(input);
  Object outputFieldValue = null;
  int inputFieldTagIndex = ((Byte)inputFieldTag).intValue();
  if (inputFieldTagIndex >= 0 && inputFieldTagIndex < fieldConverters.size()) {
    outputFieldValue = fieldConverters.get(inputFieldTagIndex).convert(inputFieldValue);
  }
  outputOI.setFieldAndTag(output, outputFieldValue, inputFieldTag);
  return output;
 }
}

代码示例来源:origin: voldemort/voldemort

public StringOrder toObject(byte[] bytes) {
    return new StringOrder(Byte.valueOf(bytes[0]).intValue());
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void parseNumberAsHex() {
  String aByte = "0x" + Integer.toHexString(Byte.valueOf(Byte.MAX_VALUE).intValue());
  String aShort = "0x" + Integer.toHexString(Short.valueOf(Short.MAX_VALUE).intValue());
  String anInteger = "0x" + Integer.toHexString(Integer.MAX_VALUE);
  String aLong = "0x" + Long.toHexString(Long.MAX_VALUE);
  String aReallyBigInt = "FEBD4E677898DFEBFFEE44";
  assertByteEquals(aByte);
  assertShortEquals(aShort);
  assertIntegerEquals(anInteger);
  assertLongEquals(aLong);
  assertEquals("BigInteger did not parse",
      new BigInteger(aReallyBigInt, 16), NumberUtils.parseNumber("0x" + aReallyBigInt, BigInteger.class));
}

代码示例来源:origin: spring-projects/spring-framework

return addConstantInteger(((Integer) value).intValue());
} else if (value instanceof Byte) {
 return addConstantInteger(((Byte) value).intValue());
} else if (value instanceof Character) {
 return addConstantInteger(((Character) value).charValue());

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

/**
 * @throws IgniteCheckedException if failed.
 */
@Test
public void testBadHashObjectKey() throws IgniteCheckedException {
  IgniteCache<BadHashKeyObject, Byte> cache = jcache(BadHashKeyObject.class, Byte.class);
  cache.put(new BadHashKeyObject("test_key1"), (byte)1);
  cache.put(new BadHashKeyObject("test_key0"), (byte)10);
  cache.put(new BadHashKeyObject("test_key1"), (byte)7);
  assertEquals(10, cache.query(new SqlQuery<BadHashKeyObject, Byte>(Byte.class, "_key = ?").
    setArgs(new BadHashKeyObject("test_key0"))).getAll().get(0).getValue().intValue());
}

相关文章