1 2 12 package com.versant.core.jdbc.sql.conv; 13 14 import com.versant.core.jdbc.JdbcConverter; 15 import com.versant.core.jdbc.JdbcTypeRegistry; 16 import com.versant.core.jdbc.metadata.JdbcColumn; 17 18 import java.net.URL ; 19 import java.net.MalformedURLException ; 20 21 import com.versant.core.common.BindingSupportImpl; 22 23 29 public class URLConverter extends TypeAsStringConverterBase { 30 31 public static class Factory extends NoArgJdbcConverterFactory { 32 33 private URLConverter converter; 34 35 39 public JdbcConverter createJdbcConverter(JdbcColumn col, Object args, 40 JdbcTypeRegistry jdbcTypeRegistry) { 41 if (converter == null) converter = new URLConverter(); 42 return converter; 43 } 44 45 } 46 47 51 protected Object fromString(String s) { 52 try { 53 return new URL (s); 54 } catch (MalformedURLException e) { 55 throw BindingSupportImpl.getInstance().fatalDatastore(e.toString(), e); 56 } 57 } 58 59 63 public Class getValueType() { 64 return URL .class; 65 } 66 67 } 68 69 | Popular Tags |