Class RawJavaFileObject

java.lang.Object
javax.tools.SimpleJavaFileObject
org.codehaus.groovy.tools.javac.RawJavaFileObject
All Implemented Interfaces:
FileObject, JavaFileObject

public class RawJavaFileObject extends SimpleJavaFileObject
Represents a Java source file in file to compile
Since:
3.0.0
  • Constructor Details

    • RawJavaFileObject

      public RawJavaFileObject(URI uri)
      Construct a RawJavaFileObject of the given kind and with the given URI.
      Parameters:
      uri - the URI for this file object
  • Method Details

    • getCharContent

      public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException
      Returns the source content of the underlying file, caching it after the first read.
      Specified by:
      getCharContent in interface FileObject
      Overrides:
      getCharContent in class SimpleJavaFileObject
      Parameters:
      ignoreEncodingErrors - ignored because the file is read using the configured default charset
      Returns:
      the source content
      Throws:
      IOException - if the file cannot be read
    • delete

      public boolean delete()
      delete the Java source file
      Specified by:
      delete in interface FileObject
      Overrides:
      delete in class SimpleJavaFileObject
      Returns:
      true if deleted successfully
    • equals

      public boolean equals(Object o)
      Compares this file object by URI.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare against
      Returns:
      true if the other object represents the same URI
    • hashCode

      public int hashCode()
      Returns the hash code derived from the URI.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • toString

      public String toString()
      Returns a diagnostic string for this file-backed Java file object.
      Overrides:
      toString in class SimpleJavaFileObject
      Returns:
      a string representation of this file object