T
- type of the kept instance.public class ServiceHolderImpl<T> extends java.lang.Object implements ServiceHolder<T>
InjectionManager
and the other information about this instance.Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.reflect.Type> |
contractTypes |
private java.lang.Class<T> |
implementationClass |
private int |
rank |
private T |
service |
Constructor and Description |
---|
ServiceHolderImpl(T service,
java.lang.Class<T> implementationClass,
java.util.Set<java.lang.reflect.Type> contractTypes,
int rank)
Creates a new instance of the service holder which keeps the concrete instance and its additional information.
|
ServiceHolderImpl(T service,
java.util.Set<java.lang.reflect.Type> contractTypes)
Creates a new instance of the service holder which keeps the concrete instance and its additional information.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.util.Set<java.lang.reflect.Type> |
getContractTypes()
Gets all contracts which represents the kept instance.
|
java.lang.Class<T> |
getImplementationClass()
Gets an implementation class of the instance which is kept in this service holder.
|
T |
getInstance()
An instance of the service got from
InjectionManager . |
int |
getRank()
Gets ranking of the kept instance.
|
int |
hashCode() |
private final T service
private final java.lang.Class<T> implementationClass
private final java.util.Set<java.lang.reflect.Type> contractTypes
private final int rank
public ServiceHolderImpl(T service, java.util.Set<java.lang.reflect.Type> contractTypes)
service
- service instance kept by this holder.contractTypes
- types which represent the given instance.public ServiceHolderImpl(T service, java.lang.Class<T> implementationClass, java.util.Set<java.lang.reflect.Type> contractTypes, int rank)
service
- service instance kept by this holder.implementationClass
- implementation class of the given instance.contractTypes
- types which represent the given instance.rank
- ranking of the given instance.public T getInstance()
ServiceHolder
InjectionManager
.getInstance
in interface ServiceHolder<T>
public java.lang.Class<T> getImplementationClass()
ServiceHolder
getImplementationClass
in interface ServiceHolder<T>
public java.util.Set<java.lang.reflect.Type> getContractTypes()
ServiceHolder
getContractTypes
in interface ServiceHolder<T>
public int getRank()
ServiceHolder
getRank
in interface ServiceHolder<T>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object