Example usage for org.springframework.beans.factory NamedBean getBeanName

List of usage examples for org.springframework.beans.factory NamedBean getBeanName

Introduction

In this page you can find the example usage for org.springframework.beans.factory NamedBean getBeanName.

Prototype

String getBeanName();

Source Link

Document

Return the name of this bean in a Spring bean factory, if known.

Usage

From source file:org.opensingular.form.spring.SpringFormUtil.java

/**
 * Verificar se o nome do bean foi configurado. Ou seja, se o bean foi
 * carregado via Spring.//from www .ja  v a  2 s.co  m
 */
public static String checkBeanName(NamedBean bean) {
    if (StringUtils.isBlank(bean.getBeanName())) {
        throw new SingularFormException("O nome do bean no spring no foi configurado para a classe "
                + bean.getClass().getName()
                + ". Verifique se o bean foi corretamente registrado no Spring antes de ser utilizado.");
    }
    return bean.getBeanName();
}

From source file:org.opensingular.form.spring.SpringFormUtil.java

public static String erroMsg(NamedBean bean, String msg) {
    StringBuilder sb = new StringBuilder();
    sb.append('[');
    if (bean.getBeanName() != null) {
        sb.append("bean=").append(bean.getBeanName()).append("; ");
    }/*from  w w w.  j a  v a2s . co m*/
    sb.append("class=").append(bean.getClass()).append("]: ").append(msg);
    return sb.toString();
}