Package: org.codehaus.groovy.tools.javac

## [Java] Class MemJavaFileObject

- org.codehaus.groovy.tools.javac.MemJavaFileObject

-     public class MemJavaFileObject
      extends SimpleJavaFileObject

  Represents a Java source file in memory to compile

  Since:
    3.0.0

- - ### Constructor Summary

    Constructors
    Constructor and description
    `MemJavaFileObject(ClassNode classNode, String src)` Construct a MemJavaFileObject instance with given class node and source code
    `MemJavaFileObject(String className, String src)` Construct a MemJavaFileObject instance with given class name and source code

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `equals(Object o)` Compares this file object by its class name.
    `` | `public CharSequence` | `getCharContent(boolean ignoreEncodingErrors)` Returns the in-memory source content.
    `` | `public int` | `hashCode()` Returns the hash code derived from the class name.
    `` | `public String` | `toString()` Returns a diagnostic string for this in-memory Java file object.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class SimpleJavaFileObject` | `delete, equals, getAccessLevel, getCharContent, getClass, getKind, getLastModified, getName, getNestingKind, hashCode, isNameCompatible, notify, notifyAll, openInputStream, openOutputStream, openReader, openWriter, toString, toUri, wait, wait, wait`

- - ### Constructor Detail

    - #### public MemJavaFileObject(ClassNode classNode, String src)

      Construct a MemJavaFileObject instance with given class node and source code

      Parameters:
        `classNode` - the class node
        `src` - the source code

    - #### public MemJavaFileObject(String className, String src)

      Construct a MemJavaFileObject instance with given class name and source code

      Parameters:
        `className` - the class name
        `src` - the source code

  - ### Method Detail

    - #### public boolean equals(Object o)

      Compares this file object by its class name.

      Parameters:
        `o` - the object to compare against
      Returns:
        `true` if the other object represents the same class name

    - #### public CharSequence getCharContent(boolean ignoreEncodingErrors)

      Returns the in-memory source content.

      Parameters:
        `ignoreEncodingErrors` - ignored because the content is already a character sequence
      Returns:
        the source content

    - #### public int hashCode()

      Returns the hash code derived from the class name.

      Returns:
        the hash code

    - #### public String toString()

      Returns a diagnostic string for this in-memory Java file object.

      Returns:
        a string representation of this file object