Class MapConverter<V extends Identifiable>
- java.lang.Object
-
- edu.uiuc.ncsa.security.storage.data.MapConverter<V>
-
- All Implemented Interfaces:
XMLConverter<V>
- Direct Known Subclasses:
ClientConverter
,MonitoredConverter
public class MapConverter<V extends Identifiable> extends Object implements XMLConverter<V>
A class that converts between objects and maps. You must supply theSerializationKeys
.Created by Jeff Gaynor
on 4/13/12 at 11:38 AM
-
-
Field Summary
Fields Modifier and Type Field Description SerializationKeys
keys
protected IdentifiableProvider<V>
provider
-
Constructor Summary
Constructors Constructor Description MapConverter(SerializationKeys keys, IdentifiableProvider<V> provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
createIfNeeded(V v)
V
fromMap(ConversionMap<String,Object> data)
Takes a map and returns an object of the given type, initialized with the values of the map.V
fromMap(ConversionMap<String,Object> map, V v)
V
fromMap(Map<String,Object> map, V v)
SerializationKeys
getKeys()
IdentifiableProvider<V>
getProvider()
V
subset(V v, List<String> attributes)
Given a set of attributes, create a new object whose properties are restricted to the given list of attributes.void
toMap(V value, ConversionMap<String,Object> data)
Takes the value and writes the data to the map.void
toMap(V value, Map<String,Object> data)
-
-
-
Field Detail
-
keys
public SerializationKeys keys
-
provider
protected IdentifiableProvider<V extends Identifiable> provider
-
-
Constructor Detail
-
MapConverter
public MapConverter(SerializationKeys keys, IdentifiableProvider<V> provider)
-
-
Method Detail
-
getKeys
public SerializationKeys getKeys()
-
getProvider
public IdentifiableProvider<V> getProvider()
-
fromMap
public V fromMap(ConversionMap<String,Object> data)
Takes a map and returns an object of the given type, initialized with the values of the map.- Parameters:
data
-- Returns:
-
fromMap
public V fromMap(ConversionMap<String,Object> map, V v)
-
toMap
public void toMap(V value, ConversionMap<String,Object> data)
Takes the value and writes the data to the map. The reason that the map is supplied is that there are many specialized maps. It would place undue constraints on this class to try and manage these as well.- Parameters:
value
-data
-
-
subset
public V subset(V v, List<String> attributes)
Given a set of attributes, create a new object whose properties are restricted to the given list of attributes. Note theSerializationKeys
has a methodSerializationKeys.allKeys()
that allows you to get every key for this object so you can simply remove what you do not want or need.- Parameters:
v
-attributes
-- Returns:
-
fromMap
public V fromMap(Map<String,Object> map, V v)
- Specified by:
fromMap
in interfaceXMLConverter<V extends Identifiable>
-
toMap
public void toMap(V value, Map<String,Object> data)
- Specified by:
toMap
in interfaceXMLConverter<V extends Identifiable>
-
-