Package org.springframework.aop.aspectj.annotation

# Class SingletonMetadataAwareAspectInstanceFactory

java.lang.Object
org.springframework.aop.aspectj.SingletonAspectInstanceFactory
org.springframework.aop.aspectj.annotation.SingletonMetadataAwareAspectInstanceFactory

All Implemented Interfaces:
  `Serializable`, `MetadataAwareAspectInstanceFactory`, `AspectInstanceFactory`, `org.springframework.core.Ordered`

public class SingletonMetadataAwareAspectInstanceFactory extends SingletonAspectInstanceFactory implements MetadataAwareAspectInstanceFactory, Serializable
Implementation of `MetadataAwareAspectInstanceFactory` that is backed by a specified singleton object, returning the same instance for every `SingletonAspectInstanceFactory.getAspectInstance()` call.

Since:
  2.0
Author:
  Rod Johnson, Juergen Hoeller
See Also:
  - `SimpleMetadataAwareAspectInstanceFactory`
  - Serialized Form

## Field Summary

### Fields inherited from interface org.springframework.core.Ordered

`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

## Constructor Summary

Constructors
Constructor
Description
`SingletonMetadataAwareAspectInstanceFactory(Object aspectInstance, String aspectName)`
Create a new SingletonMetadataAwareAspectInstanceFactory for the given aspect.

## Method Summary

Modifier and Type
Method
Description
`Object`
`getAspectCreationMutex()`
Get the best possible creation mutex for this factory.
`final AspectMetadata`
`getAspectMetadata()`
Get the AspectJ AspectMetadata for this factory's aspect.
`protected int`
`getOrderForAspectClass(Class<?> aspectClass)`
Determine a fallback order for the case that the aspect instance does not express an instance-specific order through implementing the `Ordered` interface.

### Methods inherited from class org.springframework.aop.aspectj.SingletonAspectInstanceFactory

`getAspectClassLoader, getAspectInstance, getOrder`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.aop.aspectj.AspectInstanceFactory

`getAspectClassLoader, getAspectInstance`

### Methods inherited from interface org.springframework.core.Ordered

`getOrder`

## Constructor Details

### SingletonMetadataAwareAspectInstanceFactory

public SingletonMetadataAwareAspectInstanceFactory(Object aspectInstance, String aspectName)
Create a new SingletonMetadataAwareAspectInstanceFactory for the given aspect.

Parameters:
  `aspectInstance` - the singleton aspect instance
  `aspectName` - the name of the aspect

## Method Details

### getAspectMetadata

public final AspectMetadata getAspectMetadata()
Description copied from interface: `MetadataAwareAspectInstanceFactory`
Get the AspectJ AspectMetadata for this factory's aspect.

Specified by:
  `getAspectMetadata` in interface `MetadataAwareAspectInstanceFactory`
Returns:
  the aspect metadata

### getAspectCreationMutex

public Object getAspectCreationMutex()
Description copied from interface: `MetadataAwareAspectInstanceFactory`
Get the best possible creation mutex for this factory.

Specified by:
  `getAspectCreationMutex` in interface `MetadataAwareAspectInstanceFactory`
Returns:
  the mutex object (may be `null` for no mutex to use)

### getOrderForAspectClass

protected int getOrderForAspectClass(Class<?> aspectClass)
Description copied from class: `SingletonAspectInstanceFactory`
Determine a fallback order for the case that the aspect instance does not express an instance-specific order through implementing the `Ordered` interface.

The default implementation simply returns `Ordered.LOWEST_PRECEDENCE`.

Overrides:
  `getOrderForAspectClass` in class `SingletonAspectInstanceFactory`
Parameters:
  `aspectClass` - the aspect class