{
Class c = (Class) typemap.get(type);
if (c != null)
{
// Handle the type (requires SQLInput & SQLOutput classes to be implemented)
throw new PSQLException(GT.tr("Custom type maps are not supported."), PSQLState.NOT_IMPLEMENTED);
}
}
PGobject obj = null;
if (logger.logDebug())
logger.debug("Constructing object from type=" + type + " value=<" + value + ">");
try
{
Class klass = _typeCache.getPGobject(type);
// If className is not null, then try to instantiate it,
// It must be basetype PGobject
// This is used to implement the org.postgresql unique types (like lseg,
// point, etc).
if (klass != null)
{
obj = (PGobject) (klass.newInstance());
obj.setType(type);
obj.setValue(value);
}
else
{
// If className is null, then the type is unknown.
// so return a PGobject with the type set, and the value set
obj = new PGobject();
obj.setType( type );
obj.setValue( value );
}
return obj;
}
catch (SQLException sx)
{
// rethrow the exception. Done because we capture any others next
throw sx;
}
catch (Exception ex)
{
throw new PSQLException(GT.tr("Failed to create object for: {0}.", type), PSQLState.CONNECTION_FAILURE, ex);
}
}