Package org.springframework.aop.aspectj

# Class TypePatternClassFilter

java.lang.Object
org.springframework.aop.aspectj.TypePatternClassFilter

All Implemented Interfaces:
  `ClassFilter`

public class TypePatternClassFilter extends Object implements ClassFilter
Spring AOP `ClassFilter` implementation using AspectJ type matching.

Since:
  2.0
Author:
  Rod Johnson, Juergen Hoeller, Sam Brannen

## Field Summary

### Fields inherited from interface org.springframework.aop.ClassFilter

`TRUE`

## Constructor Summary

Constructors
Constructor
Description
`TypePatternClassFilter()`
Creates a new instance of the `TypePatternClassFilter` class.
`TypePatternClassFilter(String typePattern)`
Create a fully configured `TypePatternClassFilter` using the given type pattern.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object other)`
`String`
`getTypePattern()`
Return the AspectJ type pattern to match.
`int`
`hashCode()`
`boolean`
`matches(Class<?> clazz)`
Should the pointcut apply to the given interface or target class?
`void`
`setTypePattern(String typePattern)`
Set the AspectJ type pattern to match.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### TypePatternClassFilter

public TypePatternClassFilter()
Creates a new instance of the `TypePatternClassFilter` class.

This is the JavaBean constructor; be sure to set the `typePattern` property, else a no doubt fatal `IllegalStateException` will be thrown when the `matches(Class)` method is first invoked.

### TypePatternClassFilter

public TypePatternClassFilter(String typePattern)
Create a fully configured `TypePatternClassFilter` using the given type pattern.

Parameters:
  `typePattern` - the type pattern that AspectJ weaver should parse

## Method Details

### setTypePattern

public void setTypePattern(String typePattern)
Set the AspectJ type pattern to match.

Examples include: `org.springframework.beans.*` This will match any class or interface in the given package. `org.springframework.beans.ITestBean+` This will match the `ITestBean` interface and any class that implements it.

These conventions are established by AspectJ, not Spring AOP.

Parameters:
  `typePattern` - the type pattern that AspectJ weaver should parse

### getTypePattern

public String getTypePattern()
Return the AspectJ type pattern to match.

### matches

public boolean matches(Class<?> clazz)
Should the pointcut apply to the given interface or target class?

Specified by:
  `matches` in interface `ClassFilter`
Parameters:
  `clazz` - candidate target class
Returns:
  whether the advice should apply to this candidate target class
Throws:
  `IllegalStateException` - if no `setTypePattern(String)` has been set

### equals

public boolean equals(@Nullable Object other)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`