package jakarta.enterprise.lang.model.declarations; import jakarta.enterprise.lang.model.types.Type; import jakarta.enterprise.lang.model.types.TypeVariable; import java.util.Collection; import java.util.List; /** * A class. Five kinds of classes are distinguished: *
* At the same time, it is possible to obtain the set of {@linkplain #constructors() constructors},
* {@linkplain #methods() methods} and {@linkplain #fields() fields} declared in this class, as well
* as the set of {@linkplain #recordComponents() record components} if this class is a record.
* It is also possible to obtain the {@linkplain #packageInfo() package} this class is declared in.
*
* @since 4.0
*/
public interface ClassInfo extends DeclarationInfo {
/**
* Returns the binary name of this class, as defined by The Java™ Language Specification;
* in other words, the class name as returned by {@link Class#getName()}.
*
* @return binary name of this class, never {@code null}
*/
String name();
/**
* Returns the simple name of this class, as defined by The Java™ Language Specification;
* in other words, the class name as returned by {@link Class#getSimpleName()}.
*
* @return simple name of this class, never {@code null}
*/
String simpleName();
/**
* Returns the {@linkplain PackageInfo package} this class is part of.
* Returns {@code null} if this class is part of an unnamed package.
*
* @return this class's package, or {@code null} if this class is in an unnamed package
*/
PackageInfo packageInfo();
/**
* Returns a list of {@linkplain TypeVariable type parameters} declared on this class.
* Returns an empty list if this class is not generic and so does not declare type parameters.
*
* @return immutable list of this class's type parameters, never {@code null}
*/
List
* A plain class is abstract if declared {@code abstract}.
* An enum is abstract if it declares {@code abstract} methods.
* An interface or an annotation is always abstract.
* A record is never abstract.
*
* @return whether this class is {@code abstract}
*/
boolean isAbstract();
/**
* Returns whether this class is {@code final}.
*
* @return whether this class is {@code final}
*/
boolean isFinal();
/**
* Returns the modifiers of this class as an {@code int}.
* Use {@link java.lang.reflect.Modifier Modifier} to inspect the value.
*
* @return the modifiers of this class
*/
int modifiers();
/**
* Returns a collection of {@linkplain MethodInfo constructors} declared or implicitly declared
* in this class. Constructors declared in direct or indirect superclasses are not included.
*
* If this class is an interface or an annotation, returns an empty collection.
*
* @return immutable collection of constructors, never {@code null}
*/
Collection
* If the collection of methods described above contains multiple methods with the same signature,
* all such methods are returned. {@link MethodInfo#declaringClass() MethodInfo.declaringClass}
* should be used to distinguish such methods.
*
* Iteration order of the resulting collection is not defined and does not have to correspond
* to the inheritance hierarchy of this class.
*
* @return immutable collection of methods, never {@code null}
*/
Collection
* If the collection of fields described above contains multiple fields with the same name,
* all such fields are returned. {@link FieldInfo#declaringClass() FieldInfo.declaringClass}
* should be used to distinguish such fields
*
* Iteration order of the resulting collection is not defined and does not have to correspond
* to the inheritance hierarchy of this class.
*
* @return immutable collection of fields, never {@code null}
*/
Collection