private static AnnotationRef findRef(Annotable annotable, String annotation) { for (AnnotationRef annotationRef : annotable.annotations()) { if (annotationRef.annotation().name().equalsIgnoreCase(annotation)) { return annotationRef; } } return null; }
public String getJavaName() { String javaName = null; if (Config.getOverrideNamingLogicWith() == OverrideNamingLogicWith.DISPLAY_NAME && !StringUtils.isEmpty(this.getDisplayName())) { javaName = NamingHelper.getParameterName(this.getDisplayName()); } else if (Config.getOverrideNamingLogicWith() == OverrideNamingLogicWith.ANNOTATION) { for (AnnotationRef annotation : this.getAnnotations()) { if ("(javaName)".equals(annotation.name())) { javaName = String.valueOf(annotation.structuredValue().value()); break; } } } if (StringUtils.isEmpty(javaName)) { javaName = NamingHelper.getParameterName(this.getName()); } return javaName; } }
private static <T> Object findProperty(AnnotationRef annotationRef, String propName, Function<TypeInstance, T> convert) { // annotationRef.structuredValue().properties().get(0).values().get(0).value() for (TypeInstanceProperty typeInstanceProperty : annotationRef.structuredValue().properties()) { if (typeInstanceProperty.name().equalsIgnoreCase(propName)) { if (typeInstanceProperty.isArray()) { return toValueList(convert, typeInstanceProperty.values()); } else { return convert.apply(typeInstanceProperty.value()); } } } return null; }
@Override public Map<RamlActionType, RamlAction> getActions() { Map<RamlActionType, RamlAction> actions = new HashMap<RamlActionType, RamlAction>(); for (Method method : this.delegate.methods()) { boolean skipMethod = false; if (StringUtils.hasText(Config.getDontGenerateForAnnotation())) { for (AnnotationRef annotation : method.annotations()) { if (("(" + Config.getDontGenerateForAnnotation() + ")").equals(annotation.name())) { skipMethod = true; } } } if (!skipMethod) { actions.put(RamlActionType.valueOf(method.method().toUpperCase()), new RJP10V2RamlAction(method)); } } return actions; }
public static String getActionName(ApiActionMetadata apiActionMetadata) { if (Config.getOverrideNamingLogicWith() == OverrideNamingLogicWith.DISPLAY_NAME && !StringUtils.isEmpty(apiActionMetadata.getDisplayName())) { return StringUtils.uncapitalize(cleanNameForJava(apiActionMetadata.getDisplayName())); } else if (Config.getOverrideNamingLogicWith() == OverrideNamingLogicWith.ANNOTATION) { for (AnnotationRef annotation : apiActionMetadata.getAnnotations()) { if ("(javaName)".equals(annotation.name())) { return String.valueOf(annotation.structuredValue().value()); } } } if (Config.getMethodsNamingLogic() == MethodsNamingLogic.RESOURCES) { return getActionNameFromResources(apiActionMetadata.getParent().getResource(), apiActionMetadata.getResource(), apiActionMetadata.getActionType()); } return getActionNameFromObjects(apiActionMetadata); }
private static Object findProperty(AnnotationRef annotationRef, String propName) { // annotationRef.structuredValue().properties().get(0).values().get(0).value() for (TypeInstanceProperty typeInstanceProperty : annotationRef.structuredValue().properties()) { if (typeInstanceProperty.name().equalsIgnoreCase(propName)) { if (typeInstanceProperty.isArray()) { return toValueList(typeInstanceProperty.values()); } else { return typeInstanceProperty.value().value(); } } } return null; }
private void rebuildChildren() { childResourceMap = new LinkedHashMap<String, RamlResource>(); List<Resource> resources = delegate.resources(); if (resources != null) { for (Resource resource : resources) { boolean skipResource = false; if (StringUtils.hasText(Config.getDontGenerateForAnnotation())) { for (AnnotationRef annotation : resource.annotations()) { if (("(" + Config.getDontGenerateForAnnotation() + ")").equals(annotation.name())) { skipResource = true; } } } if (!skipResource) { childResourceMap.put(resource.relativeUri().value(), new RJP10V2RamlResource(resource)); } } } }
} else if (Config.getOverrideNamingLogicWith() == OverrideNamingLogicWith.ANNOTATION) { for (AnnotationRef annotation : objectProperty.annotations()) { if ("(javaName)".equals(annotation.name())) { fieldName = String.valueOf(annotation.structuredValue().value()); break; if ("(isSensitive)".equals(annotation.name()) && Boolean.TRUE.equals(annotation.structuredValue().value())) { excludeFieldsFromToString.add(fieldName);
private static Object findProperty(AnnotationRef annotationRef, String propName) { // annotationRef.structuredValue().properties().get(0).values().get(0).value() for (TypeInstanceProperty typeInstanceProperty : annotationRef.structuredValue().properties()) { if (typeInstanceProperty.name().equalsIgnoreCase(propName)) { if (typeInstanceProperty.isArray()) { return toValueList(typeInstanceProperty.values()); } else { return typeInstanceProperty.value().value(); } } } return null; }
private static AnnotationRef findRef(Annotable annotable, String annotation) { for (AnnotationRef annotationRef : annotable.annotations()) { if (annotationRef.annotation().name().equalsIgnoreCase(annotation)) { return annotationRef; } } return null; }
public static AnnotationRef findRef(Annotable annotable, String annotation) { for (AnnotationRef annotationRef : annotable.annotations()) { if (annotationRef.annotation().name().equalsIgnoreCase(annotation)) { return annotationRef; } } return null; }