001 /*
002 * Copyright 2006 Google Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005 * use this file except in compliance with the License. You may obtain a copy of
006 * 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, WITHOUT
012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013 * License for the specific language governing permissions and limitations under
014 * the License.
015 */
016 package com.google.gwt.core.ext.typeinfo;
017
018 import com.google.gwt.core.ext.UnableToCompleteException;
019
020 import java.util.Comparator;
021
022 /**
023 * Provides information about a single compilation unit on demand.
024 */
025 public interface CompilationUnitProvider {
026
027 long getLastModified() throws UnableToCompleteException;
028
029 String getLocation();
030
031 String getPackageName();
032
033 char[] getSource() throws UnableToCompleteException;
034
035 Comparator LOCATION_COMPARATOR = new Comparator() {
036 public int compare(Object o1, Object o2) {
037 String loc1 = ((CompilationUnitProvider) o1).getLocation();
038 String loc2 = ((CompilationUnitProvider) o2).getLocation();
039 return loc1.compareTo(loc2);
040 }
041 };
042 }