se.emilsjolander.sprinkles.typeserializers.TypeSerializer Java Examples
The following examples show how to use
se.emilsjolander.sprinkles.typeserializers.TypeSerializer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Utils.java From sprinkles with Apache License 2.0 | 5 votes |
static String insertSqlArgs(String sql, Object[] args) { if (args == null) { return sql; } for (Object o : args) { TypeSerializer typeSerializer = Sprinkles.sInstance.getTypeSerializer(o.getClass()); String sqlObject = typeSerializer.toSql(o); sql = sql.replaceFirst("\\?", sqlObject); } return sql; }
Example #2
Source File: SprinklesTest.java From sprinkles with Apache License 2.0 | 5 votes |
@Test public void registerType() { Sprinkles s = Sprinkles.init(Robolectric.application); TypeSerializer serializer = new MyObjectSerializer(); s.registerType(MyObject.class, serializer); assertEquals(s.getTypeSerializer(MyObject.class), serializer); }
Example #3
Source File: Utils.java From flickr-uploader with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) static String insertSqlArgs(String sql, Object[] args) { if (args == null) { return sql; } for (Object o : args) { TypeSerializer typeSerializer = Sprinkles.sInstance.getTypeSerializer(o.getClass()); String sqlObject = typeSerializer.toSql(o); sql = sql.replaceFirst("\\?", sqlObject); } return sql; }
Example #4
Source File: Sprinkles.java From sprinkles with Apache License 2.0 | 4 votes |
public <T> void registerType(Class<T> clazz, TypeSerializer<T> serializer) { typeSerializers.put(clazz, serializer); }
Example #5
Source File: Sprinkles.java From sprinkles with Apache License 2.0 | 4 votes |
TypeSerializer getTypeSerializer(Class<?> type) { if (!typeSerializers.containsKey(type)) { throw new NoTypeSerializerFoundException(type); } return typeSerializers.get(type); }
Example #6
Source File: Sprinkles.java From flickr-uploader with GNU General Public License v2.0 | 4 votes |
public <T> void registerType(Class<T> clazz, TypeSerializer<T> serializer) { typeSerializers.put(clazz, serializer); }
Example #7
Source File: Sprinkles.java From flickr-uploader with GNU General Public License v2.0 | 4 votes |
TypeSerializer getTypeSerializer(Class<?> type) { if (!typeSerializers.containsKey(type)) { throw new NoTypeSerializerFoundException(type); } return typeSerializers.get(type); }