Package commons

Source Code of commons.AuthoryConverter

package commons;

import java.util.ArrayList;
import java.util.List;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

import com.gtp.domain.Authority;



public class  AuthoryConverter implements Converter {
 
  public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
     if (value == null || value.equals("")) {
         return null;
        }
        String[] s = value.split("-")
        Authority a= new Authority();
        a.setId(Integer.parseInt(s[0]));
        a.setName(s[1]);
        a.setUrl(s[2]);
        return a;
  }

  public String getAsString(FacesContext facesContext, UIComponent component, Object value) {
    if(value == null)
      return null;
    else
      return value.toString();
  }
}
TOP

Related Classes of commons.AuthoryConverter

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.