com.intellij.psi.PsiAnnotation Java Examples

The following examples show how to use com.intellij.psi.PsiAnnotation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationDetector.java    From here-be-dragons with MIT License 7 votes vote down vote up
static PsiAnnotation findAnnotation(PsiElement element, String annotationName) {
    if (element instanceof PsiModifierListOwner) {
        PsiModifierListOwner listOwner = (PsiModifierListOwner) element;
        PsiModifierList modifierList = listOwner.getModifierList();

        if (modifierList != null) {
            for (PsiAnnotation psiAnnotation : modifierList.getAnnotations()) {
                if (annotationName.equals(psiAnnotation.getQualifiedName())) {
                    return psiAnnotation;
                }
            }
        }

    }
    return null;
}
 
Example #2
Source File: TestSizeFinder.java    From intellij with Apache License 2.0 7 votes vote down vote up
@Nullable
public static TestSize getTestSize(PsiClass psiClass) {
  PsiModifierList psiModifierList = psiClass.getModifierList();
  if (psiModifierList == null) {
    return null;
  }
  PsiAnnotation[] annotations = psiModifierList.getAnnotations();
  TestSize testSize = getTestSize(annotations);
  if (testSize != null) {
    return testSize;
  }
  String fullText = psiModifierList.getText();
  return CATEGORY_ANNOTATION_HEURISTIC
      .entrySet()
      .stream()
      .filter(e -> fullText.contains(e.getKey()))
      .map(Map.Entry::getValue)
      .findFirst()
      .orElse(null);
}
 
Example #3
Source File: MixinsAnnotationDeclaredOnMixinType.java    From attic-polygene-java with Apache License 2.0 6 votes vote down vote up
@Override
public ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
                                       @NotNull InspectionManager manager,
                                       boolean isOnTheFly )
{
    PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
    if( mixinsAnnotation == null )
    {
        return null;
    }

    if( psiClass.isInterface() )
    {
        return null;
    }

    String message = message( "mixins.annotation.declared.on.mixin.type.error.declared.on.class" );
    RemoveInvalidMixinClassReferenceFix fix = new RemoveInvalidMixinClassReferenceFix( mixinsAnnotation );
    ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( mixinsAnnotation, message, fix,
                                                                           GENERIC_ERROR_OR_WARNING );
    return new ProblemDescriptor[]{ problemDescriptor };

}
 
Example #4
Source File: JsonConfigAnnotationIssueDetector.java    From aircon with MIT License 6 votes vote down vote up
@Override
public final void visit(final UAnnotation node) {
	final PsiAnnotation nodePsi = node.getJavaPsi();
	if (nodePsi == null || !ConfigElementsUtils.isJsonConfigAnnotation(nodePsi)) {
		return;
	}

	final PsiClass jsonType = ConfigElementsUtils.getJsonTypeAttribute(nodePsi);
	if (jsonType == null) {
		return;
	}

	final int genericTypesCount = ConfigElementsUtils.getGenericTypesCount(nodePsi);

	visitJsonConfigAnnotation(node, jsonType, genericTypesCount);
}
 
Example #5
Source File: PsiAnnotationProxyUtils.java    From litho with Apache License 2.0 6 votes vote down vote up
private Object invoke(Method method, Object[] args) throws IllegalAccessException {
  Class<?> returnType = method.getReturnType();
  if (returnType.isEnum()) {
    PsiAnnotation currentAnnotation =
        AnnotationUtil.findAnnotationInHierarchy(
            mListOwner, Collections.singleton(mAnnotationClass.getCanonicalName()));
    PsiReferenceExpression declaredValue =
        (PsiReferenceExpression) currentAnnotation.findAttributeValue(method.getName());
    if (declaredValue == null) {
      return method.getDefaultValue();
    }
    PsiIdentifier identifier = PsiTreeUtil.getChildOfType(declaredValue, PsiIdentifier.class);
    return Enum.valueOf((Class<Enum>) returnType, identifier.getText());
  }

  try {
    if (args == null) {
      return method.invoke(mStubbed);
    }
    return method.invoke(mStubbed, args);
  } catch (InvocationTargetException e) {
    return method.getDefaultValue();
  }
}
 
