org.milyn.scribe.register
Class MapDaoRegister<T>

java.lang.Object
  extended by org.milyn.scribe.register.AbstractDaoRegister<T>
      extended by org.milyn.scribe.register.MapDaoRegister<T>
Type Parameters:
T - The DAO type
All Implemented Interfaces:
DaoRegister<T>

public class MapDaoRegister<T>
extends AbstractDaoRegister<T>

A immutable map based DAO register

A MapDaoRegister can be created via the static newInstance(Map) method or via the MapDaoRegister.Builder object. The Builder object can be created via it's constructor or the static builder() or builder(Map) methods.

Author:
maurice.zeijen@smies.com

Nested Class Summary
static class MapDaoRegister.Builder<T>
          Builds a MapDaoRegister object.
 
Method Summary
static
<T> MapDaoRegister.Builder<T>
builder()
          Creates a Builder object that can build a MapDaoRegister
static
<T> MapDaoRegister.Builder<T>
builder(Map<String,? extends T> map)
          Creates a Builder object that can build a MapDaoRegister.
 boolean containsDAO(T dao)
           
 boolean containsKey(String key)
           
 boolean equals(Object obj)
           
 Map<String,T> getAll()
          Returns a clone of the underlying map.
 T getDao(String key)
          Returns the DAO with the specified name.
 int hashCode()
           
static
<T> MapDaoRegister<T>
newInstance(Map<String,? extends T> map)
          Creates a new MapDaoRegister and fills it with the provided map.
 int size()
           
 String toString()
           
 
Methods inherited from class org.milyn.scribe.register.AbstractDaoRegister
getDefaultDao, returnDao
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

newInstance

public static <T> MapDaoRegister<T> newInstance(Map<String,? extends T> map)
Creates a new MapDaoRegister and fills it with the provided map.

Type Parameters:
T - the type of the DAO
Parameters:
map - the map that fills the new MapDaoRegister
Returns:
the new MapDaoRegister

builder

public static <T> MapDaoRegister.Builder<T> builder()
Creates a Builder object that can build a MapDaoRegister

Type Parameters:
T - The type of the DAO
Returns:
The builder

builder

public static <T> MapDaoRegister.Builder<T> builder(Map<String,? extends T> map)
Creates a Builder object that can build a MapDaoRegister. The builder will be instantiated with the provided map.

Type Parameters:
T - The type of the DAO
Parameters:
map - The map that is added to the builder
Returns:
The builder

containsKey

public boolean containsKey(String key)

containsDAO

public boolean containsDAO(T dao)

getAll

public Map<String,T> getAll()
Returns a clone of the underlying map.

Returns:

getDao

public T getDao(String key)
Description copied from interface: DaoRegister
Returns the DAO with the specified name.

Specified by:
getDao in interface DaoRegister<T>
Overrides:
getDao in class AbstractDaoRegister<T>
Parameters:
key - the name of the DAO
Returns:
the DAO with the specified name

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

size

public int size()


Copyright © 2018. All rights reserved.