org.apache.cayenne.di
Class Key<T>

java.lang.Object
  extended by org.apache.cayenne.di.Key<T>

public class Key<T>
extends Object

An object that encapsulates a key used to store and lookup DI bindings. Key is made of a binding type and an optional binding name.

Since:
3.1

Field Summary
protected  String bindingName
           
protected  Class<T> type
           
protected  String typeName
           
 
Constructor Summary
protected Key(Class<T> type, String bindingName)
           
 
Method Summary
 boolean equals(Object object)
           
static
<T> Key<T>
get(Class<T> type)
          Creates a key for a nameless binding of a given type.
static
<T> Key<T>
get(Class<T> type, String bindingName)
          Creates a key for a named binding of a given type.
 String getBindingName()
          Returns an optional name of the binding used to distinguish multiple bindings of the same object type.
 Class<T> getType()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected Class<T> type

typeName

protected String typeName

bindingName

protected String bindingName
Constructor Detail

Key

protected Key(Class<T> type,
              String bindingName)
Method Detail

get

public static <T> Key<T> get(Class<T> type)
Creates a key for a nameless binding of a given type.


get

public static <T> Key<T> get(Class<T> type,
                             String bindingName)
Creates a key for a named binding of a given type. 'bindingName' that is an empty String is treated the same way as a null 'bindingName'. In both cases a nameless binding key is created.


getType

public Class<T> getType()

getBindingName

public String getBindingName()
Returns an optional name of the binding used to distinguish multiple bindings of the same object type.


equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2010 Apache Cayenne. All Rights Reserved.