Package org.springframework.aop.target

# Class EmptyTargetSource

java.lang.Object
org.springframework.aop.target.EmptyTargetSource

All Implemented Interfaces:
  `Serializable`, `TargetClassAware`, `TargetSource`

public final class EmptyTargetSource extends Object implements TargetSource, Serializable
Canonical `TargetSource` when there is no target (or just the target class known), and behavior is supplied by interfaces and advisors only.

Author:
  Rod Johnson, Juergen Hoeller
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final EmptyTargetSource`
`INSTANCE`
The canonical (Singleton) instance of this `EmptyTargetSource`.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object other)`
`static EmptyTargetSource`
`forClass(Class<?> targetClass)`
Return an EmptyTargetSource for the given target Class.
`static EmptyTargetSource`
`forClass(Class<?> targetClass, boolean isStatic)`
Return an EmptyTargetSource for the given target Class.
`Object`
`getTarget()`
Always returns `null`.
`Class<?>`
`getTargetClass()`
Always returns the specified target Class, or `null` if none.
`int`
`hashCode()`
`boolean`
`isStatic()`
Always returns `true`.
`String`
`toString()`

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

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

### Methods inherited from interface org.springframework.aop.TargetSource

`releaseTarget`

## Field Details

### INSTANCE

public static final EmptyTargetSource INSTANCE
The canonical (Singleton) instance of this `EmptyTargetSource`.

## Method Details

### forClass

public static EmptyTargetSource forClass(@Nullable Class<?> targetClass)
Return an EmptyTargetSource for the given target Class.

Parameters:
  `targetClass` - the target Class (may be `null`)
See Also:
  - `getTargetClass()`

### forClass

public static EmptyTargetSource forClass(@Nullable Class<?> targetClass, boolean isStatic)
Return an EmptyTargetSource for the given target Class.

Parameters:
  `targetClass` - the target Class (may be `null`)
  `isStatic` - whether the TargetSource should be marked as static
See Also:
  - `getTargetClass()`

### getTargetClass

@Nullable public Class<?> getTargetClass()
Always returns the specified target Class, or `null` if none.

Specified by:
  `getTargetClass` in interface `TargetClassAware`
Specified by:
  `getTargetClass` in interface `TargetSource`
Returns:
  the type of targets returned by this `TargetSource`

### isStatic

public boolean isStatic()
Always returns `true`.

Specified by:
  `isStatic` in interface `TargetSource`
Returns:
  `true` if the target is immutable
See Also:
  - `TargetSource.getTarget()`

### getTarget

@Nullable public Object getTarget()
Always returns `null`.

Specified by:
  `getTarget` in interface `TargetSource`
Returns:
  the target object which contains the joinpoint, or `null` if there is no actual target instance

### 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`