001/** 002 * Copyright 2013 John Ericksen 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.androidtransfuse.config; 017 018import javax.annotation.processing.Filer; 019import javax.lang.model.element.Element; 020import javax.tools.FileObject; 021import javax.tools.JavaFileManager; 022import javax.tools.JavaFileObject; 023import java.io.IOException; 024 025/** 026 * @author John Ericksen 027 */ 028public class SynchronizedFiler implements Filer { 029 030 private Filer delegate; 031 032 public SynchronizedFiler(Filer delegate) { 033 this.delegate = delegate; 034 } 035 036 @Override 037 public synchronized JavaFileObject createSourceFile(CharSequence charSequence, Element... elements) throws IOException { 038 return delegate.createSourceFile(charSequence, elements); 039 } 040 041 @Override 042 public synchronized JavaFileObject createClassFile(CharSequence charSequence, Element... elements) throws IOException { 043 return delegate.createClassFile(charSequence, elements); 044 } 045 046 @Override 047 public synchronized FileObject createResource(JavaFileManager.Location location, CharSequence charSequence, CharSequence charSequence1, Element... elements) throws IOException { 048 return delegate.createResource(location, charSequence, charSequence1, elements); 049 } 050 051 @Override 052 public synchronized FileObject getResource(JavaFileManager.Location location, CharSequence charSequence, CharSequence charSequence1) throws IOException { 053 return delegate.getResource(location, charSequence, charSequence1); 054 } 055}