BrightSide Workbench Full Report + Source Code
org.turro.jpa.serializer.SerializerMessage Class Reference

Public Member Functions

 SerializerMessage (Object entity)
 
 SerializerMessage (String data)
 
void show (Page page)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 39 of file SerializerMessage.java.

Constructor & Destructor Documentation

◆ SerializerMessage() [1/2]

org.turro.jpa.serializer.SerializerMessage.SerializerMessage ( Object  entity)

Definition at line 44 of file SerializerMessage.java.

44  {
45  this.entity = entity;
46  }

◆ SerializerMessage() [2/2]

org.turro.jpa.serializer.SerializerMessage.SerializerMessage ( String  data)

Definition at line 48 of file SerializerMessage.java.

48  {
49  this.data = data;
50  }

Member Function Documentation

◆ show()

void org.turro.jpa.serializer.SerializerMessage.show ( Page  page)

Definition at line 52 of file SerializerMessage.java.

52  {
53  try {
54  data = entity == null ? data : new XMLSerializer(entity).serialize();
55  try {
56  if(data.startsWith("<")) {
57  SAXBuilder builder = new SAXBuilder();
58  Document doc = builder.build(new StringReader(data.replaceAll("&(?![a-z]+;)", "&amp;")));
59  StringWriter sw = new StringWriter();
60  Format fm = Format.getPrettyFormat();
61  XMLOutputter xo = new XMLOutputter(fm);
62  xo.output(doc, sw);
63  sw.close();
64  Windows.title("XML Entity")
65  .addComponent(new PreLabel(sw.toString()))
66  .width("70%")
67  .height("50%")
68  .sizeable()
69  .scrollable()
70  .closeable()
71  .show();
72  } else if(data.startsWith("{")) {
73  Windows.title("JSON Entity")
74  .addComponent(new PreLabel(JsonSearch.of(data).pretty()))
75  .width("70%")
76  .height("50%")
77  .sizeable()
78  .scrollable()
79  .closeable()
80  .show();
81  }
82  } catch (Exception ex) {
83  Windows.title("String Entity")
84  .addComponent(new PreLabel(data))
85  .width("70%")
86  .height("50%")
87  .sizeable()
88  .scrollable()
89  .closeable()
90  .show();
91  }
92  } catch(Exception ex) {
93  WebLoggers.severe(this).exception(ex).log();
94  }
95 
96  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: