org.codehaus.aspectwerkz.attribdef.definition
Class AspectWerkzDefinitionImpl

java.lang.Object
  extended byorg.codehaus.aspectwerkz.attribdef.definition.AspectWerkzDefinitionImpl
All Implemented Interfaces:
AspectWerkzDefinition, java.io.Serializable

public class AspectWerkzDefinitionImpl
extends java.lang.Object
implements AspectWerkzDefinition

Implementation of the AspectWerkz interface for the attribdef definition model.

Author:
Jonas Bonér, Alexandre Vasseur
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.codehaus.aspectwerkz.definition.AspectWerkzDefinition
CALLER_SIDE_DELIMITER, DEF_TYPE_ATTRIB_DEF, DEF_TYPE_XML_DEF, PER_CLASS, PER_INSTANCE, PER_JVM, PER_THREAD, SYSTEM_ASPECT, THROWS_DELIMITER
 
Constructor Summary
AspectWerkzDefinitionImpl()
          Creates a new instance, creates and sets the system aspect.
 
Method Summary
 void addAspect(AspectDefinition aspectDef)
          Adds a new aspect definition.
 void addAspectToUse(java.lang.String className)
          Adds a new aspect to use.
 void addExcludePackage(java.lang.String excludePackage)
          Adds a new exclude package.
 void addIncludePackage(java.lang.String includePackage)
          Adds a new include package.
 void addInterfaceIntroductionDefinition(InterfaceIntroductionDefinition introDef)
          Adds a new pure interface mixin definition.
 void addIntroductionDefinition(IntroductionDefinition introDef)
          Adds a new mixin definition.
 void addParameter(java.lang.String aspectClassName, java.lang.String key, java.lang.String value)
          Adds a new parameter for the aspect.
 void buildMixinMetaDataRepository(java.util.Set repository, java.lang.ClassLoader loader)
          Builds up a meta-data repository for the mixins.
 AdviceDefinition getAdviceDefinition(java.lang.String name)
          Returns a specific advice definition.
 java.util.Collection getAdviceDefinitions()
          Returns a collection with the advice definitions registered.
 AspectDefinition getAspectDefinition(java.lang.String name)
          Returns a specific aspect definition.
 java.util.Collection getAspectDefinitions()
          Returns a collection with the aspect definitions registered.
 int getAspectIndexByName(java.lang.String aspectName)
          Returns the index for a specific introduction.
 java.util.Set getAspectsToUse()
          Returns a set with the aspects to use.
 java.util.Set getExcludePackages()
          Returns the exclude packages.
 java.util.Set getIncludePackages()
          Returns the include packages.
 java.util.List getInterfaceIntroductions(ClassMetaData classMetaData)
          Returns the interface introductions for a certain class merged with the implementation based introductions as well
 java.util.Collection getIntroductionDefinitions()
          Returns a collection with the introduction definitions registered.
 java.util.List getIntroductionDefinitions(ClassMetaData classMetaData)
          Returns the introduction definitions for a specific class.
 java.lang.String getIntroductionImplName(java.lang.String introductionName)
          Returns the name of the implementation for an introduction.
 java.lang.String getJoinPointController(ClassMetaData classMetaData, MethodMetaData methodMetaData)
          Returns the class name for the join point controller, if there is a match.
 int getMixinIndexByName(java.lang.String mixinName)
          Returns the index for a specific introduction.
 java.util.Map getParameters(java.lang.String aspectClassName)
          Returns parameters for the aspect.
 java.lang.String getUuid()
          Returns the UUID for the definition.
 boolean hasAdvice(java.lang.String name)
          Checks if there exists an advice with the name specified.
 boolean hasCallPointcut(ClassMetaData classMetaData)
          Checks if a class should care about advising caller side method invocations.
 boolean hasExecutionPointcut(ClassMetaData classMetaData)
          Checks if a method has a MethodPointcut.
 boolean hasExecutionPointcut(ClassMetaData classMetaData, MethodMetaData methodMetaData)
          Checks if a method has a MethodPointcut.
 boolean hasGetPointcut(ClassMetaData classMetaData)
          Checks if a class has a GetFieldPointcut.
 boolean hasGetPointcut(ClassMetaData classMetaData, FieldMetaData fieldMetaData)
          Checks if a class and field has a GetFieldPointcut.
 boolean hasIntroduction(java.lang.String name)
          Checks if there exists an introduction with the name specified.
 boolean hasIntroductions(ClassMetaData classMetaData)
          Checks if a class has an Mixin.
 boolean hasSetPointcut(ClassMetaData classMetaData)
          Checks if a class has a SetFieldPointcut.
 boolean hasSetPointcut(ClassMetaData classMetaData, FieldMetaData fieldMetaData)
          Checks if a class and field has a SetFieldPointcut.
 boolean hasThrowsPointcut(ClassMetaData classMetaData)
          Checks if a class and method has a ThrowsPointcut.
 boolean hasThrowsPointcut(ClassMetaData classMetaData, MethodMetaData methodMetaData)
          Checks if a class and method has a ThrowsPointcut.
 boolean inExcludePackage(java.lang.String className)
          Checks if a class has an AspectMetaData.
 boolean inIncludePackage(java.lang.String className)
          Checks if a class has an AspectMetaData.
 boolean isAttribDef()
          Checks if the definition is of type attribute definition.
 boolean isPickedOutByCallPointcut(ClassMetaData classMetaData, MethodMetaData methodMetaData)
          Checks if a method is a defined as a caller side method.
 boolean isXmlDef()
          Checks if the definition is of type XML definition.
 void loadAspects(java.lang.ClassLoader loader)
          Loads the aspects.
 void setUuid(java.lang.String uuid)
          Sets the UUID for the definition.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectWerkzDefinitionImpl

