Package br.com.caelum.vraptor.serialization.xstream

Examples of br.com.caelum.vraptor.serialization.xstream.XStreamJSONSerialization


    return instanceView(view);
  }

  private <T extends View> T instanceView(Class<T> view){
    if (view.isAssignableFrom(JSONSerialization.class)){
      this.serialization = new XStreamJSONSerialization(response, extractor, initializer, builder);
      return view.cast(serialization);
    }
   
    if (view.isAssignableFrom(XMLSerialization.class)){
      this.serialization = new XStreamXMLSerialization(response, extractor, initializer, builder);
View Full Code Here


    return instanceView(view);
  }

  private <T extends View> T instanceView(Class<T> view){
    if (view.isAssignableFrom(JSONSerialization.class)){
      this.serialization = new XStreamJSONSerialization(response, extractor, initializer, builder);
      return view.cast(serialization);
    }
   
    if (view.isAssignableFrom(XMLSerialization.class)){
      this.serialization = new XStreamXMLSerialization(response, extractor, initializer, builder);
View Full Code Here

    return instanceView(view);
  }

  private <T extends View> T instanceView(Class<T> view){
    if (view.isAssignableFrom(JSONSerialization.class)){
      this.serialization = new XStreamJSONSerialization(response, extractor, initializer, builder);
      return view.cast(serialization);
    }
   
    if (view.isAssignableFrom(XMLSerialization.class)){
      this.serialization = new XStreamXMLSerialization(response, extractor, initializer, builder);
View Full Code Here

  public void shouldSortBasedOnPackageNamesLessPriorityToCaelumInitialList3rdPartyFirst() {
    List<Serialization> serializers = new ArrayList<Serialization>();

    serializers.add(new DumbSerialization());
    serializers.add(new XStreamXMLSerialization(null, null, null, null));
    serializers.add(new XStreamJSONSerialization(null, null, null, null));
    serializers.add(new HTMLSerialization(null, null));
    serializers.add(new RestfulSerialization(null, null, null, null, null, null));

    Collections.sort(serializers, new PackageComparator());
   
View Full Code Here

  @Test
  public void shouldSortBasedOnPackageNamesLessPriorityToCaelumInitialList3rdPartyLast() {
    List<Serialization> serializers = new ArrayList<Serialization>();
   
    serializers.add(new XStreamXMLSerialization(null, null, null, null));
    serializers.add(new XStreamJSONSerialization(null, null, null, null));
    serializers.add(new HTMLSerialization(null, null));
    serializers.add(new RestfulSerialization(null, null, null, null, null, null));
    serializers.add(new DumbSerialization());
   
    Collections.sort(serializers, new PackageComparator());
View Full Code Here

  @Test
  public void shouldSortBasedOnPackageNamesLessPriorityToCaelumMoreToRestfulieInitialList3rdPartyLast() {
    List<Serialization> serializers = new ArrayList<Serialization>();
   
    serializers.add(new XStreamXMLSerialization(null, null, null, null));
    serializers.add(new XStreamJSONSerialization(null, null, null, null));
    serializers.add(new HTMLSerialization(null, null));
    serializers.add(new RestfulSerialization(null, null, null, null, null, null));
    serializers.add(new DumbSerialization());
   
    Collections.sort(serializers, new PackageComparator());
View Full Code Here

  HttpServletResponse response = mock(HttpServletResponse.class);
  when(response.getWriter()).thenReturn(new PrintWriter(stream));
  DefaultTypeNameExtractor extractor = new DefaultTypeNameExtractor();
    HibernateProxyInitializer initializer = new HibernateProxyInitializer();
    XStreamBuilder builder = XStreamBuilderImpl.cleanInstance(new MessageConverter());
    XStreamJSONSerialization jsonSerialization = new XStreamJSONSerialization(response, extractor, initializer, builder);
    XStreamXMLSerialization xmlSerialization = new XStreamXMLSerialization(response, extractor, initializer, builder);
   
    Container container = mock(Container.class);
    when(container.instanceFor(JSONSerialization.class)).thenReturn(jsonSerialization);
    when(container.instanceFor(XMLSerialization.class)).thenReturn(xmlSerialization);
View Full Code Here

    return instanceView(view);
  }

  private <T extends View> T instanceView(Class<T> view){
    if (view.isAssignableFrom(JSONSerialization.class)){
      this.serialization = new XStreamJSONSerialization(response, extractor, initializer, builder);
      return view.cast(serialization);
    }
   
    if (view.isAssignableFrom(XMLSerialization.class)){
      this.serialization = new XStreamXMLSerialization(response, extractor, initializer, builder);
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.serialization.xstream.XStreamJSONSerialization

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.