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
017package org.jetbrains.k2js.facade;
018
019import org.jetbrains.annotations.NotNull;
020
021import java.util.Collections;
022import java.util.List;
023
024public abstract class MainCallParameters {
025    @NotNull
026    public static MainCallParameters noCall() {
027        return new MainCallParameters() {
028
029            @NotNull
030            @Override
031            public List<String> arguments() {
032                throw new UnsupportedOperationException("#arguments");
033            }
034
035            @Override
036            public boolean shouldBeGenerated() {
037                return false;
038            }
039        };
040    }
041
042
043    @NotNull
044    public static MainCallParameters mainWithoutArguments() {
045        return new MainCallParameters() {
046
047            @NotNull
048            @Override
049            public List<String> arguments() {
050                return Collections.emptyList();
051            }
052
053            @Override
054            public boolean shouldBeGenerated() {
055                return true;
056            }
057        };
058    }
059
060    @NotNull
061    public static MainCallParameters mainWithArguments(@NotNull final List<String> parameters) {
062        return new MainCallParameters() {
063
064            @NotNull
065            @Override
066            public List<String> arguments() {
067                return parameters;
068            }
069
070            @Override
071            public boolean shouldBeGenerated() {
072                return true;
073            }
074        };
075    }
076
077    public abstract boolean shouldBeGenerated();
078
079    @NotNull
080    public abstract List<String> arguments();
081}