Example #6
Source File: OkJsonUpdateLineMarkerProvider.java    From NutzCodeInsight with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
    try {
        PsiAnnotation psiAnnotation = this.getPsiAnnotation(psiElement);
        if (psiAnnotation != null) {
            PsiLiteralExpression literalExpression = (PsiLiteralExpression) psiAnnotation.findAttributeValue("value");
            String value = String.valueOf(literalExpression.getValue());
            if (value.startsWith(JSON_PREFIX)) {
                return new LineMarkerInfo<>(psiAnnotation, psiAnnotation.getTextRange(), NutzCons.NUTZ,
                        new FunctionTooltip("快速配置"),
                        new OkJsonUpdateNavigationHandler(value),
                        GutterIconRenderer.Alignment.LEFT);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
Example #7
Source File: BeanUtils.java    From camel-idea-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * If element at this location specifies a reference to a bean (e.g. a BeanInject annotation, bean property reference,
 * etc.), returns the expected type of that bean
 */
public PsiType findExpectedBeanTypeAt(PsiElement location) {
    PsiAnnotation annotation = PsiTreeUtil.getParentOfType(location, PsiAnnotation.class);
    if (annotation != null) {
        return IdeaUtils.getService().findAnnotatedElementType(annotation);
    }
    return Optional.ofNullable(PsiTreeUtil.getParentOfType(location, XmlAttributeValue.class, false))
            .filter(e -> Arrays.stream(e.getReferences()).anyMatch(ref -> ref instanceof BeanReference))
            .map(e -> PsiTreeUtil.getParentOfType(e, XmlTag.class))
            .map(this::findPropertyNameReference)
            .map(PropertyNameReference::resolve)
            .map(target -> {
                if (target instanceof PsiField) {
                    return ((PsiField) target).getType();
                } else if (target instanceof PsiMethod) {
                    return ((PsiMethod) target).getParameterList().getParameters()[0].getType();
                } else {
                    return null;
                }
            })
            .orElse(null);
}
 
Example #8
Source File: SqliteMagicInspection.java    From sqlitemagic with Apache License 2.0 6 votes vote down vote up
@Override
public void visitAnnotation(PsiAnnotation annotation) {
  super.visitAnnotation(annotation);

  final String qualifiedName = annotation.getQualifiedName();
  if (StringUtils.isNotBlank(qualifiedName) && allProblemHandlers.containsKey(qualifiedName)) {
    final Collection<SqliteMagicProblem> problems = new HashSet<SqliteMagicProblem>();

    for (Processor inspector : allProblemHandlers.get(qualifiedName)) {
      problems.addAll(inspector.verifyAnnotation(annotation));
    }

    for (SqliteMagicProblem problem : problems) {
      holder.registerProblem(annotation, problem.getMessage(), problem.getHighlightType(), problem.getQuickFixes());
    }
  }
}
 
Example #9
Source File: PsiConsultantImpl.java    From dagger-intellij-plugin with Apache License 2.0 6 votes vote down vote up
public static Set<String> getQualifierAnnotations(PsiElement element) {
  Set<String> qualifiedClasses = new HashSet<String>();

  if (element instanceof PsiModifierListOwner) {
    PsiModifierListOwner listOwner = (PsiModifierListOwner) element;
    PsiModifierList modifierList = listOwner.getModifierList();

    if (modifierList != null) {
      for (PsiAnnotation psiAnnotation : modifierList.getAnnotations()) {
        if (psiAnnotation != null && psiAnnotation.getQualifiedName() != null) {
          JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(element.getProject());
          PsiClass psiClass = psiFacade.findClass(psiAnnotation.getQualifiedName(),
              GlobalSearchScope.projectScope(element.getProject()));

          if (hasAnnotation(psiClass, CLASS_QUALIFIER)) {
            qualifiedClasses.add(psiAnnotation.getQualifiedName());
          }
        }
      }
    }
  }

  return qualifiedClasses;
}
 
Example #10
Source File: SuperBuilderClassProcessor.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
protected void generatePsiElements(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation, @NotNull List<? super PsiElement> target) {
  SuperBuilderHandler builderHandler = getBuilderHandler();
  final String builderClassName = builderHandler.getBuilderClassName(psiClass);

  Optional<PsiClass> builderClass = PsiClassUtil.getInnerClassInternByName(psiClass, builderClassName);
  if (!builderClass.isPresent()) {
    final PsiClass createdBuilderClass = builderHandler.createBuilderBaseClass(psiClass, psiAnnotation);
    target.add(createdBuilderClass);
    builderClass = Optional.of(createdBuilderClass);
  }

  // skip generation of BuilderImpl class, if class is abstract
  if (!psiClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
    final String builderImplClassName = builderHandler.getBuilderImplClassName(psiClass);
    if (!PsiClassUtil.getInnerClassInternByName(psiClass, builderImplClassName).isPresent()) {
      target.add(builderHandler.createBuilderImplClass(psiClass, builderClass.get(), psiAnnotation));
    }
  }
}
 
Example #11
Source File: PsiConsultantImpl.java    From dagger-intellij-plugin with Apache License 2.0 5 votes vote down vote up
static PsiAnnotation findAnnotation(PsiElement element, String annotationName) {
  if (element instanceof PsiModifierListOwner) {
    PsiModifierListOwner listOwner = (PsiModifierListOwner) element;
    PsiModifierList modifierList = listOwner.getModifierList();

    if (modifierList != null) {
      for (PsiAnnotation psiAnnotation : modifierList.getAnnotations()) {
        if (annotationName.equals(psiAnnotation.getQualifiedName())) {
          return psiAnnotation;
        }
      }
    }
  }
  return null;
}
 
Example #12
Source File: PsiAnnotationSearchUtil.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
public static PsiAnnotation findAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, @NotNull final Class<? extends Annotation>... annotationTypes) {
  if (annotationTypes.length == 1) {
    return findAnnotation(psiModifierListOwner, annotationTypes[0]);
  }

  final String[] qualifiedNames = new String[annotationTypes.length];
  for (int i = 0; i < annotationTypes.length; i++) {
    qualifiedNames[i] = annotationTypes[i].getName();
  }
  return findAnnotationQuick(psiModifierListOwner.getModifierList(), qualifiedNames);
}
 
Example #13
Source File: HookUtil.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
public static boolean isHook(PsiElement element) {
    if (!(element instanceof PsiMethod)) return false;
    for (PsiAnnotation annotation : ((PsiMethod) element).getModifierList().getAnnotations())
        if (hooks.contains(annotation.getQualifiedName()))
            return true;
    return false;
}
 
Example #14
Source File: QuarkusConfigPropertiesProvider.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
private static String getPrefixFromAnnotation(PsiAnnotation configPropertiesAnnotation) {
	String value = getAnnotationMemberValue(configPropertiesAnnotation, "prefix");
	if (value == null) {
		return null;
	}
	if (ConfigProperties.UNSET_PREFIX.equals(value) || value.isEmpty()) {
		return null;
	}
	return value;
}
 
Example #15
Source File: AnnotationUtils.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Returns the value of the given member name of the given annotation.
 * 
 * @param annotation the annotation.
 * @param memberName the member name.
 * @return the value of the given member name of the given annotation.
 */
public static String getAnnotationMemberValue(PsiAnnotation annotation, String memberName) {
	PsiAnnotationMemberValue member = annotation.findDeclaredAttributeValue(memberName);
	String value = member != null && member.getText() != null ? member.getText() : null;
	if (value != null && value.length() > 1 && value.charAt(0) == '"' && value.charAt(value.length() - 1) == '"') {
		value = value.substring(1, value.length() - 1);
	}
	return value;
}
 
Example #16
Source File: SuggestionServiceImpl.java    From component-runtime with Apache License 2.0 5 votes vote down vote up
private String getFamilyFromPackageInfo(final PsiPackage psiPackage, final Module module) {
    return of(FilenameIndex
            .getFilesByName(psiPackage.getProject(), "package-info.java", GlobalSearchScope.moduleScope(module)))
                    .map(psiFile -> {
                        if (!PsiJavaFile.class
                                .cast(psiFile)
                                .getPackageName()
                                .equals(psiPackage.getQualifiedName())) {
                            return null;
                        }
                        final String[] family = { null };
                        PsiJavaFile.class.cast(psiFile).accept(new JavaRecursiveElementWalkingVisitor() {

                            @Override
                            public void visitAnnotation(final PsiAnnotation annotation) {
                                super.visitAnnotation(annotation);
                                if (!COMPONENTS.equals(annotation.getQualifiedName())) {
                                    return;
                                }
                                final PsiAnnotationMemberValue familyAttribute =
                                        annotation.findAttributeValue("family");
                                if (familyAttribute == null) {
                                    return;
                                }
                                family[0] = removeQuotes(familyAttribute.getText());
                            }
                        });
                        return family[0];
                    })
                    .filter(Objects::nonNull)
                    .findFirst()
                    .orElseGet(() -> {
                        final PsiPackage parent = psiPackage.getParentPackage();
                        if (parent == null) {
                            return null;
                        }
                        return getFamilyFromPackageInfo(parent, module);
                    });
}
 
Example #17
Source File: NoArgsConstructorProcessor.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public LombokPsiElementUsage checkFieldUsage(@NotNull PsiField psiField, @NotNull PsiAnnotation psiAnnotation) {
  final PsiClass containingClass = psiField.getContainingClass();
  if (null != containingClass) {

    final boolean forceConstructorWithJavaDefaults = isForceConstructor(psiAnnotation);
    final Collection<PsiField> params = getConstructorFields(containingClass, forceConstructorWithJavaDefaults);

    if (PsiClassUtil.getNames(params).contains(psiField.getName())) {
      return LombokPsiElementUsage.WRITE;
    }
  }
  return LombokPsiElementUsage.NONE;
}
 
Example #18
Source File: AbstractMethodProcessor.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NotNull
@Override
public List<? super PsiElement> process(@NotNull PsiClass psiClass) {
  List<? super PsiElement> result = new ArrayList<>();
  for (PsiMethod psiMethod : PsiClassUtil.collectClassMethodsIntern(psiClass)) {
    PsiAnnotation psiAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiMethod, getSupportedAnnotationClasses());
    if (null != psiAnnotation) {
      if (validate(psiAnnotation, psiMethod, ProblemEmptyBuilder.getInstance())) {
        processIntern(psiMethod, psiAnnotation, result);
      }
    }
  }
  return result;
}
 
Example #19
Source File: AnnotationUtils.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Returns the annotation from the given <code>annotatable</code> element with
 * the given name <code>annotationName</code> and null otherwise.
 * 
 * @param annotatable    the class, field which can be annotated.
 * @param annotationName the annotation name
 * @return the annotation from the given <code>annotatable</code> element with
 *         the given name <code>annotationName</code> and null otherwise.
 */
public static PsiAnnotation getAnnotation(PsiMember annotatable, String annotationName) {
	if (annotatable == null) {
		return null;
	}
	PsiAnnotation[] annotations = annotatable.getAnnotations();
	for (PsiAnnotation annotation : annotations) {
		if (isMatchAnnotation(annotation, annotationName)) {
			return annotation;
		}
	}
	return null;
}
 
Example #20
Source File: SingularHandlerFactory.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NotNull
public static BuilderElementHandler getHandlerFor(@NotNull PsiVariable psiVariable, @Nullable PsiAnnotation singularAnnotation) {
  if (null == singularAnnotation) {
    return new NonSingularHandler();
  }

  final PsiType psiType = psiVariable.getType();
  final String qualifiedName = PsiTypeUtil.getQualifiedName(psiType);
  if (!isInvalidSingularType(qualifiedName)) {
    if (COLLECTION_TYPES.contains(qualifiedName)) {
      return new SingularCollectionHandler(qualifiedName);
    }
    if (MAP_TYPES.contains(qualifiedName)) {
      return new SingularMapHandler(qualifiedName);
    }
    if (GUAVA_COLLECTION_TYPES.contains(qualifiedName)) {
      return new SingularGuavaCollectionHandler(qualifiedName, qualifiedName.contains("Sorted"));
    }
    if (GUAVA_MAP_TYPES.contains(qualifiedName)) {
      return new SingularGuavaMapHandler(qualifiedName, qualifiedName.contains("Sorted"));
    }
    if (GUAVA_TABLE_TYPES.contains(qualifiedName)) {
      return new SingularGuavaTableHandler(qualifiedName, false);
    }
  }
  return new EmptyBuilderElementHandler();
}
 
Example #21
Source File: SubscriberMetadata.java    From otto-intellij-plugin with Apache License 2.0 5 votes vote down vote up
public static boolean isAnnotatedWithProducer(PsiMethod method) {
  for (SubscriberMetadata info : subscribers) {
    if (info.getProducerClassName() == null) {
      continue;
    }

    PsiAnnotation annotation = PsiConsultantImpl.findAnnotationOnMethod(method,
        info.getProducerClassName());

    if (annotation != null) {
      return true;
    }
  }
  return false;
}
 
Example #22
Source File: AbstractMethodProcessor.java    From sqlitemagic with Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public Collection<SqliteMagicProblem> verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) {
  Collection<SqliteMagicProblem> result = Collections.emptyList();

  PsiMethod psiMethod = PsiTreeUtil.getParentOfType(psiAnnotation, PsiMethod.class);
  if (null != psiMethod) {
    ProblemNewBuilder problemNewBuilder = new ProblemNewBuilder();
    validate(psiAnnotation, psiMethod, problemNewBuilder);
    result = problemNewBuilder.getProblems();
  }

  return result;
}
 
