Package io.teknek.intravert.model

Examples of io.teknek.intravert.model.Type


  @Ignore
  public void test() throws JsonGenerationException, JsonMappingException, IOException{
    Request request = new Request();
    Map<String,Object> filterDef = new HashMap<String,Object>();
    filterDef.put("string", "under21");
    filterDef.put("bytes", new Type("Blob", "application".getBytes()));
    filterDef.put("abtype", new Type(5L));
    filterDef.put("int", 5);
    filterDef.put("long", new Type("Long", 5L));
    filterDef.put("comp", new Type("Composite(Long,String)", Arrays.asList(5l, "waa")));
    filterDef.put("comp", new Type("CompositeSep(Long,String)", Arrays.asList(5l, 0, "waa", 0)));
    request.getOperations().add(new Operation()
    .withId("1").withType(ActionFactory.CREATE_FILTER).withArguments(filterDef));
    ObjectMapper om = new ObjectMapper();
    Assert.assertEquals("", om.writeValueAsString(request));
   
View Full Code Here


public class TypeUtil {
  private static ObjectMapper om = new ObjectMapper();
  public static <T> T convert(Object in){
    if (in instanceof Map){
      Type t = om.convertValue(in, Type.class);
      if ("blob".equalsIgnoreCase(t.getTheClass())){
        return (T) ((String) t.getValue()).getBytes();
      } else {
        return (T) t.getValue();
      }
    }
    return (T) in;
  }
View Full Code Here

TOP

Related Classes of io.teknek.intravert.model.Type

Copyright © 2018 www.massapicom. 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.