org.jdiameter.common.impl.validation
Class AvpRepresentationImpl

java.lang.Object
  extended by org.jdiameter.common.impl.validation.AvpRepresentationImpl
All Implemented Interfaces:
AvpRepresentation

public class AvpRepresentationImpl
extends java.lang.Object
implements AvpRepresentation

Implementation of AvpRepresentation interface.

Since:
1.5.4.0-build404
Author:
Bartosz Baranowski , Alexandre Mendonca

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jdiameter.api.validation.AvpRepresentation
AvpRepresentation.Rule, AvpRepresentation.Type
 
Field Summary
protected  boolean _mandatory
           
protected  boolean _protected
           
protected  boolean allowed
           
protected  java.util.List<AvpRepresentation> children
           
protected  int code
           
protected  java.lang.String description
           
protected  boolean grouped
           
protected  boolean mayEncrypt
           
protected  java.lang.String multiplicityIndicator
           
protected  java.lang.String name
           
protected  java.lang.String ruleMandatory
           
protected  java.lang.String ruleProtected
           
protected  java.lang.String ruleVendorBit
           
protected  java.lang.String type
           
protected  long vendor
           
protected  boolean weak
           
 
Fields inherited from interface org.jdiameter.api.validation.AvpRepresentation
_DEFAULT_MANDATORY, _DEFAULT_PROTECTED, _DEFAULT_VENDOR, _FIX_POSITION_INDEX, _MP_NOT_ALLOWED, _MP_ONE, _MP_ONE_AND_MORE, _MP_ZERO_OR_MORE, _MP_ZERO_OR_ONE
 
Constructor Summary
AvpRepresentationImpl()
           
AvpRepresentationImpl(AvpRepresentationImpl clone)
           
AvpRepresentationImpl(int positionIndex, int code, long vendor, java.lang.String multiplicityIndicator, java.lang.String name)
           
AvpRepresentationImpl(int code, long vendor)
          This constructor is used my validator to lookup correct representation.
AvpRepresentationImpl(int code, long vendor, java.lang.String name)
           
AvpRepresentationImpl(java.lang.String name, long vendor)
          Constructor used to represent weak children.
AvpRepresentationImpl(java.lang.String name, java.lang.String description, int code, boolean mayEncrypt, java.lang.String ruleMandatory, java.lang.String ruleProtected, java.lang.String ruleVendorBit, long vendorId, java.lang.String type)
           
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
static int get_FIX_POSITION_INDEX()
           
 java.util.List<AvpRepresentation> getChildren()
           
 int getCode()
           
 java.lang.String getDescription()
           
 java.lang.String getMultiplicityIndicator()
           
 java.lang.String getName()
           
 int getPositionIndex()
           
 java.lang.String getRuleMandatory()
           
 int getRuleMandatoryAsInt()
           
 java.lang.String getRuleProtected()
           
 int getRuleProtectedAsInt()
           
 java.lang.String getRuleVendorBit()
           
 int getRuleVendorBitAsInt()
           
 java.lang.String getType()
           
 long getVendorId()
           
 int hashCode()
           
 boolean isAllowed()
           
 boolean isAllowed(int avpCode)
           
 boolean isAllowed(int avpCode, long vendorId)
           
 boolean isCountValidForMultiplicity(AvpSet destination, int numberToAdd)
           
 boolean isCountValidForMultiplicity(int avpCount)
           
 boolean isGrouped()
           
 boolean isMandatory()
           
 boolean isMayEncrypt()
           
 boolean isPositionFixed()
           
 boolean isProtected()
           
 boolean isWeak()
           
 void markFixPosition(int index)
           
 void markWeak(boolean isWeak)
           
 void setChildren(java.util.List<AvpRepresentation> children)
           
 void setCode(int code)
           
 void setGrouped(boolean grouped)
           
 void setMultiplicityIndicator(java.lang.String multiplicityIndicator)
           
 void setName(java.lang.String name)
           
 void setVendorId(long vendor)
           
 java.lang.String toString()
           
 void validate(Avp avp)
           
 void validate(AvpSet avpSet)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

description

protected java.lang.String description

mayEncrypt

protected boolean mayEncrypt

_protected

protected boolean _protected

_mandatory

protected boolean _mandatory

ruleMandatory

protected java.lang.String ruleMandatory

ruleProtected

protected java.lang.String ruleProtected

ruleVendorBit

protected java.lang.String ruleVendorBit

type

protected java.lang.String type

code

protected int code

vendor

protected long vendor

allowed

protected boolean allowed

multiplicityIndicator

protected java.lang.String multiplicityIndicator

name

protected java.lang.String name

grouped

protected boolean grouped

children

protected java.util.List<AvpRepresentation> children

weak

protected boolean weak
Constructor Detail

AvpRepresentationImpl

public AvpRepresentationImpl(AvpRepresentationImpl clone)

AvpRepresentationImpl

public AvpRepresentationImpl()

AvpRepresentationImpl

public AvpRepresentationImpl(java.lang.String name,
                             long vendor)
Constructor used to represent weak children. - weak means its only defined by name in some other AVP. After configuration parse procedure is complete weak children are resolved. Weak children should not be stored in Set or any other has structure, its due to nature of hashing, which is done on vendor and code, which for weak children is always different than fully defined AVP representation.
This constructor should be generally used by extending classes, as well as no argument constructor.

