Java™ Platform
Standard Ed. 8
compact3
javax.tools
Class SimpleJavaFileObject
-
- All Implemented Interfaces:
- FileObject, JavaFileObject
public class SimpleJavaFileObject
extends Object
implements JavaFileObject
Provides simple implementations for most methods in JavaFileObject.
This class is designed to be subclassed and used as a basis for
JavaFileObject implementations. Subclasses can override the
implementation and specification of any method of this class as
long as the general contract of JavaFileObject is obeyed.
- Since:
- 1.6
-
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
protected JavaFileObject.Kind |
kind |
The kind of this file object.
|
protected URI |
uri |
A URI for this file object.
|
-
-
Constructor Detail
-
SimpleJavaFileObject
protected SimpleJavaFileObject(URI uri,
JavaFileObject.Kind kind)
Construct a SimpleJavaFileObject of the given kind and with the
given URI.
- Parameters:
uri - the URI for this file object
kind - the kind of this file object
-
Method Detail
-
getName
public String getName()
Gets a user-friendly name for this file object. The exact
value returned is not specified but implementations should take
care to preserve names as given by the user. For example, if
the user writes the filename
"BobsApp\Test.java" on
the command line, this method should return
"BobsApp\Test.java" whereas the
toUri
method might return
file:///C:/Documents%20and%20Settings/UncleBob/BobsApp/Test.java.
- Specified by:
getName in interface FileObject
- Returns:
- a user-friendly name
-
delete
public boolean delete()
This implementation does nothing. Subclasses can change this
behavior as long as the contract of
FileObject is
obeyed.
- Specified by:
delete in interface FileObject
- Returns:
false
-
toString
public String toString()
Description copied from class: Object
Returns a string representation of the object. In general, the
toString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
- Overrides:
toString in class Object
- Returns:
- a string representation of the object.
Java™ Platform
Standard Ed. 8
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.