Silk DI 0.6


se.jbee.inject
Enum DeclarationType

Object
  extended by Enum<DeclarationType>
      extended by se.jbee.inject.DeclarationType
All Implemented Interfaces:
Serializable, Comparable<DeclarationType>, PreciserThan<DeclarationType>

public enum DeclarationType
extends Enum<DeclarationType>
implements PreciserThan<DeclarationType>

The DeclarationType is used to keep track of the origin of binding declarations. They describe how or why a binding has been made whereby they get different significance and meaning. While binds consciously done by API calls through the programmer result in EXPLICIT or MULTI there are 3 weaker types for those binds that added indirectly. They provide a convenient fall-back behaviour that allows to omit simple self-evident binds but allow to override these fall-backs explicitly. It is important to distinguish binds in that way since binds always have to be unambiguous. Two equivalent binds would clashesWith(DeclarationType) each other.

Author:
Jan Bernitt (jan@jbee.se)

Enum Constant Summary
AUTO
          A auto-bind has been used.
DEFAULT
          Used to provide a default of required parts of a module that can be replaced *once* to customize behavior.
EXPLICIT
          The bind has been made explicitly by a module (should be a unique Resource)
IMPLICIT
          Has been added by the binder as a fall-back since some bind-calls can have ambiguous intentions.
MULTI
          A bind that is meant to co-exist with others that might have the same Resource.
PROVIDED
           
REQUIRED
          A binding that is just expressing the instance needed but not how to supply it.
 
Method Summary
 boolean clashesWith(DeclarationType other)
           
 boolean morePreciseThan(DeclarationType other)
           
 boolean nullifiedBy(DeclarationType other)
           
 boolean replacedBy(DeclarationType other)
           
static DeclarationType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static DeclarationType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

IMPLICIT

public static final DeclarationType IMPLICIT
Has been added by the binder as a fall-back since some bind-calls can have ambiguous intentions.


DEFAULT

public static final DeclarationType DEFAULT
Used to provide a default of required parts of a module that can be replaced *once* to customize behavior. There can be just *one* default for each Resource and still just one explicit replacement for it.


PROVIDED

public static final DeclarationType PROVIDED

AUTO

public static final DeclarationType AUTO
A auto-bind has been used. That is binding a class or instance to the exact type as EXPLICIT and to all its super-classes and -interfaces as a AUTO bound bind.


MULTI

public static final DeclarationType MULTI
A bind that is meant to co-exist with others that might have the same Resource. Those have to be defined as MULTI as well!


EXPLICIT

public static final DeclarationType EXPLICIT
The bind has been made explicitly by a module (should be a unique Resource)


REQUIRED

public static final DeclarationType REQUIRED
A binding that is just expressing the instance needed but not how to supply it. This allows to express needs in a module without knowing what will be the implementation and ensure (during bootstrapping) that there will be a known implementation defined.

Method Detail

values

public static DeclarationType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DeclarationType c : DeclarationType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static DeclarationType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

morePreciseThan

public boolean morePreciseThan(DeclarationType other)
Specified by:
morePreciseThan in interface PreciserThan<DeclarationType>
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.

clashesWith

public boolean clashesWith(DeclarationType other)

replacedBy

public boolean replacedBy(DeclarationType other)

nullifiedBy

public boolean nullifiedBy(DeclarationType other)

Silk DI 0.6