public AspectWerkzDefinitionImpl()
Creates a new instance, creates and sets the system aspect.

Method Detail

loadAspects

public void loadAspects(java.lang.ClassLoader loader)
Loads the aspects.

Specified by:
loadAspects in interface AspectWerkzDefinition
Parameters:
loader - the class loader to use to load the aspects

isAttribDef

public boolean isAttribDef()
Checks if the definition is of type attribute definition.

Specified by:
isAttribDef in interface AspectWerkzDefinition
Returns:
returns true for this definition

isXmlDef

public boolean isXmlDef()
Checks if the definition is of type XML definition.

Specified by:
isXmlDef in interface AspectWerkzDefinition
Returns:
returns false for this definition

setUuid

public void setUuid(java.lang.String uuid)
Sets the UUID for the definition.

Specified by:
setUuid in interface AspectWerkzDefinition
Parameters:
uuid - the UUID

getUuid

public java.lang.String getUuid()
Returns the UUID for the definition.

Specified by:
getUuid in interface AspectWerkzDefinition
Returns:
the UUID

getIncludePackages

public java.util.Set getIncludePackages()
Returns the include packages.

Specified by:
getIncludePackages in interface AspectWerkzDefinition
Returns:
the include packages

getExcludePackages

public java.util.Set getExcludePackages()
Returns the exclude packages.

Returns:
the exclude packages

getAspectDefinitions

public java.util.Collection getAspectDefinitions()
Returns a collection with the aspect definitions registered.

Specified by:
getAspectDefinitions in interface AspectWerkzDefinition
Returns:
the aspect definitions

getIntroductionDefinitions

public java.util.Collection getIntroductionDefinitions()
Returns a collection with the introduction definitions registered.

Specified by:
getIntroductionDefinitions in interface AspectWerkzDefinition
Returns:
the introduction definitions

getAdviceDefinitions

public java.util.Collection getAdviceDefinitions()
Returns a collection with the advice definitions registered.

Specified by:
getAdviceDefinitions in interface AspectWerkzDefinition
Returns:
the advice definitions

