Package org.exolab.castor.mapping

Examples of org.exolab.castor.mapping.TypeConvertor.convert()


                    // First convert the actual value to the field value
                    if (fieldClass != valueClass) {
                        try {
                            TypeConvertor tc = getTypeConvertorRegistry().getConvertor(
                                    valueClass, fieldClass, null);
                            internalValue = tc.convert(internalValue);
                        } catch (MappingException e) {
                            throw new IllegalArgumentException("Query parameter "
                                    + (_fieldNum + 1) + " cannot be converted from " + valueClass
                                    + " to " + paramClass + ", because no convertor can be found.");
                        }
View Full Code Here


        DateFormat format = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss.SSS");
        Timestamp timeStamp = new Timestamp (new java.util.Date().getTime());
        LOG.debug ("time stamp = " + format.format (timeStamp));
        TypeConvertor convertor = _registry.getConvertor(
                Timestamp.class, java.util.Date.class, null);
        java.util.Date date = (java.util.Date) convertor.convert(timeStamp);
        LOG.debug("date = " + format.format(date));
       
        assertEquals(timeStamp.getTime(), date.getTime());
    }
View Full Code Here

        DateFormat format = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss.SSS");
        java.util.Date date = new java.util.Date();
        LOG.debug("date = " + format.format(date));
        TypeConvertor convertor = _registry.getConvertor(
                java.util.Date.class, Timestamp.class, null);
        Timestamp timeStamp = (Timestamp) convertor.convert(date);
        LOG.debug ("time stamp = " + format.format (timeStamp));
       
        assertEquals(timeStamp.getTime(), date.getTime());
    }
}
View Full Code Here

                if ( sqlClass != null && ! sqlClass.isAssignableFrom( valueClass ) ) {
                    // First convert the actual value to the field value
                    if ( fieldClass != valueClass ) {
                        try {
                            TypeConvertor tc = SQLTypes.getConvertor( valueClass, fieldClass );
                            value = tc.convert( value, null );
                        } catch ( MappingException e ) {
                            throw new IllegalArgumentException( "Query parameter "
                                                                + ( _fieldNum + 1 )
                                                                + " cannot be converted from "
                                                                + valueClass + " to "
View Full Code Here

                if ( sqlClass != null && ! sqlClass.isAssignableFrom( valueClass ) ) {
                    // First convert the actual value to the field value
                    if ( fieldClass != valueClass ) {
                        try {
                            TypeConvertor tc = SQLTypes.getConvertor( valueClass, fieldClass );
                            value = tc.convert( value, null );
                        } catch ( MappingException e ) {
                            throw new IllegalArgumentException( "Query parameter "
                                                                + ( _fieldNum + 1 )
                                                                + " cannot be converted from "
                                                                + valueClass + " to "
View Full Code Here

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.