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.resolve.java.scope;
018
019 import org.jetbrains.annotations.NotNull;
020 import org.jetbrains.annotations.Nullable;
021 import org.jetbrains.jet.lang.resolve.java.structure.JavaClass;
022 import org.jetbrains.jet.lang.resolve.java.structure.JavaField;
023 import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod;
024 import org.jetbrains.jet.lang.resolve.name.Name;
025
026 import java.util.ArrayList;
027 import java.util.List;
028
029 public final class NamedMembers {
030
031 public NamedMembers(@NotNull Name name) {
032 this.name = name;
033 }
034
035 @NotNull
036 private final Name name;
037
038 @NotNull
039 private final List<JavaMethod> methods = new ArrayList<JavaMethod>();
040
041 @NotNull
042 private final List<JavaField> fields = new ArrayList<JavaField>();
043
044 @Nullable
045 private JavaClass samInterface;
046
047 void addMethod(@NotNull JavaMethod method) {
048 methods.add(method);
049 }
050
051 void addField(@NotNull JavaField field) {
052 fields.add(field);
053 }
054
055 void setSamInterface(@NotNull JavaClass samInterface) {
056 this.samInterface = samInterface;
057 }
058
059 @NotNull
060 public Name getName() {
061 return name;
062 }
063
064 @NotNull
065 public List<JavaMethod> getMethods() {
066 return methods;
067 }
068
069 @NotNull
070 public List<JavaField> getFields() {
071 return fields;
072 }
073
074 @Nullable
075 public JavaClass getSamInterface() {
076 return samInterface;
077 }
078 }