001/* 002 * Copyright 2002-2017 the original author or authors. 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 * https://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.springframework.core.type; 018 019/** 020 * Interface that defines abstract metadata of a specific class, 021 * in a form that does not require that class to be loaded yet. 022 * 023 * @author Juergen Hoeller 024 * @since 2.5 025 * @see StandardClassMetadata 026 * @see org.springframework.core.type.classreading.MetadataReader#getClassMetadata() 027 * @see AnnotationMetadata 028 */ 029public interface ClassMetadata { 030 031 /** 032 * Return the name of the underlying class. 033 */ 034 String getClassName(); 035 036 /** 037 * Return whether the underlying class represents an interface. 038 */ 039 boolean isInterface(); 040 041 /** 042 * Return whether the underlying class represents an annotation. 043 * @since 4.1 044 */ 045 boolean isAnnotation(); 046 047 /** 048 * Return whether the underlying class is marked as abstract. 049 */ 050 boolean isAbstract(); 051 052 /** 053 * Return whether the underlying class represents a concrete class, 054 * i.e. neither an interface nor an abstract class. 055 */ 056 boolean isConcrete(); 057 058 /** 059 * Return whether the underlying class is marked as 'final'. 060 */ 061 boolean isFinal(); 062 063 /** 064 * Determine whether the underlying class is independent, i.e. whether 065 * it is a top-level class or a nested class (static inner class) that 066 * can be constructed independently from an enclosing class. 067 */ 068 boolean isIndependent(); 069 070 /** 071 * Return whether the underlying class is declared within an enclosing 072 * class (i.e. the underlying class is an inner/nested class or a 073 * local class within a method). 074 * <p>If this method returns {@code false}, then the underlying 075 * class is a top-level class. 076 */ 077 boolean hasEnclosingClass(); 078 079 /** 080 * Return the name of the enclosing class of the underlying class, 081 * or {@code null} if the underlying class is a top-level class. 082 */ 083 String getEnclosingClassName(); 084 085 /** 086 * Return whether the underlying class has a super class. 087 */ 088 boolean hasSuperClass(); 089 090 /** 091 * Return the name of the super class of the underlying class, 092 * or {@code null} if there is no super class defined. 093 */ 094 String getSuperClassName(); 095 096 /** 097 * Return the names of all interfaces that the underlying class 098 * implements, or an empty array if there are none. 099 */ 100 String[] getInterfaceNames(); 101 102 /** 103 * Return the names of all classes declared as members of the class represented by 104 * this ClassMetadata object. This includes public, protected, default (package) 105 * access, and private classes and interfaces declared by the class, but excludes 106 * inherited classes and interfaces. An empty array is returned if no member classes 107 * or interfaces exist. 108 * @since 3.1 109 */ 110 String[] getMemberClassNames(); 111 112}