Class DefaultMavenEnvironment

java.lang.Object
com.qulice.maven.DefaultMavenEnvironment
All Implemented Interfaces:
Environment

public final class DefaultMavenEnvironment extends Object
Environment, passed from MOJO to validators.
Since:
0.3
Suppressed Checkstyle violations:
ClassDataAbstractionCouplingCheck (300 lines)
  • Constructor Details

    • DefaultMavenEnvironment

      public DefaultMavenEnvironment()
  • Method Details

    • param

      public String param(String name, String value)
      Description copied from interface: Environment
      Get parameter by name, and return default if it's not set.
      Specified by:
      param in interface Environment
      Parameters:
      name - The name of parameter
      value - Default value to return as default
      Returns:
      The value
    • basedir

      public File basedir()
      Description copied from interface: Environment
      Get project's basedir.
      Specified by:
      basedir in interface Environment
      Returns:
      The directory
    • tempdir

      public File tempdir()
      Description copied from interface: Environment
      Get directory to keep temporary files in.
      Specified by:
      tempdir in interface Environment
      Returns:
      The directory
    • outdir

      public File outdir()
      Description copied from interface: Environment
      Get directory where .class files are stored.
      Specified by:
      outdir in interface Environment
      Returns:
      The directory
    • classpath

      public Collection<String> classpath()
      Description copied from interface: Environment
      Get list of paths in classpath.
      Specified by:
      classpath in interface Environment
      Returns:
      The collection of paths
    • classloader

      public ClassLoader classloader()
      Description copied from interface: Environment
      Get classloader for this project.
      Specified by:
      classloader in interface Environment
      Returns:
      The classloader
    • project

      public org.apache.maven.project.MavenProject project()
    • properties

      public Properties properties()
    • context

      public org.codehaus.plexus.context.Context context()
    • config

      public Properties config()
    • executor

      public MojoExecutor executor()
    • asserts

      public Collection<String> asserts()
    • files

      public Collection<File> files(String pattern)
      Description copied from interface: Environment
      Returns the files matching the specified pattern.

      The pattern matching scheme used is wildcard matching. The characters '?' and '*' represents single or multiple wildcard characters, respectively. Pattern matching is case sensitive.

      Specified by:
      files in interface Environment
      Parameters:
      pattern - File name pattern
      Returns:
      Collection of files, matching the specified pattern
    • exclude

      public boolean exclude(String check, String name)
      Description copied from interface: Environment
      Shall this item be excluded from report?
      Specified by:
      exclude in interface Environment
      Parameters:
      check - Name of the check that is asking
      name - File or any other item, which is subject of validation
      Returns:
      TRUE if it should be ignored
    • excludes

      public Collection<String> excludes(String checker)
      Description copied from interface: Environment
      List of exclude patterns for given checker. Each list element will contain exactly one exclude pattern which, depending on the plugin that uses the excludes might be either wildcard (CodeNarc) pattern or regex pattern (FindBugs).
      Specified by:
      excludes in interface Environment
      Parameters:
      checker - Name of the checker that is asking (pmd, codenarc ...)
      Returns:
      Exclude patterns
    • setProject

      public void setProject(org.apache.maven.project.MavenProject proj)
      Set Maven Project (used mostly for unit testing).
      Parameters:
      proj - The project to set
    • setContext

      public void setContext(org.codehaus.plexus.context.Context ctx)
      Set context.
      Parameters:
      ctx - The context to set
    • setMojoExecutor

      public void setMojoExecutor(MojoExecutor exec)
      Set executor.
      Parameters:
      exec - The executor
    • setProperty

      public void setProperty(String name, String value)
      Set property.
      Parameters:
      name - Its name
      value - Its value
    • setExcludes

      public void setExcludes(Collection<String> exprs)
      Set list of regular expressions to exclude.
      Parameters:
      exprs - Expressions
    • setAssertion

      public void setAssertion(Collection<String> ass)
      Set list of Xpath queries for pom.xml validation.
      Parameters:
      ass - Xpath queries
    • setEncoding

      public void setEncoding(String encoding)
    • encoding

      public Charset encoding()
      Description copied from interface: Environment
      Encoding for the files.
      Specified by:
      encoding in interface Environment
      Returns:
      Source files charset