Parameters:
name -
vendor -

AvpRepresentationImpl

public AvpRepresentationImpl(int code,
                             long vendor)
This constructor is used my validator to lookup correct representation. Its hash and equals methods will match to fully populated avp representation in any data structure

Parameters:
code -
vendor -

AvpRepresentationImpl

public AvpRepresentationImpl(int positionIndex,
                             int code,
                             long vendor,
                             java.lang.String multiplicityIndicator,
                             java.lang.String name)

AvpRepresentationImpl

public AvpRepresentationImpl(int code,
                             long vendor,
                             java.lang.String name)

AvpRepresentationImpl

public AvpRepresentationImpl(java.lang.String name,
                             java.lang.String description,
                             int code,
                             boolean mayEncrypt,
                             java.lang.String ruleMandatory,
                             java.lang.String ruleProtected,
                             java.lang.String ruleVendorBit,
                             long vendorId,
                             java.lang.String type)
Method Detail

isPositionFixed

public boolean isPositionFixed()
Specified by:
isPositionFixed in interface AvpRepresentation

markFixPosition

public void markFixPosition(int index)

isCountValidForMultiplicity

public boolean isCountValidForMultiplicity(AvpSet destination,
                                           int numberToAdd)
Specified by:
isCountValidForMultiplicity in interface AvpRepresentation

isCountValidForMultiplicity

public boolean isCountValidForMultiplicity(int avpCount)
Specified by:
isCountValidForMultiplicity in interface AvpRepresentation

get_FIX_POSITION_INDEX

public static int get_FIX_POSITION_INDEX()

getPositionIndex

public int getPositionIndex()
Specified by:
getPositionIndex in interface AvpRepresentation

getCode

public int getCode()
Specified by:
getCode in interface AvpRepresentation

getVendorId

public long getVendorId()
Specified by:
getVendorId in interface AvpRepresentation

isAllowed

public boolean isAllowed()
Specified by:
isAllowed in interface AvpRepresentation

isAllowed

public boolean isAllowed(int avpCode,
                         long vendorId)
Specified by:
isAllowed in interface AvpRepresentation

isAllowed

public boolean isAllowed(int avpCode)
Specified by:
isAllowed in interface AvpRepresentation

getMultiplicityIndicator

public java.lang.String getMultiplicityIndicator()
Specified by:
getMultiplicityIndicator in interface AvpRepresentation

getName

public java.lang.String getName()
Specified by:
getName in interface AvpRepresentation

isGrouped

public boolean isGrouped()
Specified by:
isGrouped in interface AvpRepresentation

setGrouped

public void setGrouped(boolean grouped)

getChildren

public java.util.List<AvpRepresentation> getChildren()
Specified by:
getChildren in interface AvpRepresentation

setChildren

public void setChildren(java.util.List<AvpRepresentation> children)

setCode

public void setCode(int code)

setVendorId

public void setVendorId(long vendor)

setMultiplicityIndicator

public void setMultiplicityIndicator(java.lang.String multiplicityIndicator)

setName

public void setName(java.lang.String name)

isWeak

public boolean isWeak()
Specified by:
isWeak in interface AvpRepresentation

markWeak

public void markWeak(boolean isWeak)

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface AvpRepresentation

isMayEncrypt

public boolean isMayEncrypt()
Specified by:
isMayEncrypt in interface AvpRepresentation

getRuleMandatory

public java.lang.String getRuleMandatory()
Specified by:
getRuleMandatory in interface AvpRepresentation

getRuleMandatoryAsInt

public int getRuleMandatoryAsInt()
Specified by:
getRuleMandatoryAsInt in interface AvpRepresentation

getRuleProtected

public java.lang.String getRuleProtected()
Specified by:
getRuleProtected in interface AvpRepresentation

getRuleProtectedAsInt

public int getRuleProtectedAsInt()
Specified by:
getRuleProtectedAsInt in interface AvpRepresentation

getRuleVendorBit

public java.lang.String getRuleVendorBit()
Specified by:
getRuleVendorBit in interface AvpRepresentation

getRuleVendorBitAsInt

public int getRuleVendorBitAsInt()
Specified by:
getRuleVendorBitAsInt in interface AvpRepresentation

getType

public java.lang.String getType()
Specified by:
getType in interface AvpRepresentation

isProtected

public boolean isProtected()
Specified by:
isProtected in interface AvpRepresentation

isMandatory

public boolean isMandatory()
Specified by:
isMandatory in interface AvpRepresentation

validate

public void validate(Avp avp)
              throws AvpNotAllowedException
Specified by:
validate in interface AvpRepresentation
Throws:
AvpNotAllowedException

validate

public void validate(AvpSet avpSet)
              throws AvpNotAllowedException
Specified by:
validate in interface AvpRepresentation
Throws:
AvpNotAllowedException

toString

public java.lang.String toString()
Specified by:
toString in interface AvpRepresentation
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface AvpRepresentation
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface AvpRepresentation
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface AvpRepresentation
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException


Copyright © 2014. All Rights Reserved.