1 22 package org.jboss.util.propertyeditor; 23 24 import java.net.InetAddress ; 25 import java.net.UnknownHostException ; 26 27 import org.jboss.util.NestedRuntimeException; 28 import org.jboss.util.StringPropertyReplacer; 29 30 36 public class InetAddressEditor extends TextPropertyEditorSupport 37 { 38 45 public Object getValue() 46 { 47 try 48 { 49 String text = getAsText(); 50 if (text == null) 51 { 52 return null; 53 } 54 if (text.startsWith("/")) 55 { 56 text = text.substring(1); 59 } 60 return InetAddress.getByName(StringPropertyReplacer.replaceProperties(text)); 61 } 62 catch (UnknownHostException e) 63 { 64 throw new NestedRuntimeException(e); 65 } 66 } 67 } 68 | Popular Tags |