Joda System API

org.joda.property.impl.collection
Class AbstractListProperty

java.lang.Object
  |
  +--org.joda.property.impl.AbstractModelElement
        |
        +--org.joda.property.impl.AbstractProperty
              |
              +--org.joda.property.impl.collection.AbstractListProperty
All Implemented Interfaces:
java.util.Collection, CollectionProperty, InitializableProperty, java.util.List, ListProperty, ModelElement, Property, Property.Internal, java.io.Serializable
Direct Known Subclasses:
DefaultDataListProperty, DefaultLinkListProperty

public abstract class AbstractListProperty
extends AbstractProperty
implements ListProperty

Standard implementation of a list.

Author:
Stephen Colebourne
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.joda.property.Property
Property.Internal
 
Constructor Summary
AbstractListProperty()
          Constructor
 
Method Summary
 void add(int index, java.lang.Object obj)
           
 boolean add(java.lang.Object obj)
           
 boolean addAll(java.util.Collection coll)
           
 boolean addAll(int index, java.util.Collection coll)
           
 void clear()
           
 boolean contains(java.lang.Object obj)
           
 boolean containsAll(java.util.Collection coll)
           
protected abstract  java.lang.Object convertListObject(java.lang.Object object)
          Check whether the object is valid to add to the list.
 java.lang.Object get(int index)
           
 java.lang.String getContentName()
          Get the name of each of the values in the list
 java.lang.Class getContentType()
          Get the type of each of the values in the list
protected  java.util.List getInternal()
          Get the actual list
 java.lang.Class getPropertyType()
          Get the type of the property.
 int indexOf(java.lang.Object obj)
           
 void initBeanCreated(PropertyInit init)
          Initialise the property after the bean is complete
 void initPropertyCreated(PropertyInit init)
          Initialise the property after the constructor
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 int lastIndexOf(java.lang.Object obj)
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int startIndex)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object obj)
           
 boolean removeAll(java.util.Collection coll)
           
 boolean retainAll(java.util.Collection coll)
           
 java.lang.Object set(int index, java.lang.Object obj)
           
 void set(java.lang.Object propertyValue)
          Set the property's value as an object.
 int size()
           
 java.util.List subList(int startIndex, int endIndex)
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] type)
           
 java.util.Collection toCollection()
          Get the collection underlying the property.
 java.util.List toList()
          Get the list underlying the property.
 java.lang.Object toObject()
          Get the property's value as an object.
 java.lang.String toString()
          Get a debugging string of this object
 
Methods inherited from class org.joda.property.impl.AbstractProperty
addPropertyChangeListener, bean, checkArgumentNotNull, checkModifiable, checkValueNotNull, checkValueNotNull, cloneDeep, convertObject, createClonedProperty, data, equals, equalsValue, firePropertyChange, firePropertyChange, getPropertyName, getThis, hashCode, isModifiable, isNull, isReadOnly, populateClonedProperty, removePropertyChangeListener, setModifiable, setReadOnly, toDataString
 
Methods inherited from class org.joda.property.impl.AbstractModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.joda.property.Property
addPropertyChangeListener, bean, equals, equalsValue, firePropertyChange, getPropertyName, hashCode, isModifiable, isNull, isReadOnly, removePropertyChangeListener, setModifiable, setReadOnly
 
Methods inherited from interface org.joda.property.ModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from interface java.util.Collection
equals, hashCode
 
Methods inherited from interface java.util.List
equals, hashCode
 

Constructor Detail

AbstractListProperty

public AbstractListProperty()
Constructor

Method Detail

initPropertyCreated

public void initPropertyCreated(PropertyInit init)
Initialise the property after the constructor

Specified by:
initPropertyCreated in interface InitializableProperty
Overrides:
initPropertyCreated in class AbstractProperty

initBeanCreated

public void initBeanCreated(PropertyInit init)
Initialise the property after the bean is complete

Specified by:
initBeanCreated in interface InitializableProperty
Overrides:
initBeanCreated in class AbstractProperty

getPropertyType

public java.lang.Class getPropertyType()
Get the type of the property. A method String getFoo() has a property type of String.class.

Specified by:
getPropertyType in interface Property
Returns:
the property type

getInternal

protected java.util.List getInternal()
Get the actual list


convertListObject

protected abstract java.lang.Object convertListObject(java.lang.Object object)
Check whether the object is valid to add to the list. This checks using the list value type.

Throws:
IllegalArgumentPropertyException - if the argument is unacceptable for adding to the list

getContentName

public java.lang.String getContentName()
Get the name of each of the values in the list

Specified by:
getContentName in interface Property
Overrides:
getContentName in class AbstractProperty
Returns:
the name of the list elements

getContentType

public java.lang.Class getContentType()
Get the type of each of the values in the list

