Package org.joda.beans.ser
Class GuavaSerIteratorFactory
- java.lang.Object
-
- org.joda.beans.ser.SerIteratorFactory
-
- org.joda.beans.ser.GuavaSerIteratorFactory
-
- Direct Known Subclasses:
CollectSerIteratorFactory
public class GuavaSerIteratorFactory extends SerIteratorFactory
Guava factory used to create wrappers around collection-like objects.
-
-
Field Summary
-
Fields inherited from class org.joda.beans.ser.SerIteratorFactory
EMPTY_VALUE_TYPES, INSTANCE
-
-
Constructor Summary
Constructors Constructor Description GuavaSerIteratorFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SerIteratorbiMap(com.google.common.collect.BiMap<?,?> map, Class<?> declaredType, Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterator wrapper forBiMap.static SerIterablebiMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forBiMap.SerIteratorcreate(Object value, MetaProperty<?> prop, Class<?> beanClass)Creates an iterator wrapper for a meta-property value.SerIteratorcreateChild(Object value, SerIterator parent)Creates an iterator wrapper for a value retrieved from a parent iterator.SerIterablecreateIterable(String metaTypeDescription, JodaBeanSer settings, Map<String,Class<?>> knownTypes)Creates an iterator wrapper for a meta-property value.SerIterablecreateIterable(MetaProperty<?> prop, Class<?> beanClass)Creates an iterator wrapper for a meta-property value.static SerIterableimmutableList(Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forImmutableList.static SerIterableimmutableSet(Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forImmutableSet.static SerIterableimmutableSortedSet(Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forImmutableSortedSet.static SerIterablelistMultimap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forListMultimap.static SerIteratormultimap(com.google.common.collect.Multimap<?,?> map, Class<?> declaredType, Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterator wrapper forMultimap.static SerIteratormultiset(com.google.common.collect.Multiset<?> multiset, Class<?> declaredType, Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterator wrapper forMultiset.static SerIterablemultiset(Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forMultiset.static SerIterablesetMultimap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forSetMultimap.static SerIterablesortedMultiset(Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forSortedMultiset.static SerIteratortable(com.google.common.collect.Table<?,?,?> table, Class<?> declaredType, Class<?> rowType, Class<?> colType, Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterator wrapper forTable.static SerIterabletable(Class<?> rowType, Class<?> colType, Class<?> valueType, List<Class<?>> valueTypeTypes)Gets an iterable wrapper forTable.-
Methods inherited from class org.joda.beans.ser.SerIteratorFactory
array, array, collection, create, createIterable, createIterable, defaultToObjectClass, list, map, map, navigableMap, navigableSet, set, sortedMap, sortedSet
-
-
-
-
Method Detail
-
create
public SerIterator create(Object value, MetaProperty<?> prop, Class<?> beanClass)
Creates an iterator wrapper for a meta-property value.- Overrides:
createin classSerIteratorFactory- Parameters:
value- the possible collection-like object, not nullprop- the meta-property defining the value, not nullbeanClass- the class of the bean, not the meta-property, for better generics, not null- Returns:
- the iterator, null if not a collection-like type
-
createChild
public SerIterator createChild(Object value, SerIterator parent)
Creates an iterator wrapper for a value retrieved from a parent iterator.Allows the parent iterator to define the child iterator using generic type information. This handles cases such as a
Listas the value in aMap.- Overrides:
createChildin classSerIteratorFactory- Parameters:
value- the possible collection-like object, not nullparent- the parent iterator, 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-property value.- Overrides:
createIterablein classSerIteratorFactory- Parameters:
metaTypeDescription- the description of the collection type, not nullsettings- the settings object, not nullknownTypes- the known types map, null if not using known type shortening- Returns:
- the iterator, null if not a collection-like type
-
createIterable
public SerIterable createIterable(MetaProperty<?> prop, Class<?> beanClass)
Creates an iterator wrapper for a meta-property value.- Overrides:
createIterablein classSerIteratorFactory- Parameters:
prop- the meta-property defining the value, not nullbeanClass- the class of the bean, not the meta-property, for better generics, not null- Returns:
- the iterator, null if not a collection-like type
-
biMap
public static final SerIterable biMap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forBiMap.- Parameters:
keyType- the value type, not nullvalueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
multiset
public static final SerIterable multiset(Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forMultiset.- Parameters:
valueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
sortedMultiset
public static final SerIterable sortedMultiset(Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forSortedMultiset.- Parameters:
valueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
multiset
public static final SerIterator multiset(com.google.common.collect.Multiset<?> multiset, Class<?> declaredType, Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterator wrapper forMultiset.- Parameters:
multiset- the collection, not nulldeclaredType- the declared type, not nullvalueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterator, not null
-
listMultimap
public static final SerIterable listMultimap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forListMultimap.- Parameters:
keyType- the key type, not nullvalueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
setMultimap
public static final SerIterable setMultimap(Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forSetMultimap.- Parameters:
keyType- the key type, not nullvalueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
multimap
public static final SerIterator multimap(com.google.common.collect.Multimap<?,?> map, Class<?> declaredType, Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterator wrapper forMultimap.- Parameters:
map- the collection, not nulldeclaredType- the declared type, not nullkeyType- the key type, not nullvalueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterator, not null
-
table
public static final SerIterable table(Class<?> rowType, Class<?> colType, Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forTable.- Parameters:
rowType- the row type, not nullcolType- the column type, not nullvalueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
table
public static final SerIterator table(com.google.common.collect.Table<?,?,?> table, Class<?> declaredType, Class<?> rowType, Class<?> colType, Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterator wrapper forTable.- Parameters:
table- the collection, not nulldeclaredType- the declared type, not nullrowType- the row type, not nullcolType- the col type, not nullvalueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterator, not null
-
biMap
public static final SerIterator biMap(com.google.common.collect.BiMap<?,?> map, Class<?> declaredType, Class<?> keyType, Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterator wrapper forBiMap.- Parameters:
map- the collection, not nulldeclaredType- the declared type, not nullkeyType- the value type, not nullvalueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterator, not null
-
immutableList
public static final SerIterable immutableList(Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forImmutableList.- Parameters:
valueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
immutableSortedSet
public static final SerIterable immutableSortedSet(Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forImmutableSortedSet.- Parameters:
valueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
immutableSet
public static final SerIterable immutableSet(Class<?> valueType, List<Class<?>> valueTypeTypes)
Gets an iterable wrapper forImmutableSet.- Parameters:
valueType- the value type, not nullvalueTypeTypes- the generic parameters of the value type- Returns:
- the iterable, not null
-
-