Example usage for javax.tools FileObject delete

List of usage examples for javax.tools FileObject delete

Introduction

In this page you can find the example usage for javax.tools FileObject delete.

Prototype

boolean delete();

Source Link

Document

Deletes this file object.

Usage

From source file:org.jannocessor.processor.JannocessorProcessorBase.java

private String getPath(Location location) {
    String path;// ww w .  j a  va  2 s  .com

    try {
        FileObject tempFile = filer.getResource(location, "", "jannocessor_temporary");
        path = tempFile.toUri().getPath().replaceFirst("/jannocessor_temporary$", "").substring(1);
    } catch (Exception e) {
        try {
            FileObject tempFile = filer.createResource(location, "", "jannocessor_temporary");
            path = tempFile.toUri().getPath().replaceFirst("/jannocessor_temporary$", "").substring(1);
            tempFile.delete();
        } catch (Exception e2) {
            throw new RuntimeException("Cannot calculate path: " + location, e2);
        }
    }

    return path;
}