Class AbstractResourcePropertyConverter<T>

java.lang.Object
se.swedenconnect.security.credential.spring.converters.AbstractResourcePropertyConverter<T>
All Implemented Interfaces:
Aware, ApplicationContextAware, Converter<String,T>
Direct Known Subclasses:
PropertyToPrivateKeyConverter, PropertyToPublicKeyConverter, PropertyToX509CertificateConverter

public abstract class AbstractResourcePropertyConverter<T> extends Object implements Converter<String,T>, ApplicationContextAware
Abstract base class for converters that convert a resource property value into an object.
Author:
Martin Lindström
  • Constructor Details

    • AbstractResourcePropertyConverter

      public AbstractResourcePropertyConverter()
  • Method Details

    • convert

      @Nonnull public T convert(@Nonnull String source)
      Specified by:
      convert in interface Converter<String,T>
    • convert

      @Nonnull protected abstract T convert(@Nonnull InputStream inputStream) throws Exception
      Converts the input stream to the object supported by the converter.

      The stream must not be closed.

      Parameters:
      inputStream - the stream
      Returns:
      the object
      Throws:
      Exception - for conversion errors
    • isInlinedPem

      protected abstract boolean isInlinedPem(@Nonnull String property)
      Tells whether the property value holds an "inlined" PEM representation of the object.
      Parameters:
      property - the property value
      Returns:
      true if the property holds a PEM object, and false otherwise
    • setApplicationContext

      public void setApplicationContext(@Nonnull ApplicationContext applicationContext) throws BeansException
      Specified by:
      setApplicationContext in interface ApplicationContextAware
      Throws:
      BeansException