Class AspectJ

  • All Implemented Interfaces:
    IVilType

    public class AspectJ
    extends AbstractFileInstantiator
    Compiles java files using the AspectJ compiler.
    Author:
    Holger Eichelberger
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  AspectJ.CompletionRunner
      A completion runner for AspectJ.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String CLASSPATH_ARG_NAME  
    • Constructor Summary

      Constructors 
      Constructor Description
      AspectJ()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void addAll​(java.io.File file, java.util.List<java.lang.String> args)
      Adds all Java and AJ files to args.
      static Set<FileArtifact> aspectJ​(Path source, Path target, java.util.Map<java.lang.String,​java.lang.Object> other)
      Compiles a source path to a target path.
      private static Set<FileArtifact> aspectJ​(Collection<FileArtifact> source, java.io.File sourceRoot, Path target, java.util.Map<java.lang.String,​java.lang.Object> other)
      Compiles a source path to a target path.
      static Set<FileArtifact> aspectJ​(Collection<FileArtifact> source, Path target, java.util.Map<java.lang.String,​java.lang.Object> other)
      Compiles a source path to a target path.
      private static void handleMessages​(org.aspectj.bridge.MessageHandler handler)
      Handles AspectJ messages.
      private static java.lang.String prepareAspectJClasspath​(java.lang.String classpath)
      Prepares the AspectJ classpath.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CLASSPATH_ARG_NAME

        private static final java.lang.String CLASSPATH_ARG_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • AspectJ

        public AspectJ()
    • Method Detail

      • aspectJ

        public static Set<FileArtifact> aspectJ​(Path source,
                                                Path target,
                                                java.util.Map<java.lang.String,​java.lang.Object> other)
                                         throws VilException
        Compiles a source path to a target path.
        Parameters:
        source - the source path
        target - the target path
        other - the other parameter for the Java compiler, without leading "-"
        Returns:
        the created artifacts
        Throws:
        VilException - in case that artifact creation fails
      • aspectJ

        public static Set<FileArtifact> aspectJ​(Collection<FileArtifact> source,
                                                Path target,
                                                java.util.Map<java.lang.String,​java.lang.Object> other)
                                         throws VilException
        Compiles a source path to a target path.
        Parameters:
        source - the source artifacts
        target - the target path
        other - the other parameter for the Java compiler, without leading "-"
        Returns:
        the created artifacts
        Throws:
        VilException - in case that artifact creation fails
      • aspectJ

        private static Set<FileArtifact> aspectJ​(Collection<FileArtifact> source,
                                                 java.io.File sourceRoot,
                                                 Path target,
                                                 java.util.Map<java.lang.String,​java.lang.Object> other)
                                          throws VilException
        Compiles a source path to a target path.
        Parameters:
        source - the source artifacts
        sourceRoot - optional source root to search Java and AspectJ files within, may be null, supersedes source if given
        target - the target path
        other - the other parameter for the Java compiler, without leading "-"
        Returns:
        the created artifacts
        Throws:
        VilException - in case that artifact creation fails
      • handleMessages

        private static void handleMessages​(org.aspectj.bridge.MessageHandler handler)
                                    throws VilException
        Handles AspectJ messages.
        Parameters:
        handler - the message handler
        Throws:
        VilException - in case that abort of processing is needed
      • addAll

        private static final void addAll​(java.io.File file,
                                         java.util.List<java.lang.String> args)
        Adds all Java and AJ files to args.
        Parameters:
        file - the file or folder to start from
        args - the arguments to be modified as a side effect
      • prepareAspectJClasspath

        private static java.lang.String prepareAspectJClasspath​(java.lang.String classpath)
                                                         throws VilException
        Prepares the AspectJ classpath.
        Parameters:
        classpath - the actual classpath as specified (may be empty)
        Returns:
        the classpath to use
        Throws:
        VilException - are required resources such as aspectj.rt available