1 12 13 package org.eclipse.jdt.internal.apt.pluggable.core.filer; 14 15 import java.io.IOException ; 16 import java.io.InputStream ; 17 import java.io.OutputStream ; 18 import java.io.Reader ; 19 import java.io.Writer ; 20 import java.net.URI ; 21 import java.util.Collection ; 22 23 import javax.lang.model.element.Modifier; 24 import javax.lang.model.element.NestingKind; 25 import javax.tools.JavaFileObject; 26 27 import org.eclipse.core.resources.IFile; 28 import org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeProcessingEnvImpl; 29 30 36 public class IdeOutputJavaFileObject implements JavaFileObject { 37 38 private final IdeProcessingEnvImpl _env; 39 private final CharSequence _name; 40 private final Collection <IFile> _parentFiles; 41 42 public IdeOutputJavaFileObject(IdeProcessingEnvImpl env, CharSequence name, Collection <IFile> parentFiles) { 43 _env = env; 44 _parentFiles = parentFiles; 45 _name = name; 46 } 47 48 51 @Override 52 public Modifier getAccessLevel() { 53 throw new UnsupportedOperationException ("Not yet implemented"); 55 } 56 57 60 @Override 61 public Kind getKind() { 62 throw new UnsupportedOperationException ("Not yet implemented"); 64 } 65 66 69 @Override 70 public NestingKind getNestingKind() { 71 throw new UnsupportedOperationException ("Not yet implemented"); 73 } 74 75 78 @Override 79 public boolean isNameCompatible(String simpleName, Kind kind) { 80 throw new UnsupportedOperationException ("Not yet implemented"); 82 } 83 84 87 @Override 88 public boolean delete() { 89 throw new UnsupportedOperationException ("Deleting a file is not permitted from within an annotation processor"); 90 } 91 92 95 @Override 96 public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { 97 throw new IllegalStateException ("Generated files are write-only"); 99 } 100 101 104 @Override 105 public long getLastModified() { 106 throw new UnsupportedOperationException ("Not yet implemented"); 108 } 109 110 113 @Override 114 public String getName() { 115 return _name.toString(); 116 } 117 118 121 @Override 122 public InputStream openInputStream() throws IOException { 123 throw new IllegalStateException ("Opening an input stream on a generated file is not permitted"); 124 } 125 126 129 @Override 130 public OutputStream openOutputStream() throws IOException { 131 throw new UnsupportedOperationException ("Not yet implemented"); 133 } 134 135 138 @Override 139 public Reader openReader(boolean ignoreEncodingErrors) throws IOException { 140 throw new IllegalStateException ("Opening a reader on a generated file is not permitted"); 141 } 142 143 146 @Override 147 public Writer openWriter() throws IOException { 148 return new IdeJavaSourceFileWriter(_env, _name, _parentFiles); 149 } 150 151 154 @Override 155 public URI toUri() { 156 throw new UnsupportedOperationException ("Not yet implemented"); 158 } 159 160 } 161 | Popular Tags |