@Override public List<String> getAuthorizationGrants() { if (!"oauth_2_0".equalsIgnoreCase(getName())) { return Collections.emptyList(); } TypeInstance structuredValue = this.securitySchemeRef.structuredValue(); if (structuredValue == null) { return Collections.emptyList(); } List<String> authorizationGrants = new ArrayList<>(); List<TypeInstanceProperty> properties = structuredValue.properties(); for (TypeInstanceProperty property : properties) { if ("authorizationGrants".equalsIgnoreCase(property.name())) { authorizationGrants.add(property.value().value().toString()); } } return authorizationGrants; } }
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; }
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 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; }