Class TlvInfo<I extends TlvInfo<I,​?,​H>,​V,​H extends TlvHeader>

java.lang.Object
ru.bitel.bgbilling.kernel.network.tlv.TlvInfo<I,​V,​H>
All Implemented Interfaces:
java.lang.Iterable<I>
Direct Known Subclasses:
RadiusAttributeInfo

public abstract class TlvInfo<I extends TlvInfo<I,​?,​H>,​V,​H extends TlvHeader>
extends java.lang.Object
implements java.lang.Iterable<I>
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected I[] children  
    protected java.util.List<I> childrenList  
    protected java.util.Map<java.lang.Integer,​I> childrenMap  
    java.lang.String name  
    protected java.util.Map<java.lang.String,​I> nameChildrenMap  
    protected int paramLengthLength  
    protected int paramTypeLength  
    protected I parent  
    int type  
    static int TYPE_ABINARY  
    static int TYPE_BYTE  
    static int TYPE_DOUBLE  
    static int TYPE_FLOAT  
    static int TYPE_INTEGER  
    static int TYPE_IPADDR  
    static int TYPE_IPV6ADDR  
    static int TYPE_IPV6PREFIX  
    static int TYPE_LONG  
    static int TYPE_OCTETS  
    static int TYPE_SHORT  
    static int TYPE_STRING  
    static int TYPE_TLV  
    int valueType  
  • Constructor Summary

    Constructors
    Constructor Description
    TlvInfo​(java.lang.Class<?> clazz, int type, java.lang.String name, int valueType, int paramTypeSize, int paramLengthSize, java.util.List<I> children)  
  • Method Summary

    Modifier and Type Method Description
    I getChild​(int type)  
    I getChild​(java.lang.String name)  
    java.util.Iterator<I> iterator()  
    abstract Tlv<?,​?> read​(java.nio.ByteBuffer bb, H header)  
    void readTypeLength​(java.nio.ByteBuffer bb, H header, int parentLength, boolean headerInLength)
    Считывание типа и длины.
    void setParent​(I parent)  
    protected java.nio.ByteBuffer sliceData​(java.nio.ByteBuffer bb, int length)
    Получения ByteBuffer содержащего data
    abstract V unwrapValue​(java.nio.ByteBuffer data)  
    java.lang.String valueToString​(Tlv<?,​V> attribute)  
    abstract java.nio.ByteBuffer wrapValue​(V value)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

    • TYPE_OCTETS

      public static final int TYPE_OCTETS
      See Also:
      Constant Field Values
    • TYPE_STRING

      public static final int TYPE_STRING
      See Also:
      Constant Field Values
    • TYPE_LONG

      public static final int TYPE_LONG
      See Also:
      Constant Field Values
    • TYPE_INTEGER

      public static final int TYPE_INTEGER
      See Also:
      Constant Field Values
    • TYPE_SHORT

      public static final int TYPE_SHORT
      See Also:
      Constant Field Values
    • TYPE_BYTE

      public static final int TYPE_BYTE
      See Also:
      Constant Field Values
    • TYPE_DOUBLE

      public static final int TYPE_DOUBLE
      See Also:
      Constant Field Values
    • TYPE_FLOAT

      public static final int TYPE_FLOAT
      See Also:
      Constant Field Values
    • TYPE_TLV

      public static final int TYPE_TLV
      See Also:
      Constant Field Values
    • TYPE_IPADDR

      public static final int TYPE_IPADDR
      See Also:
      Constant Field Values
    • TYPE_ABINARY

      public static final int TYPE_ABINARY
      See Also:
      Constant Field Values
    • TYPE_IPV6ADDR

      public static final int TYPE_IPV6ADDR
      See Also:
      Constant Field Values
    • TYPE_IPV6PREFIX

      public static final int TYPE_IPV6PREFIX
      See Also:
      Constant Field Values
    • paramTypeLength

      protected final int paramTypeLength
    • paramLengthLength

      protected final int paramLengthLength
    • type

      public final int type
    • name

      public final java.lang.String name
    • valueType

      public final int valueType
    • parent

      protected I extends TlvInfo<I,​?,​H> parent
    • childrenList

      protected final java.util.List<I extends TlvInfo<I,​?,​H>> childrenList
    • children

      protected final I extends TlvInfo<I,​?,​H>[] children
    • childrenMap

      protected final java.util.Map<java.lang.Integer,​I extends TlvInfo<I,​?,​H>> childrenMap
    • nameChildrenMap

      protected final java.util.Map<java.lang.String,​I extends TlvInfo<I,​?,​H>> nameChildrenMap
  • Constructor Details

    • TlvInfo

      public TlvInfo​(java.lang.Class<?> clazz, int type, java.lang.String name, int valueType, int paramTypeSize, int paramLengthSize, java.util.List<I> children)
  • Method Details

    • setParent

      public void setParent​(I parent)
    • getChild

      public I getChild​(int type)
    • getChild

      public I getChild​(java.lang.String name)
    • iterator

      public java.util.Iterator<I> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<I extends TlvInfo<I,​?,​H>>
    • read

      public abstract Tlv<?,​?> read​(java.nio.ByteBuffer bb, H header)
    • unwrapValue

      public abstract V unwrapValue​(java.nio.ByteBuffer data)
    • wrapValue

      public abstract java.nio.ByteBuffer wrapValue​(V value)
    • valueToString

      public java.lang.String valueToString​(Tlv<?,​V> attribute)
    • sliceData

      protected final java.nio.ByteBuffer sliceData​(java.nio.ByteBuffer bb, int length)
      Получения ByteBuffer содержащего data
      Parameters:
      bb -
      length -
      Returns:
    • readTypeLength

      public void readTypeLength​(java.nio.ByteBuffer bb, H header, int parentLength, boolean headerInLength)
      Считывание типа и длины. Обычно это производится родительской веткой, т.к. она знает какой размер у полей типа и длина.
      Частный случай родительской ветки - vendor
      Parameters:
      bb -
      header -
      parentLength -
      headerInLength -