org.apache.hivemind.service.impl
Class BuilderFacet

java.lang.Object
  extended by org.apache.hivemind.impl.BaseLocatable
      extended by org.apache.hivemind.service.impl.BuilderFacet
All Implemented Interfaces:
Locatable, LocationHolder
Direct Known Subclasses:
BuilderClassResolverFacet, BuilderErrorHandlerFacet, BuilderErrorLogFacet, BuilderLogFacet, BuilderMessagesFacet, BuilderPropertyFacet, BuilderServiceIdFacet

public abstract class BuilderFacet
extends BaseLocatable

Represents one facet of constructing a service implementation instance. A facet is either a property to be set on the constructed instance, or a parameter to the instance class' constructor. Facets are nested properties within BuilderParameter, and are used by BuilderFactory.

Author:
Howard Lewis Ship

Constructor Summary
BuilderFacet()
           
 
Method Summary
 java.lang.String autowire(java.lang.Object target, ServiceImplementationFactoryParameters factoryParameters)
          Attempts to autowire a property of the target.
 boolean canAutowireConstructorParameter()
           
protected  java.lang.String getDefaultPropertyName()
          Returns null.
abstract  java.lang.Object getFacetValue(ServiceImplementationFactoryParameters factoryParameters, java.lang.Class targetType)
          Implemented in subclasses to provide a specific value for the facet (for use as a constructor parameter, or as a value to set a property to).
 java.lang.String getPropertyName()
           
abstract  boolean isAssignableToType(ServiceImplementationFactoryParameters factoryParameters, java.lang.Class targetType)
           
 void setPropertyName(java.lang.String string)
           
 
Methods inherited from class org.apache.hivemind.impl.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuilderFacet

public BuilderFacet()
Method Detail

getFacetValue

public abstract java.lang.Object getFacetValue(ServiceImplementationFactoryParameters factoryParameters,
                                               java.lang.Class targetType)
Implemented in subclasses to provide a specific value for the facet (for use as a constructor parameter, or as a value to set a property to).

Parameters:
factoryParameters - the parameters that define the service point and its environment
targetType - the desired property type (extracted from the property type of the property to be updated, when a property is known)

isAssignableToType

public abstract boolean isAssignableToType(ServiceImplementationFactoryParameters factoryParameters,
                                           java.lang.Class targetType)

getPropertyName

public java.lang.String getPropertyName()

setPropertyName

public void setPropertyName(java.lang.String string)

autowire

public java.lang.String autowire(java.lang.Object target,
                                 ServiceImplementationFactoryParameters factoryParameters)
Attempts to autowire a property of the target. This requires that If all conditions are met, then the property is updated to the facet value, and the property name is returned. In all other cases, null is returned.

Parameters:
target - The service implementation being constructed
factoryParameters - the parameters that define the service point and its environment

getDefaultPropertyName

protected java.lang.String getDefaultPropertyName()
Returns null. Subclasses can provide the default name for a property used by autowire(Object, ServiceImplementationFactoryParameters).


canAutowireConstructorParameter

public boolean canAutowireConstructorParameter()
Since:
1.1