Ran into this original coffee mug in Jerusalem.
I couldn't decide what they were thinking. Quick ripoff? Subtle joke?
Ran into this original coffee mug in Jerusalem.
I couldn't decide what they were thinking. Quick ripoff? Subtle joke?
import java.io.IOException;
import java.util.Date;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.Version;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializerProvider;
import org.codehaus.jackson.map.module.SimpleModule;
public class JsonUtils
{
public static String getString(Object object)
{
try
{
ObjectMapper mapper = createMapper();
String json = mapper.writeValueAsString(object);
return json;
}
catch (IOException e)
{
throw new RuntimeException("Failed to convert JSON to object", e);
}
}
public staticT fromString(String json, Class clazz)
{
try
{
ObjectMapper mapper = createMapper();
T result = mapper.readValue(json, clazz);
return result;
}
catch (IOException e)
{
throw new RuntimeException("Failed to convert JSON to object:\n" + json, e);
}
}
public static ObjectMapper createMapper()
{
ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule("Ekotrope", new Version(1, 0, 0, null));
module.addSerializer(Date.class, new DateSerializer());
module.addDeserializer(Date.class, new DateDeserializer());
module.addSerializer(Long.class, new LongSerializer());
module.addDeserializer(Long.class, new LongDeserializer());
mapper.registerModule(module);
return mapper;
}
private static class DateSerializer extends JsonSerializer
{
@Override
public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException
{
String str = "" + value.getTime();
jgen.writeString(str);
}
}
private static class DateDeserializer extends JsonDeserializer
{
@Override
public Date deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
String str = jp.getText();
Long value = Long.parseLong(str);
Date date = new Date(value);
return date;
}
}
private static class LongSerializer extends JsonSerializer
{
@Override
public void serialize(Long value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException
{
String str = "" + value.toString();
jgen.writeString(str);
}
}
private static class LongDeserializer extends JsonDeserializer
{
@Override
public Long deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
String str = jp.getText();
Long value = Long.parseLong(str);
return value;
}
}
}
[ERROR] Uncaught Exception: java.lang.NullPointerException at com.google.web.bindery.autobean.shared.impl.StringQuoter.tryParseDate(StringQuoter.java:85) at com.google.web.bindery.autobean.shared.ValueCodex$Type$6.decode(ValueCodex.java:106) at com.google.web.bindery.autobean.shared.ValueCodex$Type$6.decode(ValueCodex.java:1) at com.google.web.bindery.autobean.shared.ValueCodex.decode(ValueCodex.java:288) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$ValueCoder.decode(AutoBeanCodexImpl.java:492) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.getOrReify(AbstractAutoBean.java:241) at com.activegrade.shared.data.user.UserAutoBean.access$5(UserAutoBean.java:1) at com.activegrade.shared.data.user.UserAutoBean$2.getAccessExpirationDate(UserAutoBean.java:89) at com.activegrade.shared.data.user.UserAutoBean$1.getAccessExpirationDate(UserAutoBean.java:26) at com.activegrade.shared.data.user.UserAutoBean.traverseProperties(UserAutoBean.java:161) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doCoderFor(AutoBeanCodexImpl.java:521) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.getOrReify(AbstractAutoBean.java:239) at com.activegrade.shared.data.user.UserAutoBean.access$5(UserAutoBean.java:1) at com.activegrade.shared.data.user.UserAutoBean$2.getPrimaryEmailAddress(UserAutoBean.java:86) at com.activegrade.shared.data.user.UserAutoBean$1.getPrimaryEmailAddress(UserAutoBean.java:22) at com.activegrade.shared.data.user.UserAutoBean.traverseProperties(UserAutoBean.java:152) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doCoderFor(AutoBeanCodexImpl.java:521) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.getOrReify(AbstractAutoBean.java:239) at com.activegrade.shared.data.user.UserAutoBean.access$5(UserAutoBean.java:1) at com.activegrade.shared.data.user.UserAutoBean$2.getDefaultRootOrgId(UserAutoBean.java:74) at com.activegrade.shared.data.user.UserAutoBean$1.getDefaultRootOrgId(UserAutoBean.java:6) at com.activegrade.shared.data.user.UserAutoBean.traverseProperties(UserAutoBean.java:116) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doCoderFor(AutoBeanCodexImpl.java:521) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.getOrReify(AbstractAutoBean.java:239) at com.activegrade.shared.data.user.UserAutoBean.access$5(UserAutoBean.java:1) at com.activegrade.shared.data.user.UserAutoBean$2.getId(UserAutoBean.java:77) at com.activegrade.shared.data.user.UserAutoBean$1.getId(UserAutoBean.java:10) at com.activegrade.client.AppState.setLoggedInUser(AppState.java:100)
GwtQuery a.k.a. GQuery is a jQuery-like API written in GWT, which allows GWT to be used in progressive enhancement scenarios where perhaps GWT widgets are too heavyweight. It can also be used to find and improve your GWT widgets.
GwtQuery is easy to learn for those using jQuery as they share the same api, aditionally gquery adds nice features like type-safe css, compile time optimisations, etc.
A complete model-view-presenter framework to simplify your next GWT project.
GIN (GWT INjection) brings automatic dependency injection to Google Web Toolkit client-side code. GIN is built on top of Guice and uses (a subset of) Guice's binding language. (See GuiceCompatibility for details.) By using GWT's compile-time Generator support, GIN has little-to-no runtime overhead compared to manual DI.
GwtUpload & JsUpload: File Upload Progress with pure javascript (Ajax)
a framework to test GWT client side code very easily
Spiffy UI framework: GWT made simple