AbstractAdvislet Class
- public abstract class AbstractAdvislet
extends Object
implements AdviceConstants
, AdviceRequestConstants
, Advislet
An abstract class which provides some default method implementations
for classes wishing to implement the Advislet interface.
-
Hierarchy
-
Object
AbstractAdvislet
-
All Implemented Interfaces
-
AdviceConstants
, AdviceRequestConstants
, Advislet
, AdvisletChainElement
-
Direct Known Subclasses
-
CatalogQueryAdvisletImpl
, ContentQueryAdvisletImpl
, RulesAdvisletImpl
advisletMetadata
protected Metadata
advisletMetadata
- The metadata for the Advislet
advisor
protected Advisor
advisor
- The Advisor associated with this Advislet instance.
parametersMap
protected Map
parametersMap
- The parameters Map for the Advislet
AbstractAdvislet
public AbstractAdvislet(Advisor
advisor,
Metadata
advisletMetadata)
- Constructs a new AbstractAdvislet associated with the Advisor
supplied.
getAdvice(AdviceRequest) Method
public Advice
getAdvice(AdviceRequest
request)
throws IllegalArgumentException
, AdvisorException
Description copied from Advislet.getAdvice(AdviceRequest)
Makes recommendations based on the AdviceRequest passed in.
Parameters
-
request
- The advice request for which to make a recommendation.
Returns
- The advice which contain the recommendations based on the type of request made.
Exceptions
-
IllegalArgumentException
-
AdvisorException
getAdvisor() Method
protected Advisor
getAdvisor()
Gets the Advisor associated with this Advislet.
Returns
- The Advisor set as the parent.
getMetadata() Method
public Metadata
getMetadata()
Returns the metadata for the Advislet.
Returns
- the metadata for the Advislet.
getRequiredAttributes() Method
public Object
[] getRequiredAttributes()
Description copied from Advislet.getRequiredAttributes()
Returns an array of required attributes for the advislet. The array
contains pairs of items: even items are attribute names
while odd items are the Class for the item. This information is used by the
Advisor to ensure Advislets are not invoked with invalid parameters.
Overide the validateAdviceRequest
method to perform additional processing
above and beyond attribute type checking.
Returns
- an array that contains the attributes required by the
Advislet.
initialize(Map, Object) Method
public boolean initialize(Map
parameters,
Object
parameterDocument)
throws AdvisorException
Initializes this with the given parameters
and a parameterDocument
.
Parameters
-
parameters
- A map containing key-value pairs.
-
parameterDocument
- An
Object
representing a parameter document.
Returns
- returns
true
if this operation is successful, otherwise returns
false
.
Exceptions
-
AdvisorException
- If an error occurs during initialization process.
toString() Method
public String
toString()
Returns a String representation of this.
-
Overrides
-
Object.toString()
Returns
- a String representation of this.
validateAdviceRequest(AdviceRequest) Method
public void validateAdviceRequest(AdviceRequest
request)
throws IllegalArgumentException
Description copied from Advislet.validateAdviceRequest(AdviceRequest)
Allows for custom AdviceRequest validation logic in
addition to the required attribute checking performed
by the Advisor.
Parameters
-
request
- the request to validate.
Exceptions
-
IllegalArgumentException