Example #23
Source File: AllArgsConstructorProcessor.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected boolean validate(@NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiClass, @NotNull ProblemBuilder builder) {
  boolean result;

  result = super.validate(psiAnnotation, psiClass, builder);

  final Collection<PsiField> allNotInitializedNotStaticFields = getAllFields(psiClass);
  final String staticConstructorName = getStaticConstructorName(psiAnnotation);
  result &= validateIsConstructorNotDefined(psiClass, staticConstructorName, allNotInitializedNotStaticFields, builder);

  return result;
}
 
Example #24
Source File: AbstractFieldNameConstantsProcessor.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NotNull
@Override
public Collection<PsiAnnotation> collectProcessedAnnotations(@NotNull PsiClass psiClass) {
  final Collection<PsiAnnotation> result = super.collectProcessedAnnotations(psiClass);
  addFieldsAnnotation(result, psiClass, FIELD_NAME_CONSTANTS_INCLUDE, FIELD_NAME_CONSTANTS_EXCLUDE);
  return result;
}
 
Example #25
Source File: ElementUtils.java    From aircon with MIT License 5 votes vote down vote up
public static boolean hasAnnotation(final PsiModifierListOwner field, Class<? extends Annotation> annotationClass) {
	for (PsiAnnotation psiAnnotation : field.getAnnotations()) {
		if (isOfType(psiAnnotation, annotationClass)) {
			return true;
		}
	}
	return false;
}
 
