Interface NumberNode

All Superinterfaces:
Node, ValueNode
All Known Implementing Classes:
BigDecimalNode, BigIntegerNode, DoubleNode, FloatNode, IntNode, LongNode

public sealed interface NumberNode extends ValueNode permits IntNode, LongNode, FloatNode, DoubleNode, BigIntegerNode, BigDecimalNode

NumberNode (语义标记接口)

同时移除 asXXX 上的 throws NumberFormatException (因为不可能发生)

Version:
0.0.1
Author:
scx567888
  • Method Summary

    Modifier and Type
    Method
    Description
    转换为 BigDecimal
    转换为 BigInteger (不保证精度, 可能会发生截断)
    boolean
    转换为 boolean
    double
    转换为 double (不保证精度, 可能会发生截断)
    float
    转换为 float (不保证精度, 可能会发生截断)
    int
    转换为 int (不保证精度, 可能会发生截断)
    long
    转换为 long (不保证精度, 可能会发生截断)
    转换为 String
     

    Methods inherited from interface cool.scx.object.node.Node

    isNull
  • Method Details

    • asInt

      int asInt()
      Description copied from interface: ValueNode
      转换为 int (不保证精度, 可能会发生截断)
      Specified by:
      asInt in interface ValueNode
      Returns:
      int
    • asLong

      long asLong()
      Description copied from interface: ValueNode
      转换为 long (不保证精度, 可能会发生截断)
      Specified by:
      asLong in interface ValueNode
      Returns:
      long
    • asFloat

      float asFloat()
      Description copied from interface: ValueNode
      转换为 float (不保证精度, 可能会发生截断)
      Specified by:
      asFloat in interface ValueNode
      Returns:
      float
    • asDouble

      double asDouble()
      Description copied from interface: ValueNode
      转换为 double (不保证精度, 可能会发生截断)
      Specified by:
      asDouble in interface ValueNode
      Returns:
      double
    • asBigInteger

      BigInteger asBigInteger()
      Description copied from interface: ValueNode
      转换为 BigInteger (不保证精度, 可能会发生截断)
      Specified by:
      asBigInteger in interface ValueNode
      Returns:
      BigInteger
    • asBigDecimal

      BigDecimal asBigDecimal()
      Description copied from interface: ValueNode
      转换为 BigDecimal
      Specified by:
      asBigDecimal in interface ValueNode
      Returns:
      BigDecimal
    • asText

      String asText()
      Description copied from interface: ValueNode
      转换为 String
      Specified by:
      asText in interface ValueNode
      Returns:
      String
    • asBoolean

      boolean asBoolean()
      Description copied from interface: ValueNode

      转换为 boolean

      对于 数值类型 value != 0 对于 文本类型 "true".equalsIgnoreCase(s)

      Specified by:
      asBoolean in interface ValueNode
      Returns:
      boolean
    • deepCopy

      NumberNode deepCopy()
      Specified by:
      deepCopy in interface Node
      Specified by:
      deepCopy in interface ValueNode