Examples of Json


Examples of org.auraframework.util.json.Json

     * Verify registered components are serialized in alphabetical order
     */
    public void testSerializeAsPart() throws Exception {
        InstanceStack iStack = new InstanceStack();

        Json jsonMock = Mockito.mock(Json.class);
        BaseComponent<?, ?> a = getComponentWithPath("a");
        BaseComponent<?, ?> b = getComponentWithPath("b");
        BaseComponent<?, ?> c = getComponentWithPath("c");
        iStack.registerComponent(b);
        iStack.registerComponent(c);
View Full Code Here

Examples of org.eclipse.jetty.util.ajax.JSON

   */
  @Override
  public void init() throws ServletException {
    super.init();
    final JSONObjectConvertor cvt = new JSONObjectConvertor();
    jsonRemoteNode = new JSON();
    jsonRemoteNode.addConvertor(RemoteNode.class, cvt);
    jsonRemoteNodeReading = new JSON();
    jsonRemoteNodeReading.addConvertor(RemoteNodeReading.class, cvt);
    uiListener = new UGateListener() {
      @Override
      public void handle(final UGateEvent<?, ?> event) {
        if (members.size() <= 0) {
View Full Code Here

Examples of org.fusesource.restygwt.client.Json

            if (typeInfo == null) {
                getLogger().log(ERROR, "Abstract classes must be annotated with JsonTypeInfo");
                throw new UnableToCompleteException();
            }
        }
        Json jsonAnnotation = getAnnotation(source, Json.class);
        final Style classStyle = jsonAnnotation != null ? jsonAnnotation.style() : Style.DEFAULT;
        final String railsWrapperName = jsonAnnotation != null && jsonAnnotation.name().length() > 0 ? jsonAnnotation.name() : sourceClazz.getName().toLowerCase();
        locator = new JsonEncoderDecoderInstanceLocator(context, getLogger());

        generateSingleton(shortName);

        generateEncodeMethod(source, classStyle, typeInfo, railsWrapperName, possibleTypes, isLeaf, locator);
View Full Code Here

Examples of org.geomajas.global.Json

    bd.writableProps = new HashMap<String, Method>();
    PropertyDescriptor[] props = bd.beanInfo.getPropertyDescriptors();
    for (PropertyDescriptor prop : props) {
      Method writeMethod = prop.getWriteMethod();
      if (writeMethod != null) {
        Json json = writeMethod.getAnnotation(Json.class);
        if (json == null || json.serialize()) {
          bd.writableProps.put(prop.getName(), writeMethod);
        } else {
          log.debug("skipping property {} for {}", prop.getName(), clazz.getName());
        }
      }
      Method readMethod = prop.getReadMethod();
      // due to a bug in the JAXB spec, Boolean getters are using isXXX
      // i.o. getXXX as
      // expected by bean introspectors
      if (readMethod == null) {
        if (writeMethod != null && writeMethod.getParameterTypes()[0].equals(Boolean.class)) {
          if (writeMethod.getName().startsWith("set")) {
            String isMethodName = "is" + writeMethod.getName().substring(3);
            try {
              readMethod = clazz.getMethod(isMethodName);
              if (!readMethod.getReturnType().equals(Boolean.class)) {
                readMethod = null;
              }
            } catch (Exception e) {
              log.error("discarding:" + e.getMessage());
            }
          }
        }
      }
      if (readMethod != null) {
        Json json = readMethod.getAnnotation(Json.class);
        if (json == null || json.serialize()) {
          bd.readableProps.put(prop.getName(), readMethod);
        }
      }
    }
    if (clazz.isEnum()) {
View Full Code Here

Examples of org.jclouds.json.Json

         @Override
         protected RuntimeMXBean provideRuntimeMXBean() {
            return runtime;
         }
      });
      Json json = injector.getInstance(Json.class);
      Ohai ohai = injector.getInstance(Ohai.class);
      assertEquals(json.toJson(ohai.ohai.get().get("uptime_seconds")), "69876");
   }
View Full Code Here

Examples of org.mojavemvc.views.JSON

    @Action("json")
    public JSON sendJSON() {

        String json = "{\"Test\":{\"hello\": 1}}";

        return new JSON(json);
    }
View Full Code Here

Examples of org.mojavemvc.views.JSON

       
        JSONEntityMarshaller m = new JSONEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        View v = m.marshall(entity);
        assertTrue(v instanceof JSON);
        assertEquals(new JSON(entity).toString(), ((JSON)v).toString());
    }
View Full Code Here

Examples of org.mojavemvc.views.JSON

        SimplePojo entity = new SimplePojo("test");
        MarshallablePojo<SimplePojo> marshallable =
                new MarshallablePojo<SimplePojo>(entity);
        View v = m.marshall(marshallable);
        assertTrue(v instanceof JSON);
        assertEquals(new JSON(entity).toString(), ((JSON)v).toString());
    }
View Full Code Here

Examples of org.mojavemvc.views.JSON

        JSONEntityMarshaller m = new JSONEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        AnnotatedPojo marshallable = new AnnotatedPojo(entity);
        View v = m.marshall(marshallable);
        assertTrue(v instanceof JSON);
        assertEquals(new JSON(entity).toString(), ((JSON)v).toString());
    }
View Full Code Here

Examples of org.mojavemvc.views.JSON

*/
public class TestJSON {

    @Test
    public void returnsCorrectContentType() {
        JSON json = new JSON("");
        assertEquals("application/json", json.getContentType());
    }
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.