Package org.jbehave.example.spring.security.domain

Source Code of org.jbehave.example.spring.security.domain.AuthenticationPolicyBuilder

package org.jbehave.example.spring.security.domain;

import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;

public class AuthenticationPolicyBuilder {

  private BeanWrapper authPolicy;

  public AuthenticationPolicyBuilder() {
    AuthenticationPolicy target = new AuthenticationPolicy();
    authPolicy = new BeanWrapperImpl(target);
  }

  public AuthenticationPolicyBuilder(Map<String, String> row) {
    this();
    for (String propertyName : row.keySet()) {
      if (!StringUtils.isBlank(propertyName)) {
        String propertyValue = row.get(propertyName);
        authPolicy.setPropertyValue(propertyName, propertyValue);
      }
    }
  }

  public AuthenticationPolicy build() {
    return (AuthenticationPolicy) authPolicy.getWrappedInstance();
  }
}
TOP

Related Classes of org.jbehave.example.spring.security.domain.AuthenticationPolicyBuilder

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.