org.joda.beans.ser
Class SerIteratorFactory

java.lang.Object
  extended by org.joda.beans.ser.SerIteratorFactory
Direct Known Subclasses:
GuavaSerIteratorFactory

public class SerIteratorFactory
extends Object

A factory used to create wrappers around collection-like objects.


Field Summary
static List<Class<?>> EMPTY_VALUE_TYPES
          An empty list of classes.
static SerIteratorFactory INSTANCE
          Singleton instance.
 
Constructor Summary
SerIteratorFactory()
           
 
Method Summary
static SerIterable array(Class<?> valueType)
          Gets an iterable wrapper for an array.
static SerIterator array(Object[] array, Class<?> valueType)
          Gets an iterator wrapper for an array.
static SerIterator collection(Collection<?> coll, Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterator wrapper for Collection.
 SerIterator create(Object value)
          Creates an iterator wrapper for an arbitrary value.
 SerIterator create(Object value, List<Class<?>> types)
          Creates an iterator wrapper for an arbitrary value.
 SerIterator create(Object value, MetaProperty<?> prop, Class<?> beanClass)
          Creates an iterator wrapper for a meta-property value.
 SerIterable createIterable(MetaProperty<?> prop, Class<?> beanClass)
          Creates an iterator wrapper for a meta-property value.
 SerIterable createIterable(SerIterable iterable)
          Creates an iterator wrapper for a child where there are second level generic parameters.
 SerIterable createIterable(String metaTypeDescription, JodaBeanSer settings, Map<String,Class<?>> knownTypes)
          Creates an iterator wrapper for a meta-type description.
static SerIterable list(Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterable wrapper for List.
static SerIterable map(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterable wrapper for Map.
static SerIterator map(Map<?,?> map, Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterator wrapper for Map.
static SerIterable navigableMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterable wrapper for NavigableMap.
static SerIterable navigableSet(Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterable wrapper for NavigableSet.
static SerIterable set(Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterable wrapper for Set.
static SerIterable sortedMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterable wrapper for SortedMap.
static SerIterable sortedSet(Class<?> valueType, List<Class<?>> valueTypeTypes)
          Gets an iterable wrapper for SortedSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final SerIteratorFactory INSTANCE
Singleton instance.


EMPTY_VALUE_TYPES

public static final List<Class<?>> EMPTY_VALUE_TYPES
An empty list of classes.

Constructor Detail

SerIteratorFactory

public SerIteratorFactory()
Method Detail

create

public SerIterator create(Object value)
Creates an iterator wrapper for an arbitrary value.

Parameters:
value - the possible collection-like object, not null
Returns:
the iterator, null if not a collection-like type

create

public SerIterator create(Object value,
                          List<Class<?>> types)
Creates an iterator wrapper for an arbitrary value.

Parameters:
value - the possible collection-like object, not null
types - the generic type parameters to use, empty if unknown
Returns:
the iterator, null if not a collection-like type

create

public SerIterator create(Object value,
                          MetaProperty<?> prop,
                          Class<?> beanClass)
Creates an iterator wrapper for a meta-property value.

Parameters:
value - the possible collection-like object, not null
prop - the meta-property defining the value, not null
beanClass - the class of the bean, not the meta-property, for better generics, not null
Returns:
the iterator, null if not a collection-like type

createIterable

public SerIterable createIterable(String metaTypeDescription,
                                  JodaBeanSer settings,
                                  Map<String,Class<?>> knownTypes)
Creates an iterator wrapper for a meta-type description.

Parameters:
metaTypeDescription - the description of the collection type, not null
settings - the settings object, not null
knownTypes - the known types map, null if not using known type shortening
Returns:
the iterable, null if not a collection-like type

createIterable

public SerIterable createIterable(SerIterable iterable)
Creates an iterator wrapper for a child where there are second level generic parameters.

Parameters:
iterable - the parent iterable, not null
Returns:
the iterable, null if not a collection-like type

createIterable

public SerIterable createIterable(MetaProperty<?> prop,
                                  Class<?> beanClass)
Creates an iterator wrapper for a meta-property value.

Parameters:
prop - the meta-property defining the value, not null
beanClass - the class of the bean, not the meta-property, for better generics, not null
Returns:
the iterable, null if not a collection-like type

list

public static final SerIterable list(Class<?> valueType,
                                     List<Class<?>> valueTypeTypes)
Gets an iterable wrapper for List.

Parameters:
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterable, not null

set

public static final SerIterable set(Class<?> valueType,
                                    List<Class<?>> valueTypeTypes)
Gets an iterable wrapper for Set.

Parameters:
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterable, not null

sortedSet

public static final SerIterable sortedSet(Class<?> valueType,
                                          List<Class<?>> valueTypeTypes)
Gets an iterable wrapper for SortedSet.

Parameters:
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterable, not null

navigableSet

public static final SerIterable navigableSet(Class<?> valueType,
                                             List<Class<?>> valueTypeTypes)
Gets an iterable wrapper for NavigableSet.

Parameters:
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterable, not null

collection

public static final SerIterator collection(Collection<?> coll,
                                           Class<?> valueType,
                                           List<Class<?>> valueTypeTypes)
Gets an iterator wrapper for Collection.

Parameters:
coll - the collection, not null
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterator, not null

map

public static final SerIterable map(Class<?> keyType,
                                    Class<?> valueType,
                                    List<Class<?>> valueTypeTypes)
Gets an iterable wrapper for Map.

Parameters:
keyType - the value type, not null
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterable, not null

sortedMap

public static final SerIterable sortedMap(Class<?> keyType,
                                          Class<?> valueType,
                                          List<Class<?>> valueTypeTypes)
Gets an iterable wrapper for SortedMap.

Parameters:
keyType - the value type, not null
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterable, not null

navigableMap

public static final SerIterable navigableMap(Class<?> keyType,
                                             Class<?> valueType,
                                             List<Class<?>> valueTypeTypes)
Gets an iterable wrapper for NavigableMap.

Parameters:
keyType - the value type, not null
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterable, not null

map

public static final SerIterator map(Map<?,?> map,
                                    Class<?> keyType,
                                    Class<?> valueType,
                                    List<Class<?>> valueTypeTypes)
Gets an iterator wrapper for Map.

Parameters:
map - the collection, not null
keyType - the value type, not null
valueType - the value type, not null
valueTypeTypes - the generic parameters of the value type
Returns:
the iterator, not null

array

public static final SerIterable array(Class<?> valueType)
Gets an iterable wrapper for an array.

Parameters:
valueType - the value type, not null
Returns:
the iterable, not null

array

public static final SerIterator array(Object[] array,
                                      Class<?> valueType)
Gets an iterator wrapper for an array.

Parameters:
array - the array, not null
valueType - the value type, not null
Returns:
the iterator, not null


Copyright © 2007–2013 Joda.org. All rights reserved.