Package net.anotheria.anodoc.data
Class ListProperty
- java.lang.Object
-
- net.anotheria.anodoc.data.DataHolder
-
- net.anotheria.anodoc.data.Property
-
- net.anotheria.anodoc.data.ListProperty
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,IBasicStoreableObject,IPlainDataObject
public class ListProperty extends Property
This property hold the list of Properties.- Since:
- 1.0
- Version:
- $Id: $Id
- Author:
- another
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ListProperty(java.lang.String name)Creates a new ListProperty with the given name and an empty list as data.ListProperty(java.lang.String name, java.util.List<Property> aList)Creates a new ListProperty with the given name and the given list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Property p)Adds the property p to the current list at position index (equal to java.util.List.set(index, object)voidadd(Property p)Adds the property p to the current list.protected java.lang.ObjectcloneValue()cloneValue.Propertyget(int index)Returns the Property at position specified by index.java.util.List<Property>getList()Returns the underlying list as java.util.Listjava.util.List<java.lang.Object>getListData()getListData.PropertyTypegetPropertyType()getPropertyType.longgetSizeInBytes()The 'size' of a DataHolder is needed for the quota calculation.
The size of an atomic DataHolder like a Property should be the real amount of bytes it uses, whether the size of complex objects should be cumulated.
The overhead for administration shouldn't be counted (i.e.voidremove(int index)Remove the property at position index from this list.voidremove(Property p)Removes the given property from this list.net.anotheria.util.xml.XMLNodetoXMLNode()Creates an xml node for export.-
Methods inherited from class net.anotheria.anodoc.data.Property
clone, cloneAs, equals, getName, getStorageId, getValue, setValue, toString
-
Methods inherited from class net.anotheria.anodoc.data.DataHolder
getId, hashCode, setId
-
-
-
-
Constructor Detail
-
ListProperty
public ListProperty(java.lang.String name)
Creates a new ListProperty with the given name and an empty list as data.- Parameters:
name- aStringobject.
-
ListProperty
public ListProperty(java.lang.String name, java.util.List<Property> aList)Creates a new ListProperty with the given name and the given list. The list should only contain Property objects.
Warning: the content of the list parameter will be not explicitely check to contain only Property object, but will cause runtime exceptions later in case it contained something else.- Parameters:
name- aStringobject.aList- aListobject.
-
-
Method Detail
-
getList
public java.util.List<Property> getList()
Returns the underlying list as java.util.List- Returns:
- a
Listobject.
-
get
public Property get(int index)
Returns the Property at position specified by index.- Parameters:
index- a int.- Returns:
- a
Propertyobject.
-
add
public void add(int index, Property p)Adds the property p to the current list at position index (equal to java.util.List.set(index, object)- Parameters:
index- a int.p- aPropertyobject.
-
add
public void add(Property p)
Adds the property p to the current list.- Parameters:
p- aPropertyobject.
-
remove
public void remove(Property p)
Removes the given property from this list. If the same property is contained in the list more then one time, only the first occurence of the property will be removed.- Parameters:
p- aPropertyobject.
-
remove
public void remove(int index)
Remove the property at position index from this list.- Parameters:
index- a int.
-
getSizeInBytes
public long getSizeInBytes()
The 'size' of a DataHolder is needed for the quota calculation.
The size of an atomic DataHolder like a Property should be the real amount of bytes it uses, whether the size of complex objects should be cumulated.
The overhead for administration shouldn't be counted (i.e. the size of an IntProperty is the amount of bytes needed to store the int value itself, not the amount of bytes needed to store the DataHolder object). Returns the cumulative size of contained properties. The ListProperty itself is not counted.- Specified by:
getSizeInBytesin classDataHolder- Returns:
- a long.
-
getListData
public java.util.List<java.lang.Object> getListData()
getListData.
- Returns:
- a
Listobject.
-
cloneValue
protected java.lang.Object cloneValue() throws java.lang.CloneNotSupportedExceptioncloneValue.
- Specified by:
cloneValuein classProperty- Returns:
- a
Objectobject. - Throws:
java.lang.CloneNotSupportedException- if any.
-
toXMLNode
public net.anotheria.util.xml.XMLNode toXMLNode()
Creates an xml node for export.
-
getPropertyType
public PropertyType getPropertyType()
getPropertyType.
- Specified by:
getPropertyTypein classProperty- Returns:
- a
PropertyTypeobject.
-
-