Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 import  javax.annotation.Nullable;
 import java.util.Map;

Created with IntelliJ IDEA. User: mati Date: 22/06/2013 Time: 12:04 An implementation that will not convert model to SoyMapData but rather it will return a SoyMapData, in case a passed in model happens to be a SoyMapData object itself.
public class NoConvertSoyDataConverter implements ToSoyDataConverter {

Pass a model object and return a SoyMapData if a model object happens to be a SoyMapData. An implementation will also check if a passed in object is a Map and return a SoyMapData wrapping that map
    public Optional<SoyMapDatatoSoyMap(@Nullable final Object modelthrows Exception {
        if (model instanceof SoyMapData) {
            return Optional.of((SoyMapDatamodel);
        if (model instanceof Map) {
            return Optional.of(new SoyMapData(model));
        return Optional.of(new SoyMapData());
New to GrepCode? Check out our FAQ X