/** @return The {@link ClassInfo} object for the declaring class (i.e. the class that declares this field). */ @Override public ClassInfo getClassInfo() { return super.getClassInfo(); }
/** * Obtain a {@code Class<?>} reference for the class named by this {@link ClassInfo} object. Causes the * ClassLoader to load the class, if it is not already loaded. * * @return The class reference, or null, if ignoreExceptions is true and there was an exception or error loading * the class. * @throws IllegalArgumentException * if ignoreExceptions is false and there were problems loading the class. */ @Override public Class<?> loadClass(final boolean ignoreExceptions) { return super.loadClass(ignoreExceptions); }
/** * Load the class named returned by {@link #getClassInfo()}, or if that returns null, the class named by * {@link #getClassName()}. Returns a {@code Class<?>} reference for the class. * * @param ignoreExceptions * If true, ignore classloading exceptions and return null on failure. * @return The {@code Class<?>} reference for the referenced class, or null if the class could not be loaded and * ignoreExceptions is true. * @throws IllegalArgumentException * if the class could not be loaded and ignoreExceptions was false. */ Class<?> loadClass(final boolean ignoreExceptions) { if (classRef == null) { String className; final ClassInfo classInfo = getClassInfo(); if (classInfo != null) { // Get class name from getClassInfo().getName() className = classInfo.getName(); } else { // Get class name from getClassName() className = getClassName(); } if (className == null) { throw new IllegalArgumentException("Class name is not set"); } classRef = scanResult.loadClass(className, ignoreExceptions); } return classRef; }
@Override void setScanResult(final ScanResult scanResult) { super.setScanResult(scanResult); if (value != null) { value.setScanResult(scanResult); } }
/** * Get the {@link ClassInfo} object for the referenced class, or null if the referenced class was not * encountered during scanning (i.e. no ClassInfo object was created for the class during scanning). N.B. even * if this method returns null, {@link #loadClass()} may be able to load the referenced class by name. * * @return The {@link ClassInfo} object for the referenced class. */ ClassInfo getClassInfo() { if (classInfo == null) { if (scanResult == null) { return null; } final String className = getClassName(); if (className == null) { throw new IllegalArgumentException("Class name is not set"); } classInfo = scanResult.getClassInfo(className); } return classInfo; }
if (classRef == null) { String className; final ClassInfo classInfo = getClassInfo(); if (classInfo != null) { } else { className = getClassName();
@Override void setScanResult(final ScanResult scanResult) { super.setScanResult(scanResult); if (annotationParamValues != null) { for (final AnnotationParameterValue a : annotationParamValues) { a.setScanResult(scanResult); } } }
@Override void setScanResult(final ScanResult scanResult) { super.setScanResult(scanResult); if (typeSignature != null) { typeSignature.setScanResult(scanResult); } }
/** * Obtain a {@code Class<?>} reference for the class named by this {@link ClassInfo} object. Causes the * ClassLoader to load the class, if it is not already loaded. * * @return The class reference. * @throws IllegalArgumentException * if there were problems loading the class. */ @Override public Class<?> loadClass() { return super.loadClass(/* ignoreExceptions = */ false); }
/** @return The {@link ClassInfo} object for the declaring class (i.e. the class that declares this method). */ @Override public ClassInfo getClassInfo() { return super.getClassInfo(); }
@Override void setScanResult(final ScanResult scanResult) { super.setScanResult(scanResult); if (this.typeSignature != null) { this.typeSignature.setScanResult(scanResult); } if (this.typeDescriptor != null) { this.typeDescriptor.setScanResult(scanResult); } if (this.annotationInfo != null) { for (final AnnotationInfo ai : this.annotationInfo) { ai.setScanResult(scanResult); } } }
/** * Load the class named returned by {@link #getClassInfo()}, or if that returns null, the class named by * {@link #getClassName()}. Returns a {@code Class<?>} reference for the class. * * @return The {@code Class<?>} reference for the referenced class, or null if the class could not be loaded and * ignoreExceptions is true. * @throws IllegalArgumentException * if the class could not be loaded and ignoreExceptions was false. */ Class<?> loadClass() { return loadClass(/* ignoreExceptions = */ false); } }
/** @return The {@link ClassInfo} object for the annotation class. */ @Override public ClassInfo getClassInfo() { getClassName(); return super.getClassInfo(); }
@Override void setScanResult(final ScanResult scanResult) { super.setScanResult(scanResult); if (enumValue != null) { enumValue.setScanResult(scanResult); } else if (classRef != null) { classRef.setScanResult(scanResult); } else if (annotationInfo != null) { annotationInfo.setScanResult(scanResult); } else if (objectArrayValue != null) { for (final ObjectTypedValueWrapper anObjectArrayValue : objectArrayValue) { if (anObjectArrayValue != null) { anObjectArrayValue.setScanResult(scanResult); } } } }
/** * Load the class named returned by {@link #getClassInfo()}, or if that returns null, the class named by * {@link #getClassName()}. Returns a {@code Class<?>} reference for the class, cast to the requested superclass * or interface type. * * @param superclassOrInterfaceType * The type to cast the resulting class reference to. * @return The {@code Class<?>} reference for the referenced class, or null if the class could not be loaded (or * casting failed) and ignoreExceptions is true. * @throws IllegalArgumentException * if the class could not be loaded or cast, and ignoreExceptions was false. */ <T> Class<T> loadClass(final Class<T> superclassOrInterfaceType) { return loadClass(superclassOrInterfaceType, /* ignoreExceptions = */ false); }
/** * @return The {@link ClassInfo} object for the referenced class, or null if the referenced class was not * encountered during scanning (i.e. if no ClassInfo object was created for the class during scanning). * N.B. even if this method returns null, {@link #loadClass()} may be able to load the referenced class * by name. */ @Override public ClassInfo getClassInfo() { getClassName(); return super.getClassInfo(); }
@Override void setScanResult(final ScanResult scanResult) { super.setScanResult(scanResult); if (this.typeSignature != null) { this.typeSignature.setScanResult(scanResult); } if (annotationInfo != null) { for (final AnnotationInfo ai : annotationInfo) { ai.setScanResult(scanResult); } } if (fieldInfo != null) { for (final FieldInfo fi : fieldInfo) { fi.setScanResult(scanResult); } } if (methodInfo != null) { for (final MethodInfo mi : methodInfo) { mi.setScanResult(scanResult); } } if (annotationDefaultParamValues != null) { for (final AnnotationParameterValue apv : annotationDefaultParamValues) { apv.setScanResult(scanResult); } } }
/** * Obtain a {@code Class<?>} reference for the class named by this {@link ClassInfo} object, casting it to the * requested interface or superclass type. Causes the ClassLoader to load the class, if it is not already * loaded. * * <p> * <b>Important note:</b> since {@code superclassOrInterfaceType} is a class reference for an already-loaded * class, it is critical that {@code superclassOrInterfaceType} is loaded by the same classloader as the class * referred to by this {@code ClassInfo} object, otherwise the class cast will fail. * * @param superclassOrInterfaceType * The type to cast the loaded class to. * @return The class reference. * @throws IllegalArgumentException * if there were problems loading the class or casting it to the requested type. */ @Override public <T> Class<T> loadClass(final Class<T> superclassOrInterfaceType) { return super.loadClass(superclassOrInterfaceType, /* ignoreExceptions = */ false); }
@Override void setScanResult(final ScanResult scanResult) { super.setScanResult(scanResult); if (this.typeDescriptor != null) { this.typeDescriptor.setScanResult(scanResult); } if (this.typeSignature != null) { this.typeSignature.setScanResult(scanResult); } if (this.annotationInfo != null) { for (final AnnotationInfo ai : this.annotationInfo) { ai.setScanResult(scanResult); } } if (this.parameterAnnotationInfo != null) { for (final AnnotationInfo[] pai : this.parameterAnnotationInfo) { if (pai != null) { for (final AnnotationInfo ai : pai) { ai.setScanResult(scanResult); } } } } if (this.parameterInfo != null) { for (final MethodParameterInfo mpi : parameterInfo) { mpi.setScanResult(scanResult); } } }
/** * Obtain a {@code Class<?>} reference for the class named by this {@link ClassInfo} object, casting it to the * requested interface or superclass type. Causes the ClassLoader to load the class, if it is not already * loaded. * * <p> * <b>Important note:</b> since {@code superclassOrInterfaceType} is a class reference for an already-loaded * class, it is critical that {@code superclassOrInterfaceType} is loaded by the same classloader as the class * referred to by this {@code ClassInfo} object, otherwise the class cast will fail. * * @param superclassOrInterfaceType * The type to cast the loaded class to. * @param ignoreExceptions * If true, return null if any exceptions or errors thrown during classloading, or if attempting to * cast the resulting {@code Class<?>} reference to the requested superclass or interface type fails. * If false, {@link IllegalArgumentException} is thrown if the class could not be loaded or could not * be cast to the requested type. * @return The class reference, or null, if ignoreExceptions is true and there was an exception or error loading * the class. * @throws IllegalArgumentException * if ignoreExceptions is false and there were problems loading the class, or casting it to the * requested type. */ @Override public <T> Class<T> loadClass(final Class<T> superclassOrInterfaceType, final boolean ignoreExceptions) { return super.loadClass(superclassOrInterfaceType, ignoreExceptions); }