当前位置: 首页>>代码示例>>Java>>正文


Java UnsignedLongs.parseUnsignedLong方法代码示例

本文整理汇总了Java中com.google.common.primitives.UnsignedLongs.parseUnsignedLong方法的典型用法代码示例。如果您正苦于以下问题:Java UnsignedLongs.parseUnsignedLong方法的具体用法?Java UnsignedLongs.parseUnsignedLong怎么用?Java UnsignedLongs.parseUnsignedLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.primitives.UnsignedLongs的用法示例。


在下文中一共展示了UnsignedLongs.parseUnsignedLong方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseUnsignedLong

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
public static long parseUnsignedLong(String st, TExecutionContext context)
{
    Object truncated = CastUtils.truncateNonDigits(st, context);

    if (truncated instanceof String)
        st = (String)truncated;
    else
        st = CastUtils.truncateNonDigitPlainString(((BigDecimal)truncated).toPlainString(),
                                                   context);

    long value;
    try 
    {
        value = UnsignedLongs.parseUnsignedLong(st);
    } catch (NumberFormatException e) { // overflow error
        context.reportOverflow(e.getMessage());

        // check wether the value is too big or too small
        if (st.charAt(0) == '-')
            value = 0;
        else
            value = UnsignedLongs.MAX_VALUE;
    }
    return value;
}
 
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:26,代码来源:CastUtils.java

示例2: parseSpanId

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
private SpanId parseSpanId(String input) {
  try {
    return new SpanId(UnsignedLongs.parseUnsignedLong(input));
  } catch (NumberFormatException ex) {
    return SpanId.invalid();
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:cloud-trace-java,代码行数:8,代码来源:SpanContextFactory.java

示例3: parseUnsignedLong

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
private long parseUnsignedLong(String id) {
  if (id == null) {
    return 0;
  }
  return UnsignedLongs.parseUnsignedLong(id, 16);
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:7,代码来源:SpanTranslator.java

示例4: decode

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
public static long decode(String uuid) {
    return UnsignedLongs.parseUnsignedLong(uuid, 16);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:4,代码来源:TableUuidFormat.java

示例5: readCollating

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
@Override
public void readCollating(ValueSource in, TInstance typeInstance, ValueTarget out) {
    BigInteger asBigint = (BigInteger) in.getObject();
    long asLong = UnsignedLongs.parseUnsignedLong(asBigint.toString());
    out.putInt64(asLong);
}
 
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:7,代码来源:MNumeric.java

示例6: protoFromSoy

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
@Override
Object protoFromSoy(SoyValue field) {
  return UnsignedLongs.parseUnsignedLong(field.stringValue());
}
 
开发者ID:google,项目名称:closure-templates,代码行数:5,代码来源:FieldInterpreter.java

示例7: parse

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
@Override
public UUID parse(String uuid) {
    checkArgument(uuid.length() == 32, "Not an UUID: " + uuid);
    return new UUID(UnsignedLongs.parseUnsignedLong(uuid.substring(0, 16), 16),
            UnsignedLongs.parseUnsignedLong(uuid.substring(16), 16));
}
 
开发者ID:Minecrell,项目名称:ServerListPlus,代码行数:7,代码来源:UUIDs.java

示例8: fromHex

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
/**
 * Converts a string from hex to long.
 *
 * @param string hex number in string form; sans 0x
 * @return long value
 */
public static long fromHex(String string) {
    return UnsignedLongs.parseUnsignedLong(string, 16);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:Tools.java

示例9: fromHex

import com.google.common.primitives.UnsignedLongs; //导入方法依赖的package包/类
/**
 * Converts a string from hex to long.
 *
 * @param string
 *            hex number in string form; sans 0x
 * @return long value
 */
public static long fromHex(String string) {
	return UnsignedLongs.parseUnsignedLong(string, 16);
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:11,代码来源:AtriumTools.java


注:本文中的com.google.common.primitives.UnsignedLongs.parseUnsignedLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。