Example #26
Source File: AbstractClassProcessor.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void validateOfParam(PsiClass psiClass, ProblemBuilder builder, PsiAnnotation psiAnnotation, Collection<String> ofProperty) {
  for (String fieldName : ofProperty) {
    if (!StringUtil.isEmptyOrSpaces(fieldName)) {
      PsiField fieldByName = psiClass.findFieldByName(fieldName, false);
      if (null == fieldByName) {
        final String newPropertyValue = calcNewPropertyValue(ofProperty, fieldName);
        builder.addWarning(String.format("The field '%s' does not exist", fieldName),
          PsiQuickFixFactory.createChangeAnnotationParameterFix(psiAnnotation, "of", newPropertyValue));
      }
    }
  }
}
 
Example #27
Source File: AbstractSingularHandler.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public String createSingularName(@NotNull PsiAnnotation singularAnnotation, String psiFieldName) {
  String singularName = PsiAnnotationUtil.getStringAnnotationValue(singularAnnotation, "value");
  if (StringUtil.isEmptyOrSpaces(singularName)) {
    singularName = Singulars.autoSingularize(psiFieldName);
    if (singularName == null) {
      singularName = psiFieldName;
    }
  }
  return singularName;
}
 
Example #28
Source File: SuperBuilderPreDefinedInnerClassFieldProcessor.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected Collection<? extends PsiElement> generatePsiElementsOfBaseBuilderClass(@NotNull PsiClass psiParentClass, @NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiBuilderClass) {
  final Collection<String> existedFieldNames = PsiClassUtil.collectClassFieldsIntern(psiBuilderClass).stream()
    .map(PsiField::getName)
    .collect(Collectors.toSet());

  final List<BuilderInfo> builderInfos = getBuilderHandler().createBuilderInfos(psiAnnotation, psiParentClass, null, psiBuilderClass);
  return builderInfos.stream()
    .filter(info -> info.notAlreadyExistingField(existedFieldNames))
    .map(BuilderInfo::renderBuilderFields)
    .flatMap(Collection::stream)
    .collect(Collectors.toList());
}
 