Specified by:
getContentType in interface Property
Overrides:
getContentType in class AbstractProperty
Returns:
the type of the objects in the list

toObject

public java.lang.Object toObject()
Description copied from interface: Property
Get the property's value as an object. The object type will be appropriate for the type of property. The object will either be immutable or a clone of the real object.

This method has strong semantics such that where a and b are properties of the same type, it must be true that:
b.set( a.toObject() ); a.equals(b);
In other words, the object contains all the data necessary to recreate the property's value.

Specified by:
toObject in interface Property
Specified by:
toObject in class AbstractProperty
Returns:
an Object representing the property's value
See Also:
Property.toObject()

toCollection

public java.util.Collection toCollection()
Description copied from interface: CollectionProperty
Get the collection underlying the property.

Specified by:
toCollection in interface CollectionProperty
Returns:
the collection (a copy of the data)
See Also:
CollectionProperty.toCollection()

toList

public java.util.List toList()
Description copied from interface: ListProperty
Get the list underlying the property.

Specified by:
toList in interface ListProperty
Returns:
the list (a copy of the data)
See Also:
ListProperty.toList()

toString

public java.lang.String toString()
Get a debugging string of this object

Specified by:
toString in interface Property
Overrides:
toString in class AbstractProperty
Returns:
debugging string

set

public void set(java.lang.Object propertyValue)
Description copied from interface: Property
Set the property's value as an object. The object type should be appropriate for the type of property. If necessary, the object will be cloned before it is stored internally. Implementations will recognise as many types of object passed in as possible. Null should always be accepted, primitive types will be reset back to zero/false.

If a String is passed in, it can be parsed in various ways. If the results of toDataString() are passed in, it must reconstitute the original value.

Specified by:
set in interface Property
Specified by:
set in class AbstractProperty
Parameters:
propertyValue - an Object to set the property's value to
See Also:
Property.set(Object)

set

public java.lang.Object set(int index,
                            java.lang.Object obj)
Specified by:
set in interface java.util.List
See Also:
List.set(int,Object)

add

public boolean add(java.lang.Object obj)
Specified by:
add in interface java.util.Collection
See Also:
List.add(Object)

add

public void add(int index,
                java.lang.Object obj)
Specified by:
add in interface java.util.List
See Also:
List.add(int,Object)

addAll

public boolean addAll(java.util.Collection coll)
Specified by:
addAll in interface java.util.Collection
See Also:
List.addAll(Collection)

addAll

public boolean addAll(int index,
                      java.util.Collection coll)
Specified by:
addAll in interface java.util.List
See Also:
List.addAll(int, Collection)

remove

public java.lang.Object remove(int index)
Specified by:
remove in interface java.util.List
See Also:
List.remove(int)

remove

public boolean remove(java.lang.Object obj)
Specified by:
remove in interface java.util.Collection
See Also:
List.remove(Object)

clear

public void clear()
Specified by:
clear in interface java.util.Collection
See Also:
List.clear()

removeAll

public boolean removeAll(java.util.Collection coll)
Specified by:
removeAll in interface java.util.Collection
See Also:
List.removeAll(Collection)

retainAll

public boolean retainAll(java.util.Collection coll)
Specified by:
retainAll in interface java.util.Collection
See Also:
List.retainAll(Collection)

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.Collection
See Also:
List.iterator()

listIterator

public java.util.ListIterator listIterator()
Specified by:
listIterator in interface java.util.List
See Also:
List.listIterator()

listIterator

public java.util.ListIterator listIterator(int startIndex)
Specified by:
listIterator in interface java.util.List
See Also:
List.listIterator(int)

get

public java.lang.Object get(int index)
Specified by:
get in interface java.util.List
See Also:
List.get(int)

size

public int size()
Specified by:
size in interface java.util.Collection
See Also:
List.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
See Also:
List.isEmpty()

contains

public boolean contains(java.lang.Object obj)
Specified by:
contains in interface java.util.Collection
See Also:
List.contains(Object)

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
See Also:
List.toArray()

toArray

public java.lang.Object[] toArray(java.lang.Object[] type)
Specified by:
toArray in interface java.util.Collection
See Also:
List.toArray(Object[])

containsAll

public boolean containsAll(java.util.Collection coll)
Specified by:
containsAll in interface java.util.Collection
See Also:
List.containsAll(Collection)

indexOf

public int indexOf(java.lang.Object obj)
Specified by:
indexOf in interface java.util.List
See Also:
List.indexOf(Object)

lastIndexOf

public int lastIndexOf(java.lang.Object obj)
Specified by:
lastIndexOf in interface java.util.List
See Also:
List.lastIndexOf(Object)

subList

public java.util.List subList(int startIndex,
                              int endIndex)
Specified by:
subList in interface java.util.List
See Also:
List.subList(int, int)

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.