com.latencybusters.lbm.sdm
Class LBMSDMFields

java.lang.Object
  extended by com.latencybusters.lbm.sdm.LBMSDM
      extended by com.latencybusters.lbm.sdm.LBMSDMFields
All Implemented Interfaces:
java.lang.Cloneable

public class LBMSDMFields
extends LBMSDM
implements java.lang.Cloneable

LBMSDMFields is a utility class for LBMSDMessage to collect a set of fields. The intent of separating the set of fields from LBMSDMessage is to encourage reuse of the field set.


Field Summary
 
Fields inherited from class com.latencybusters.lbm.sdm.LBMSDM
DEBUG_BASIC, debug_level, DEBUG_VERBOSE_PARSING
 
Constructor Summary
LBMSDMFields()
          Constructor for an empty field set.
LBMSDMFields(LBMSDMFieldsAttribute user_attr)
          Constructor for an empty field set.
 
Method Summary
 void add(LBMSDMField newfield)
          Add an SDM field to the field set
 LBMSDMFields clone()
          Get a copy of this object
 LBMSDMFieldsAttribute get_attr()
          Get the field set attributes are associated with this message A copy is returned
 LBMSDMField get(int pos)
          Get a field by the index
 java.util.Iterator iterator()
          Get the default iterator for this field set
 int length()
          Get the number of fields in the field set
 LBMSDMField locate(java.lang.String name)
          Get a field in the field set based on the name.
 void remove(int pos)
          Remove a field by specifying the index
 void remove(java.lang.String name)
          Remove a field by specifying the name
 void set(LBMSDMField field)
          Overwrite/set an existing field based on the name
 void set(LBMSDMField field, int idx)
          Overwrite/set an existing field based on the field set index
 void set(LBMSDMField newfield, int fieldidx, int arrayidx)
          Overwrite/set an existing field based on the field set index and array element
 java.lang.String toDbgString()
          Dump the internal representation of this field set which includes the fields.
 java.lang.String toString()
          Dump the string representation of this field set which includes the fields.
 
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDM
log, set_debug_level
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LBMSDMFields

public LBMSDMFields()
Constructor for an empty field set.


LBMSDMFields

public LBMSDMFields(LBMSDMFieldsAttribute user_attr)
Constructor for an empty field set.

Parameters:
user_attr - User attribute object setting options for this field set
Method Detail

add

public void add(LBMSDMField newfield)
         throws LBMSDMException
Add an SDM field to the field set

Parameters:
newfield - The new field to be added
Throws:
LBMSDMDuplicateFieldException - when adding a field with the same name as a field already in the field set
LBMSDMException - when an unexpected error occurs within LBMSDM

set

public void set(LBMSDMField field)
         throws LBMSDMException
Overwrite/set an existing field based on the name

Parameters:
field - The new field value
Throws:
LBMSDMAddingFieldException - when the field doesn't exist
LBMSDMException

set

public void set(LBMSDMField field,
                int idx)
         throws LBMSDMException
Overwrite/set an existing field based on the field set index

Parameters:
field - The new field value
idx - The index into the field set of the field
Throws:
LBMSDMAddingFieldException - when the field doesn't exist
LBMSDMTypeMismatchException - when the field isnt the same type as the element
LBMSDMException

set

public void set(LBMSDMField newfield,
                int fieldidx,
                int arrayidx)
         throws LBMSDMException
Overwrite/set an existing field based on the field set index and array element

Parameters:
newfield - The new field value
fieldidx - The index into the field set of the field
arrayidx - The element in the array to be set
Throws:
LBMSDMAddingFieldException - when the field doesn't exist
LBMSDMTypeMismatchException - when the field isnt the same type as the element
LBMSDMException

length

public int length()
Get the number of fields in the field set

Returns:
The number of fields in the field set

get

public LBMSDMField get(int pos)
Get a field by the index

Parameters:
pos - The index of the field required
Returns:
The LBMSDMField object

get_attr

public LBMSDMFieldsAttribute get_attr()
Get the field set attributes are associated with this message A copy is returned

Returns:
LBMSDMFieldsAttribute object

remove

public void remove(int pos)
Remove a field by specifying the index

Parameters:
pos - The index of the field

remove

public void remove(java.lang.String name)
Remove a field by specifying the name

Parameters:
name - The field name to be removed

iterator

public java.util.Iterator iterator()
Get the default iterator for this field set

Returns:
An Iterator of type LBMSDMFieldIterator

toString

public java.lang.String toString()
Dump the string representation of this field set which includes the fields.

Overrides:
toString in class java.lang.Object
Returns:
A string

toDbgString

public java.lang.String toDbgString()
Dump the internal representation of this field set which includes the fields.

Returns:
A string

clone

public LBMSDMFields clone()
                   throws java.lang.CloneNotSupportedException
Get a copy of this object

Overrides:
clone in class java.lang.Object
Returns:
A new object with a copy
Throws:
java.lang.CloneNotSupportedException

locate

public LBMSDMField locate(java.lang.String name)
Get a field in the field set based on the name. Note calling locate() many times on the same message is not optimal. When processing multiple fields in a message, looping through by index and comparing the name may be more efficient, eliminating unnecessary string compares.

Parameters:
name - The name of the field to be searched for.
Returns:
the LBMSDMField or null


All of the documentation and software included in this and any other Informatica Inc "Ultra Messaging" Release is Copyright (C) 2004-2014, Informatica Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted only as covered by the terms of a valid software license agreement with 29West Inc. Copyright © 2004-2014, Informatica, Inc. All Rights Reserved.