Example #29
Source File: OkJsonUpdateLineMarkerProvider.java    From NutzCodeInsight with Apache License 2.0 5 votes vote down vote up
private PsiAnnotation getPsiAnnotation(@NotNull PsiElement psiElement) {
    if (psiElement instanceof PsiMethod) {
        PsiMethodImpl field = ((PsiMethodImpl) psiElement);
        PsiAnnotation psiAnnotation = field.getAnnotation(NutzCons.OK);
        return psiAnnotation;
    }
    return null;
}
 
Example #30
Source File: JavaClassUtils.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Return the bean name for the {@link PsiClass} and the specific bean annotation
 * @param clazz - class to return bean name for
 * @param annotationFqn - the lookup FQN string for the annotation
 * @return the bean name
 */
private Optional<String> getBeanName(PsiClass clazz, String annotationFqn) {
    String returnName = null;
    final PsiAnnotation annotation = clazz.getAnnotation(annotationFqn);
    if (annotation != null) {
        final PsiAnnotationMemberValue componentAnnotation = annotation.findAttributeValue("value");
        returnName = componentAnnotation != null ? StringUtils.stripDoubleQuotes(componentAnnotation.getText()) : Introspector.decapitalize(clazz.getName());
    }
    return Optional.ofNullable(returnName);
}