001 /* 002 * Copyright 2010-2013 JetBrains s.r.o. 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 */ 016 017 package org.jetbrains.jet.lang.parsing; 018 019 import org.jetbrains.annotations.Nullable; 020 import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter; 021 import org.jetbrains.jet.lang.resolve.ImportPath; 022 023 import java.util.ArrayList; 024 import java.util.Arrays; 025 import java.util.Collections; 026 import java.util.List; 027 028 public class JetScriptDefinition { 029 private final String extension; 030 private final List<AnalyzerScriptParameter> parameters; 031 032 public JetScriptDefinition(String extension, List<AnalyzerScriptParameter> scriptParameters) { 033 this.extension = extension; 034 parameters = scriptParameters == null ? Collections.<AnalyzerScriptParameter>emptyList() : scriptParameters; 035 } 036 037 private static List<ImportPath> importPaths(List<String> imports) { 038 ArrayList<ImportPath> paths = new ArrayList<ImportPath>(imports.size()); 039 for (String anImport : imports) { 040 paths.add(new ImportPath(anImport)); 041 } 042 return paths; 043 } 044 045 public JetScriptDefinition(String extension, AnalyzerScriptParameter... scriptParameters) { 046 this(extension, Arrays.asList(scriptParameters)); 047 } 048 049 public List<AnalyzerScriptParameter> getScriptParameters() { 050 return parameters; 051 } 052 053 public String getExtension() { 054 return extension; 055 } 056 }