private Optional<String> getOrCreateEnumTypeId(StringType enumType) { EnumAnnotation<String> enumAnnotation = enumType.getAnnotation(EnumAnnotation.class).get(); return getId(enumType).map(name -> name == String.class.getName() ? format(AUTOGENERATED_TYPEID_MASK, sha256().hashString(join(".", Arrays.stream(enumAnnotation.getValues()).collect(toList())), UTF_8)) : name); }
@Override public void visitString(StringType stringType) { if (stringType.getMetadataFormat() == JAVA && isEnum(stringType)) { getType(stringType).ifPresent(relativeClasses::add); } } });
@Override public void visitString(StringType stringType) { Optional<EnumAnnotation> enumAnnotation = stringType.getAnnotation(EnumAnnotation.class); if (enumAnnotation.isPresent()) { visitEnum(stringType); } else { defaultVisit(stringType); } }
@Override public void visitString(StringType stringType) { if (stringType.getMetadataFormat() == JAVA && isEnum(stringType)) { getId(stringType).ifPresent(relativeClasses::add); } } });
private void registerEnum(Schema schema, StringType enumType) { EnumAnnotation<String> enumAnnotation = enumType.getAnnotation(EnumAnnotation.class) .orElseThrow(() -> new IllegalArgumentException("Cannot obtain enum values for the given type")); TopLevelSimpleType enumSimpleType = new TopLevelSimpleType(); Optional<String> enumTypeId = getOrCreateEnumTypeId(enumType); enumSimpleType.setName(sanitizeName(enumTypeId) + SchemaConstants.ENUM_TYPE_SUFFIX); Union union = new Union(); union.getSimpleType().add(createEnumSimpleType(enumAnnotation)); union.getSimpleType().add(createExpressionAndPropertyPlaceHolderSimpleType()); enumSimpleType.setUnion(union); schema.getSimpleTypeOrComplexTypeOrGroup().add(enumSimpleType); }
@Override public void visitString(StringType stringType) { if (stringType.getMetadataFormat() == JAVA && isEnum(stringType)) { getType(stringType).ifPresent(relativeClasses::add); } } });
@Override public void visitString(StringType stringType) { if (property == null || stringType.getAnnotation(EnumAnnotation.class).isPresent()) { return; } if (!property.isStrict()) { declareOutputMimeTypeParameter(declaration.getParameterGroup(DEFAULT_GROUP_NAME)); } replaceOutputType(declaration, property, format -> { StringTypeBuilder stringTypeBuilder = BaseTypeBuilder.create(format).stringType(); enrichWithAnnotations(stringTypeBuilder, declaration.getOutput().getType().getAnnotations()); return stringTypeBuilder.build(); }); }
@Override public void visitString(StringType stringType) { if (stringType.getMetadataFormat() == JAVA && isEnum(stringType)) { getId(stringType).ifPresent(relativeClasses::add); } } });
when(extensionManager.getConfigurationProvider(CONFIG_NAME)).thenReturn(of(configurationProvider)); when(stringType.getAnnotation(anyObject())).thenReturn(empty());
@Override public void visitString(StringType stringType) { if (stringType.getAnnotation(EnumAnnotation.class).isPresent()) { typeName = getTypeId(stringType).orElse(String.class.getName()); } else if (stringType.getAnnotation(ClassInformationAnnotation.class).isPresent()) { typeName = stringType.getAnnotation(ClassInformationAnnotation.class).get().getClassname(); } else { typeName = String.class.getName(); } }
@Override public void visitString(StringType stringType) { Optional<EnumAnnotation> enumAnnotation = stringType.getAnnotation(EnumAnnotation.class); if (enumAnnotation.isPresent()) { defaultVisit(stringType); } else { typeId = String.class.getName(); } }
@Override public void visitString(StringType stringType) { Optional<EnumAnnotation> enumAnnotation = stringType.getAnnotation(EnumAnnotation.class); if (enumAnnotation.isPresent()) { visitEnum(stringType); } else { defaultVisit(stringType); } }
@Override public void visitString(StringType stringType) { if (stringType.getAnnotation(EnumAnnotation.class).isPresent()) { return; } if (property == null) { String componentType = NameUtils.getDeclarationTypeName(declaration); throw new IllegalModelDefinitionException(String.format( "%s '%s' has a String output but doesn't specify a default mime type. Please annotate it with @%s", componentType, declaration.getName(), org.mule.runtime.extension.api.annotation.param.MediaType.class .getSimpleName())); } if (!property.isStrict()) { declareOutputMimeTypeParameter(declaration.getParameterGroup(DEFAULT_GROUP_NAME)); } replaceOutputType(declaration, property, format -> BaseTypeBuilder.create(format).stringType().build()); }