AspectJ
AspectJ is an actively used programming language created in 2001. AspectJ is an aspect-oriented programming (AOP) extension created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become a widely used de facto standard for AOP by emphasizing simplicity and usability for end users. Read more on Wikipedia...
19Years Old | 525Users | ?Jobs |
- AspectJ ranks in the top 5% of languages
- the AspectJ website
- the AspectJ wikipedia page
- AspectJ first appeared in 2001
- file extensions for AspectJ include aj
- See also: java, eclipse-editor, emacs-editor, isbn
- Have a question about AspectJ not answered here? Email me and let me know how I can help.
Example code from Linguist:
package com.blogspot.miguelinlas3.aspectj.cache; import java.util.Map; import java.util.WeakHashMap; import org.aspectj.lang.JoinPoint; import com.blogspot.miguelinlas3.aspectj.cache.marker.Cachable; /** * This simple aspect simulates the behaviour of a very simple cache * * @author migue * */ public aspect CacheAspect { public pointcut cache(Cachable cachable): execution(@Cachable * * (..)) && @annotation(cachable); Object around(Cachable cachable): cache(cachable){ String evaluatedKey = this.evaluateKey(cachable.scriptKey(), thisJoinPoint); if(cache.containsKey(evaluatedKey)){ System.out.println("Cache hit for key " + evaluatedKey); return this.cache.get(evaluatedKey); } System.out.println("Cache miss for key " + evaluatedKey); Object value = proceed(cachable); cache.put(evaluatedKey, value); return value; } protected String evaluateKey(String key, JoinPoint joinPoint) { // TODO add some smart staff to allow simple scripting in @Cachable annotation return key; } protected Map<String, Object> cache = new WeakHashMap<String, Object>(); }
Example code from Wikipedia:
pointcut set() : execution(* set*(..) ) && this(Point);
Trending Repos
repo | stars | description |
---|
Last updated August 9th, 2020