1 /***************************************2 * *3 * JBoss: The OpenSource J2EE WebOS *4 * *5 * Distributable under LGPL license. *6 * See terms of license at gnu.org. *7 * *8 ***************************************/9 package org.jboss.security.propertyeditor;10 11 import java.beans.PropertyEditorSupport ;12 import java.security.Principal ;13 14 import org.jboss.security.SimplePrincipal;15 16 /** A property editor for java.security.Principals that uses the17 * org.jboss.security.SimplePrincipal18 *19 * @version <tt>$Revision: 1.2 $</tt>20 * @author Scott.Stark@jboss.org21 */22 public class PrincipalEditor23 extends PropertyEditorSupport 24 {25 /** Build a SimplePrincipal26 * @param text, the name of the Principal27 */28 public void setAsText(final String text)29 {30 SimplePrincipal principal = new SimplePrincipal(text);31 setValue(principal);32 }33 34 /**35 * @return the name of the Principal36 */37 public String getAsText()38 {39 Principal principal = (Principal ) getValue();40 return principal.getName();41 }42 }43