@Nonnull @Override public Set<ConvertiblePair> getConvertibleTypes() { return Streamable.of(wrapperTypes)// .map(it -> new ConvertiblePair(NullableWrapper.class, it))// .stream().collect(StreamUtils.toUnmodifiableSet()); }
/** * Returns {@link ConverterRegistration}s for the given converter. * * @param converter must not be {@literal null}. * @return */ public Streamable<ConverterRegistration> getRegistrationsFor(Object converter) { Assert.notNull(converter, "Converter must not be null!"); Class<?> type = converter.getClass(); boolean isWriting = type.isAnnotationPresent(WritingConverter.class); boolean isReading = type.isAnnotationPresent(ReadingConverter.class); if (converter instanceof ConverterAware) { return Streamable.of(() -> ConverterAware.class.cast(converter).getConverters().stream()// .flatMap(it -> getRegistrationsFor(it).stream())); } else if (converter instanceof GenericConverter) { Set<ConvertiblePair> convertibleTypes = GenericConverter.class.cast(converter).getConvertibleTypes(); return convertibleTypes == null // ? Streamable.empty() // : Streamable.of(convertibleTypes).map(it -> register(it, isReading, isWriting)); } else if (converter instanceof ConverterFactory) { return getRegistrationFor(converter, ConverterFactory.class, isReading, isWriting); } else if (converter instanceof Converter) { return getRegistrationFor(converter, Converter.class, isReading, isWriting); } else { throw new IllegalArgumentException(String.format("Unsupported converter type %s!", converter)); } }
public UserAccountDetails(UserAccount userAccount) { this.username = userAccount.getUsername(); this.password = userAccount.getPassword().toString(); this.isEnabled = userAccount.isEnabled(); this.authorities = userAccount.getRoles() // .map(role -> new SimpleGrantedAuthority(role.getName())) // .toList(); }