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.kotlin;
018    
019    import org.jetbrains.annotations.NotNull;
020    import org.jetbrains.annotations.Nullable;
021    import org.jetbrains.jet.lang.resolve.java.JvmClassName;
022    import org.jetbrains.jet.lang.resolve.kotlin.header.KotlinClassHeader;
023    import org.jetbrains.jet.lang.resolve.name.Name;
024    
025    public interface KotlinJvmBinaryClass {
026        @NotNull
027        JvmClassName getClassName();
028    
029        void loadClassAnnotations(@NotNull AnnotationVisitor visitor);
030    
031        void visitMembers(@NotNull MemberVisitor visitor);
032    
033        @NotNull
034        KotlinClassHeader getClassHeader();
035    
036        interface MemberVisitor {
037            // TODO: abstract signatures for methods and fields instead of ASM 'desc' strings?
038    
039            @Nullable
040            MethodAnnotationVisitor visitMethod(@NotNull Name name, @NotNull String desc);
041    
042            @Nullable
043            AnnotationVisitor visitField(@NotNull Name name, @NotNull String desc, @Nullable Object initializer);
044        }
045    
046        interface AnnotationVisitor {
047            @Nullable
048            AnnotationArgumentVisitor visitAnnotation(@NotNull JvmClassName className);
049    
050            void visitEnd();
051        }
052    
053        interface MethodAnnotationVisitor extends AnnotationVisitor {
054            @Nullable
055            AnnotationArgumentVisitor visitParameterAnnotation(int index, @NotNull JvmClassName className);
056        }
057    
058        interface AnnotationArgumentVisitor {
059            // TODO: annotations, java.lang.Class
060            void visit(@Nullable Name name, @Nullable Object value);
061    
062            void visitEnum(@NotNull Name name, @NotNull JvmClassName enumClassName, @NotNull Name enumEntryName);
063    
064            @Nullable
065            AnnotationArgumentVisitor visitArray(@NotNull Name name);
066    
067            void visitEnd();
068        }
069    }