getAspectDefinition

public AspectDefinition getAspectDefinition(java.lang.String name)
Returns a specific aspect definition.

Parameters:
name - the name of the aspect definition
Returns:
the aspect definition

getAdviceDefinition

public AdviceDefinition getAdviceDefinition(java.lang.String name)
Returns a specific advice definition.

Parameters:
name - the name of the advice definition
Returns:
the advice definition

getIntroductionImplName

public java.lang.String getIntroductionImplName(java.lang.String introductionName)
Returns the name of the implementation for an introduction.

Specified by:
getIntroductionImplName in interface AspectWerkzDefinition
Parameters:
introductionName - the name of the introduction
Returns:
the name of the interface

getIntroductionDefinitions

public java.util.List getIntroductionDefinitions(ClassMetaData classMetaData)
Returns the introduction definitions for a specific class.

Parameters:
classMetaData - the class meta-data
Returns:
a list with the introduction definitions

getAspectIndexByName

public int getAspectIndexByName(java.lang.String aspectName)
Returns the index for a specific introduction.

Parameters:
aspectName - the name of the aspect
Returns:
the index

getMixinIndexByName

public int getMixinIndexByName(java.lang.String mixinName)
Returns the index for a specific introduction.

Parameters:
mixinName - the name of the mixin
Returns:
the index

getJoinPointController

public java.lang.String getJoinPointController(ClassMetaData classMetaData,
                                               MethodMetaData methodMetaData)
Returns the class name for the join point controller, if there is a match.

Specified by:
getJoinPointController in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
methodMetaData - the method meta-data
Returns:
the controller class name

getAspectsToUse

public java.util.Set getAspectsToUse()
Returns a set with the aspects to use.

Specified by:
getAspectsToUse in interface AspectWerkzDefinition
Returns:
the aspects to use

addAspect

public void addAspect(AspectDefinition aspectDef)
Adds a new aspect definition.

Parameters:
aspectDef - the aspect definition

addIntroductionDefinition

public void addIntroductionDefinition(IntroductionDefinition introDef)
Adds a new mixin definition.

Parameters:
introDef - the mixin definition

addInterfaceIntroductionDefinition

public void addInterfaceIntroductionDefinition(InterfaceIntroductionDefinition introDef)
Adds a new pure interface mixin definition.

Parameters:
introDef - the mixin definition

addAspectToUse

public void addAspectToUse(java.lang.String className)
Adds a new aspect to use.

Specified by:
addAspectToUse in interface AspectWerkzDefinition
Parameters:
className - the class name of the aspect

addIncludePackage

public void addIncludePackage(java.lang.String includePackage)
Adds a new include package.

Specified by:
addIncludePackage in interface AspectWerkzDefinition
Parameters:
includePackage - the new include package

addExcludePackage

public void addExcludePackage(java.lang.String excludePackage)
Adds a new exclude package.

Specified by:
addExcludePackage in interface AspectWerkzDefinition
Parameters:
excludePackage - the new exclude package

hasAdvice

public boolean hasAdvice(java.lang.String name)
Checks if there exists an advice with the name specified.

Specified by:
hasAdvice in interface AspectWerkzDefinition
Parameters:
name - the name of the advice
Returns:
boolean

hasIntroduction

public boolean hasIntroduction(java.lang.String name)
Checks if there exists an introduction with the name specified.

Specified by:
hasIntroduction in interface AspectWerkzDefinition
Parameters:
name - the name of the introduction
Returns:
boolean

inIncludePackage

public boolean inIncludePackage(java.lang.String className)
Checks if a class has an AspectMetaData.

Specified by:
inIncludePackage in interface AspectWerkzDefinition
Parameters:
className - the name or the class
Returns:
boolean

inExcludePackage

public boolean inExcludePackage(java.lang.String className)
Checks if a class has an AspectMetaData.

Specified by:
inExcludePackage in interface AspectWerkzDefinition
Parameters:
className - the name or the class
Returns:
boolean

