Examples of toBean()


Examples of com.avaje.ebean.text.json.JsonContext.toBean()

    bean.setTimezone(TimeZone.getDefault());

    JsonContext jsonContext = Ebean.json();
    String jsonContent = jsonContext.toJson(bean);

    BeanWithTimeZone bean2 = jsonContext.toBean(BeanWithTimeZone.class, jsonContent);

    Assert.assertEquals(bean.getTimezone(), bean2.getTimezone());

    Ebean.save(bean);
    BeanWithTimeZone bean3 = Ebean.find(BeanWithTimeZone.class, bean.getId());
View Full Code Here

Examples of com.avaje.ebean.text.json.JsonContext.toBean()

    } else {

      String jsonString = jsonContext.toJson(product);
      System.out.println(jsonString);

      Product refProd = jsonContext.toBean(Product.class, jsonString);

      BeanDescriptor<Product> prodDesc = server.getBeanDescriptor(Product.class);
      EntityBean eb = (EntityBean)refProd;
      prodDesc.isReference(eb._ebean_getIntercept());
     
View Full Code Here

Examples of com.avaje.ebean.text.json.JsonContext.toBean()

    JsonWriteOptions options = JsonWriteOptions.parsePath("*,details(id,orderQty,product(id))");

    String jsonOrder = jsonContext.toJson(order, options);
    System.out.println(jsonOrder);

    Order o2 = jsonContext.toBean(Order.class, jsonOrder);
    Customer customer = o2.getCustomer();
   
    BeanDescriptor<Customer> custDesc = server.getBeanDescriptor(Customer.class);

    Assert.assertTrue(custDesc.isReference(((EntityBean)customer)._ebean_getIntercept()));
View Full Code Here

Examples of net.sf.json.JSONObject.toBean()

    protected <T extends BaseJsonObject> T getResource(String path, Class<T> type) throws IOException {
        HttpURLConnection con = open(path);
        try {
            JSONObject json = JSONObject.fromObject(IOUtils.toString(con.getInputStream(), "UTF-8"));
            T resource = (T) json.toBean(type);
            resource.json = json;
            return resource;
        } catch (IOException e) {
            throw wrappedException(con, e);
        }
View Full Code Here

Examples of net.sf.json.JSONObject.toBean()

    /**
     * Gets a property with databinding.
     */
    public <T extends Property> T getProperty(String name, Class<T> type) {
        JSONObject o = getProperty(name);
        return o!=null ? type.cast(o.toBean(type)) : null;
    }

    /**
     * Gets a property with databinding. The type must have {@link com.cloudbees.mtslaves.client.properties.PropertyName} annotation on it.
     */
 
View Full Code Here

Examples of net.sf.json.JSONObject.toBean()

    protected <T extends BaseJsonObject> T getResource(String path, Class<T> type) throws IOException {
        HttpURLConnection con = open(path);
        try {
            JSONObject json = JSONObject.fromObject(IOUtils.toString(con.getInputStream(), "UTF-8"));
            T resource = (T) json.toBean(type);
            resource.json = json;
            return resource;
        } catch (IOException e) {
            InputStream es = con.getErrorStream();
            String payload = es!=null ? IOUtils.toString(es) : "(no data)";
View Full Code Here

Examples of org.vietspider.serialize.XML2Bean.toBean()

    String text = document.getTextValue();
    System.out.println(text);
   
   
    XML2Bean xml2Bean = XML2Bean.getInstance();
    Student student2 = xml2Bean.toBean(Student.class, text);
   
    System.out.println("\nstudent 2 name: " +student2.getName());
   
  }
 
View Full Code Here

Examples of org.vietspider.serialize.XML2Bean.toBean()

    MetaDocument document = null;
   
    for(XMLNode child : children) {
      if(child.isNode(CHANNEL)) {
        if(document == null) document = new MetaDocument();
        document.setChannel(toBean.toBean(RSSChannel.class, child));
        itemNodes = child.getChildren();
        if(itemNodes == null) return document;
        for(XMLNode itemNode : itemNodes) {
          if(!itemNode.isNode(ITEM)) continue;
          RSSItem rssItem = toBean.toBean(RSSItem.class, itemNode);
View Full Code Here

Examples of org.vietspider.serialize.XML2Bean.toBean()

        document.setChannel(toBean.toBean(RSSChannel.class, child));
        itemNodes = child.getChildren();
        if(itemNodes == null) return document;
        for(XMLNode itemNode : itemNodes) {
          if(!itemNode.isNode(ITEM)) continue;
          RSSItem rssItem = toBean.toBean(RSSItem.class, itemNode);
          parseRSSLink(itemNode, rssItem);
          document.addItem(rssItem);
        }
      } else if(child.isNode(FEED)) {
        if(document == null) document = new MetaDocument();
View Full Code Here

Examples of org.vietspider.serialize.XML2Bean.toBean()

          parseRSSLink(itemNode, rssItem);
          document.addItem(rssItem);
        }
      } else if(child.isNode(FEED)) {
        if(document == null) document = new MetaDocument();
        document.setChannel(toBean.toBean(FeedItem.class, child));
        itemNodes = child.getChildren();
        if(itemNodes == null) return document;
       
        for(XMLNode itemNode : itemNodes) {
          if(!itemNode.isNode(ENTRY)) continue;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.