Interface YTreeNode

    • Method Detail

      • getAttributes

        java.util.Map<java.lang.String,​YTreeNode> getAttributes()
        Get attribute map of an object. Return empty map if object doesn't have attributes.
      • clearAttributes

        void clearAttributes()
      • containsAttributes

        boolean containsAttributes()
      • containsAttribute

        boolean containsAttribute​(java.lang.String key)
      • removeAttribute

        java.util.Optional<YTreeNode> removeAttribute​(java.lang.String key)
      • putAttribute

        java.util.Optional<YTreeNode> putAttribute​(java.lang.String key,
                                                   YTreeNode value)
      • attributeKeys

        default java.util.Set<java.lang.String> attributeKeys()
      • attributeValues

        default java.util.Collection<YTreeNode> attributeValues()
      • getAttribute

        java.util.Optional<YTreeNode> getAttribute​(java.lang.String key)
      • getAttributeOrThrow

        YTreeNode getAttributeOrThrow​(java.lang.String key)
      • getAttributeOrThrow

        YTreeNode getAttributeOrThrow​(java.lang.String key,
                                      java.util.function.Supplier<java.lang.String> createMessage)
      • cast

        default <T extends YTreeNode> T cast()
      • asList

        default java.util.List<YTreeNode> asList()
        Get list value assuming node contains it.
        Throws:
        java.lang.RuntimeException - if node is not integral.
      • asMap

        default java.util.Map<java.lang.String,​YTreeNode> asMap()
        Get map value assuming node contains it.
        Throws:
        java.lang.RuntimeException - if node is not integral.
      • longValue

        default long longValue()
        Get integral value assuming node contains it. Can be used with nodes containing unsigned integral value in that case returned value should be interpreted as bit representation of unsigned value and `Long.*Unsigned*` methods can be used to work with it.
        Throws:
        java.lang.RuntimeException - if node is not integral.
        See Also:
        Long
      • intValue

        default int intValue()
        Shortcut for `(int) node.getLong()`
        See Also:
        longValue()
      • doubleValue

        default double doubleValue()
        Get floating point value assuming node contains it.
        Throws:
        java.lang.RuntimeException - if node is of unexpected type.
      • floatValue

        default float floatValue()
      • boolValue

        default boolean boolValue()
        Get boolean value assuming node contains it.
        Throws:
        java.lang.RuntimeException - if node is of an unexpected type.
      • stringValue

        default java.lang.String stringValue()
        Get string value assuming node is string-like. If node contains binary data it would be interpreted as UTF8 string like String(byte[], Charset) does.
        Throws:
        java.lang.RuntimeException - if node is of an unexpected type.
      • bytesValue

        default byte[] bytesValue()
        Get bytes value assuming node is string-like. If node was constructed with String object UTF8 representation of string is returned.
        Throws:
        java.lang.RuntimeException - if node is of an unexpected type.
      • isListNode

        default boolean isListNode()
        Check if node contains list value.
      • isMapNode

        default boolean isMapNode()
        Check if node contains map value.
      • isBooleanNode

        default boolean isBooleanNode()
        Check if node contains boolean value.
      • isIntegerNode

        default boolean isIntegerNode()
        Check if node contains signed or unsigned integral value. Note: value of integer node always fits Java's long type but not always fit Java's int type.
      • isDoubleNode

        default boolean isDoubleNode()
        Check if node contains signed or unsigned integral value. Note, it doesn't mean that value fits Java's int type.
      • isStringNode

        default boolean isStringNode()
        Check if node contains string-like value. Note, string-like value can contain arbitrary byte sequence.
      • isEntityNode

        default boolean isEntityNode()
        Check if node contains null (or entity) value.
      • toBinary

        byte[] toBinary()
        Get binary yson representation of value.
        See Also:
        YsonBinaryWriter