001    package railo.commons.sql;
002    
003    import oracle.sql.OPAQUE;
004    import oracle.sql.OpaqueDescriptor;
005    import railo.commons.lang.ClassUtil;
006    
007    public class OracleCaster {
008    
009            private static final Class OPAQUE=ClassUtil.loadClass("oracle.sql.OPAQUE", null);
010            
011            public static Object OPAQUE(Object o) {
012                    if(o==null) return null;
013                            
014                    try {
015                            byte[] bv = ((oracle.sql.OPAQUE)o).getBytes();
016                            
017                            OPAQUE op = ((oracle.sql.OPAQUE)o);
018                            OpaqueDescriptor desc = ((oracle.sql.OPAQUE)o).getDescriptor();
019                            
020                            
021                            //Method getBytesValue = o.getClass().getMethod("getBytesValue", new Class[0]);
022                            //byte[] bv = (byte[])getBytesValue.invoke(o, new Object[0]);
023                            return new String(bv,"UTF-8");
024                    }
025                    catch (Exception e) {
026                            //print.printST(e);
027                    }
028                    
029                    return o;
030            }
031    
032            private static boolean equals(Class left, Class right) {
033                    if(left==right)return true;
034                    return left.equals(right.getName());
035            }
036    
037    }