org.springframework.aop.aspectj.annotation
Class LazySingletonAspectInstanceFactoryDecorator

java.lang.Object
  extended by org.springframework.aop.aspectj.annotation.LazySingletonAspectInstanceFactoryDecorator
All Implemented Interfaces:
MetadataAwareAspectInstanceFactory, AspectInstanceFactory, Ordered

public class LazySingletonAspectInstanceFactoryDecorator
extends java.lang.Object
implements MetadataAwareAspectInstanceFactory

Decorator to cause a MetadataAwareAspectInstanceFactory to instantiate only once.

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller

Field Summary
private  MetadataAwareAspectInstanceFactory maaif
           
private  java.lang.Object materialized
           
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
LazySingletonAspectInstanceFactoryDecorator(MetadataAwareAspectInstanceFactory maaif)
          Create a new lazily initializing decorator for the given AspectInstanceFactory.
 
Method Summary
 java.lang.ClassLoader getAspectClassLoader()
          Expose the aspect class loader that this factory uses.
 java.lang.Object getAspectInstance()
          Create an instance of this factory's aspect.
 AspectMetadata getAspectMetadata()
          Return the AspectJ AspectMetadata for this factory's aspect.
 int getOrder()
          Return the order value of this object, with a higher value meaning greater in terms of sorting.
 boolean isMaterialized()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

maaif

private final MetadataAwareAspectInstanceFactory maaif

materialized

private volatile java.lang.Object materialized
Constructor Detail

LazySingletonAspectInstanceFactoryDecorator

public LazySingletonAspectInstanceFactoryDecorator(MetadataAwareAspectInstanceFactory maaif)
Create a new lazily initializing decorator for the given AspectInstanceFactory.

Parameters:
maaif - the MetadataAwareAspectInstanceFactory to decorate
Method Detail

getAspectInstance

public java.lang.Object getAspectInstance()
Description copied from interface: AspectInstanceFactory
Create an instance of this factory's aspect.

Specified by:
getAspectInstance in interface AspectInstanceFactory
Returns:
the aspect instance (never null)

isMaterialized

public boolean isMaterialized()

getAspectClassLoader

public java.lang.ClassLoader getAspectClassLoader()
Description copied from interface: AspectInstanceFactory
Expose the aspect class loader that this factory uses.

Specified by:
getAspectClassLoader in interface AspectInstanceFactory
Returns:
the aspect class loader (never null)

getAspectMetadata

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

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

getOrder

public int getOrder()
Description copied from interface: Ordered
Return the order value of this object, with a higher value meaning greater in terms of sorting.

Normally starting with 0, with Integer.MAX_VALUE indicating the greatest value. Same order values will result in arbitrary positions for the affected objects.

Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).

Specified by:
getOrder in interface Ordered
Returns:
the order value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object