org.springframework.boot.bind

Class YamlConfigurationFactory<T>

  • Type Parameters:
    T - the configuration type
    All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.FactoryBean<T>, org.springframework.beans.factory.InitializingBean, org.springframework.context.MessageSourceAware


    public class YamlConfigurationFactory<T>
    extends Object
    implements org.springframework.beans.factory.FactoryBean<T>, org.springframework.context.MessageSourceAware, org.springframework.beans.factory.InitializingBean
    Validate some YAML by binding it to an object of a specified type and then optionally running a Validator over it.
    Author:
    Luke Taylor, Dave Syer
    • Constructor Detail

      • YamlConfigurationFactory

        public YamlConfigurationFactory(Class<?> type)
        Sets a validation constructor which will be applied to the YAML doc to see whether it matches the expected JavaBean.
        Parameters:
        type - the root type
    • Method Detail

      • setMessageSource

        public void setMessageSource(org.springframework.context.MessageSource messageSource)
        Set the message source.
        Specified by:
        setMessageSource in interface org.springframework.context.MessageSourceAware
        Parameters:
        messageSource - the message source
      • setPropertyAliases

        public void setPropertyAliases(Map<Class<?>,Map<String,String>> propertyAliases)
        Set the property aliases.
        Parameters:
        propertyAliases - the property aliases
      • setYaml

        public void setYaml(String yaml)
        Set the YAML.
        Parameters:
        yaml - the YAML
      • setResource

        public void setResource(org.springframework.core.io.Resource resource)
        Set the resource.
        Parameters:
        resource - the resource
      • setValidator

        public void setValidator(org.springframework.validation.Validator validator)
        Set the validator.
        Parameters:
        validator - the validator
      • setExceptionIfInvalid

        @Deprecated
        public void setExceptionIfInvalid(boolean exceptionIfInvalid)
        Deprecated. as of 1.5, do not specify a Validator if validation should not occur
        Set a flag to indicate that an exception should be raised if a Validator is available and validation fails.
        Parameters:
        exceptionIfInvalid - the flag to set
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        Exception
      • getObjectType

        public Class<?> getObjectType()
        Specified by:
        getObjectType in interface org.springframework.beans.factory.FactoryBean<T>
      • isSingleton

        public boolean isSingleton()
        Specified by:
        isSingleton in interface org.springframework.beans.factory.FactoryBean<T>
      • getObject

        public T getObject()
                    throws Exception
        Specified by:
        getObject in interface org.springframework.beans.factory.FactoryBean<T>
        Throws:
        Exception

Copyright © 2018 Pivotal Software, Inc.. All rights reserved.