Silk DI 0.6


se.jbee.inject
Class Name

Object
  extended by se.jbee.inject.Name
All Implemented Interfaces:
PreciserThan<Name>

public final class Name
extends Object
implements PreciserThan<Name>

A Name is used as discriminator in cases where multiple Instances are bound for the same Type.

Author:
Jan Bernitt (jan@jbee.se)

Field Summary
static Name ANY
          It is the least precise name of all.
static Name DEFAULT
          Used when no name is specified.
static String WILDCARD
          Character used as wildcard when matching names.
 
Method Summary
 boolean equals(Object obj)
           
 boolean equalTo(Name other)
           
 int hashCode()
           
 boolean isAny()
           
 boolean isApplicableFor(Name other)
           
 boolean isDefault()
           
 boolean isInternal()
           
 boolean morePreciseThan(Name other)
           
static Name named(String name)
           
static Name namedBy(Class<? extends Annotation> annotation, AnnotatedElement obj)
           
static Name namedBy(Class<? extends Annotation> annotation, Annotation... instances)
           
static Name namedInternal(Enum<?> name)
           
static Name namedInternal(String name)
          Internal names use a special prefix to avoid name clashes with 'usual' user defined names.
 String toString()
           
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

WILDCARD

public static final String WILDCARD
Character used as wildcard when matching names.

See Also:
Constant Field Values

DEFAULT

public static final Name DEFAULT
Used when no name is specified. It is the most precise name of all.


ANY

public static final Name ANY
It is the least precise name of all.

Method Detail

named

public static Name named(String name)
See Also:
namedInternal(String)

namedInternal

public static Name namedInternal(String name)
Internal names use a special prefix to avoid name clashes with 'usual' user defined names. They should be used for names that the user does not directly know about.

Parameters:
name - A value having the INTERNAL prefix '-' or not.
Returns:
The name instance having the INTERNAL prefix in any case.

namedInternal

public static Name namedInternal(Enum<?> name)

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equalTo

public boolean equalTo(Name other)

equals

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

isAny

public boolean isAny()

isDefault

public boolean isDefault()

isInternal

public boolean isInternal()

morePreciseThan

public boolean morePreciseThan(Name other)
Specified by:
morePreciseThan in interface PreciserThan<Name>
Returns:
Whether or not this object or more precise than the given one. Equal objects are not more precise! Also objects that have no common context or relationship are never more precise. An example would be that two Types with no common super-type do not define one of them that is more precise.

isApplicableFor

public boolean isApplicableFor(Name other)

namedBy

public static Name namedBy(Class<? extends Annotation> annotation,
                           AnnotatedElement obj)

namedBy

public static Name namedBy(Class<? extends Annotation> annotation,
                           Annotation... instances)

Silk DI 0.6