net.kano.joscar.ssiitem
Class AbstractItemObj

java.lang.Object
  extended byAbstractItemObj
All Implemented Interfaces:
SsiItemObj
Direct Known Subclasses:
BuddyItem, GroupItem, IconItem, PrivacyItem, RootItem, SimpleNamedItem, VisibilityItem

public abstract class AbstractItemObj
extends java.lang.Object
implements SsiItemObj

A base class for each of the item object classes provided in this package.


Constructor Summary
protected AbstractItemObj()
          Creates a new item object with no extra TLV's.
protected AbstractItemObj(TlvChain extraTlvs)
          Creates a new item object with the given set of unprocessed or otherwise unrecognized TLV's in this item's type-specific TLV list.
 
Method Summary
protected  void addExtraTlvs(TlvChain extraTlvs)
          Adds the given list of TLV's to this item's list of extra TLV's.
protected  TlvChain copyExtraTlvs()
          Returns a copy of this item's extra TLV's, or null if this item's extra TLV list is null.
protected  SsiItem generateItem(java.lang.String name, int parentid, int subid, int type, TlvChain customTlvs)
          Generates a new SsiItem from this item object with the given properties.
static SsiItem[] generateSsiItems(SsiItemObj[] itemObjs)
          Returns a list of SsiItems generated from the item objects given in itemObjs.
 MutableTlvChain getExtraTlvs()
          Returns the "extra TLV list" for this item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface SsiItemObj
toSsiItem
 

Constructor Detail

AbstractItemObj

protected AbstractItemObj()
Creates a new item object with no extra TLV's. Using this constructor is equivalent to using new AbstractItemObj(null).


AbstractItemObj

protected AbstractItemObj(TlvChain extraTlvs)
Creates a new item object with the given set of unprocessed or otherwise unrecognized TLV's in this item's type-specific TLV list.

Parameters:
extraTlvs - the extra TLV's in this item
Method Detail

generateSsiItems

public static SsiItem[] generateSsiItems(SsiItemObj[] itemObjs)
Returns a list of SsiItems generated from the item objects given in itemObjs.

Parameters:
itemObjs - a list of item objects to use in generating the returned list of SsiItems
Returns:
a list of SsiItems generated from the given list of item objects
See Also:
SsiItemObj.toSsiItem()

copyExtraTlvs

protected final TlvChain copyExtraTlvs()
Returns a copy of this item's extra TLV's, or null if this item's extra TLV list is null.

Returns:
a copy of this item's extra TLV's

getExtraTlvs

public final MutableTlvChain getExtraTlvs()
Description copied from interface: SsiItemObj
Returns the "extra TLV list" for this item. This list contains the TLV's present in this item's type-specific data block that were not processed into fields; in practice, this likely means fields inserted by another client like WinAIM that joscar does not yet recognize. Note that this value will never be null.

Specified by:
getExtraTlvs in interface SsiItemObj
Returns:
this item's "extra TLV's"

addExtraTlvs

protected final void addExtraTlvs(TlvChain extraTlvs)
Adds the given list of TLV's to this item's list of extra TLV's. Using this method is equivalent to using getExtraTlvs().addAll(extraTlvs).

Parameters:
extraTlvs - the list of TLV's to append to this object's list of extra TLV's

generateItem

protected final SsiItem generateItem(java.lang.String name,
                                     int parentid,
                                     int subid,
                                     int type,
                                     TlvChain customTlvs)
Generates a new SsiItem from this item object with the given properties.

Parameters:
name - the name of the item
parentid - the "parent ID" of this item
subid - the "sub ID" of this item in its parent
type - the type of item, like SsiItem.TYPE_PRIVACY
customTlvs - a list of TLV's to insert into the type-specific data block of the returned item
Returns:
a new SSI item with the given properties