org.springframework.boot.bind
Class YamlConfigurationFactory<T>

java.lang.Object
  extended by org.springframework.boot.bind.YamlConfigurationFactory<T>
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 Summary
YamlConfigurationFactory(Class<?> type)
          Sets a validation constructor which will be applied to the YAML doc to see whether it matches the expected Javabean.
 
Method Summary
 void afterPropertiesSet()
           
 T getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setExceptionIfInvalid(boolean exceptionIfInvalid)
           
 void setMessageSource(org.springframework.context.MessageSource messageSource)
           
 void setPropertyAliases(Map<Class<?>,Map<String,String>> propertyAliases)
           
 void setResource(org.springframework.core.io.Resource resource)
           
 void setValidator(org.springframework.validation.Validator validator)
           
 void setYaml(String yaml)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)
Specified by:
setMessageSource in interface org.springframework.context.MessageSourceAware
Parameters:
messageSource - the messageSource to set

setPropertyAliases

public void setPropertyAliases(Map<Class<?>,Map<String,String>> propertyAliases)
Parameters:
propertyAliases - the propertyAliases to set

setYaml

public void setYaml(String yaml)
Parameters:
yaml - the yaml to set

setResource

public void setResource(org.springframework.core.io.Resource resource)
Parameters:
resource - the resource to set

setValidator

public void setValidator(org.springframework.validation.Validator validator)
Parameters:
validator - the validator to set

setExceptionIfInvalid

public void setExceptionIfInvalid(boolean exceptionIfInvalid)

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 © 2013. All Rights Reserved.