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.provider;
018    
019    import com.google.common.collect.Lists;
020    import com.intellij.psi.PsiClass;
021    import org.jetbrains.annotations.NotNull;
022    import org.jetbrains.annotations.Nullable;
023    import org.jetbrains.jet.lang.resolve.java.wrapper.PropertyPsiDataElement;
024    import org.jetbrains.jet.lang.resolve.java.wrapper.PsiMethodWrapper;
025    import org.jetbrains.jet.lang.resolve.name.Name;
026    
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<PsiMethodWrapper> methods = Lists.newArrayList();
040    
041        @NotNull
042        private final List<PropertyPsiDataElement> propertyPsiDataElements = Lists.newArrayList();
043    
044        @Nullable
045        private PsiClass samInterface;
046    
047        void addMethod(@NotNull PsiMethodWrapper method) {
048            methods.add(method);
049        }
050    
051        void addPropertyAccessor(@NotNull PropertyPsiDataElement propertyPsiDataElement) {
052            propertyPsiDataElements.add(propertyPsiDataElement);
053        }
054    
055        void setSamInterface(@NotNull PsiClass samInterface) {
056            this.samInterface = samInterface;
057        }
058    
059        @NotNull
060        public Name getName() {
061            return name;
062        }
063    
064        @NotNull
065        public List<PsiMethodWrapper> getMethods() {
066            return methods;
067        }
068    
069        @NotNull
070        public List<PropertyPsiDataElement> getPropertyPsiDataElements() {
071            return propertyPsiDataElements;
072        }
073    
074        @Nullable
075        public PsiClass getSamInterface() {
076            return samInterface;
077        }
078    }