hasIntroductions

public boolean hasIntroductions(ClassMetaData classMetaData)
Checks if a class has an Mixin.

Specified by:
hasIntroductions in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasExecutionPointcut

public boolean hasExecutionPointcut(ClassMetaData classMetaData)
Checks if a method has a MethodPointcut. Only checks for a class match to allow early filtering.

Specified by:
hasExecutionPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasExecutionPointcut

public boolean hasExecutionPointcut(ClassMetaData classMetaData,
                                    MethodMetaData methodMetaData)
Checks if a method has a MethodPointcut.

Specified by:
hasExecutionPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
methodMetaData - the method meta-data
Returns:
boolean

hasGetPointcut

public boolean hasGetPointcut(ClassMetaData classMetaData)
Checks if a class has a GetFieldPointcut. Only checks for a class match to allow early filtering.

Specified by:
hasGetPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasGetPointcut

public boolean hasGetPointcut(ClassMetaData classMetaData,
                              FieldMetaData fieldMetaData)
Checks if a class and field has a GetFieldPointcut.

Specified by:
hasGetPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
fieldMetaData - the name or the field
Returns:
boolean

hasSetPointcut

public boolean hasSetPointcut(ClassMetaData classMetaData)
Checks if a class has a SetFieldPointcut. Only checks for a class match to allow early filtering.

Specified by:
hasSetPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasSetPointcut

public boolean hasSetPointcut(ClassMetaData classMetaData,
                              FieldMetaData fieldMetaData)
Checks if a class and field has a SetFieldPointcut.

Specified by:
hasSetPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
fieldMetaData - the name or the field
Returns:
boolean

hasThrowsPointcut

public boolean hasThrowsPointcut(ClassMetaData classMetaData)
Checks if a class and method has a ThrowsPointcut. Only checks for a class match to allow early filtering.

Specified by:
hasThrowsPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasThrowsPointcut

public boolean hasThrowsPointcut(ClassMetaData classMetaData,
                                 MethodMetaData methodMetaData)
Checks if a class and method has a ThrowsPointcut.

Specified by:
hasThrowsPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
methodMetaData - the name or the method
Returns:
boolean

hasCallPointcut

public boolean hasCallPointcut(ClassMetaData classMetaData)
Checks if a class should care about advising caller side method invocations. This method matches the caller class (when the isCallerSideMethod matches the callee class)

Specified by:
hasCallPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

isPickedOutByCallPointcut

public boolean isPickedOutByCallPointcut(ClassMetaData classMetaData,
                                         MethodMetaData methodMetaData)
Checks if a method is a defined as a caller side method. This method matches the callee class (when the hasCallerSideMethod matches the caller class)

Specified by:
isPickedOutByCallPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
methodMetaData - the name or the method
Returns:
boolean

getInterfaceIntroductions

public java.util.List getInterfaceIntroductions(ClassMetaData classMetaData)
Returns the interface introductions for a certain class merged with the implementation based introductions as well

Parameters:
classMetaData - the class meta-data
Returns:
the names

buildMixinMetaDataRepository

public void buildMixinMetaDataRepository(java.util.Set repository,
                                         java.lang.ClassLoader loader)
Builds up a meta-data repository for the mixins.

Specified by:
buildMixinMetaDataRepository in interface AspectWerkzDefinition
Parameters:
repository - the repository
loader - the class loader to use

addParameter

public void addParameter(java.lang.String aspectClassName,
                         java.lang.String key,
                         java.lang.String value)
Adds a new parameter for the aspect.

Parameters:
aspectClassName - the name of the aspect
key - the key
value - the value

getParameters

public java.util.Map getParameters(java.lang.String aspectClassName)
Returns parameters for the aspect.

Parameters:
aspectClassName - the name of the aspect
Returns:
parameters


Copyright (c) 2002-2004 The AspectWerkz Team. All Rights Reserved.