Class SourceFile

java.lang.Object
org.codelibs.maven.yuicompressor.SourceFile

public class SourceFile extends Object
Represents a source file with its source and destination roots. Handles file path resolution and destination file creation.
  • Constructor Details

    • SourceFile

      public SourceFile(File srcRoot, File destRoot, String name, boolean destAsSource)
      Creates a new SourceFile instance.
      Parameters:
      srcRoot - the source root directory
      destRoot - the destination root directory
      name - the relative file name
      destAsSource - whether to use destination as source if available
      Throws:
      IllegalArgumentException - if any required parameter is null or invalid
  • Method Details

    • toFile

      public File toFile()
      Returns the source file. If destAsSource is true and destination file exists, returns the destination file instead.
      Returns:
      the file to be used as source
    • toDestFile

      public File toDestFile(String suffix)
      Creates a destination file with the given suffix.
      Parameters:
      suffix - the suffix to append before the extension
      Returns:
      the destination file
    • getExtension

      public String getExtension()
      Returns the file extension including the dot.
      Returns:
      the file extension (e.g., ".js", ".css") or empty string if no extension