-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server: Added DataType to column descriptors and serializer
[Added] DataType to column descriptors and serializer Change-Id: Id3a1e27d73762ab830f4a99b88dc52b00d418810 Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/199989 Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org> Tested-by: Patrick Tasse <patrick.tasse@gmail.com> Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
- Loading branch information
Showing
5 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...s/incubator/internal/trace/server/jersey/rest/core/webapp/TreeColumnHeaderSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/********************************************************************** | ||
* Copyright (c) 2023 Ericsson | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License 2.0 which | ||
* accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
**********************************************************************/ | ||
|
||
package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.webapp; | ||
|
||
import java.io.IOException; | ||
|
||
import org.eclipse.jdt.annotation.NonNull; | ||
import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.views.TreeModelWrapper.TreeColumnHeader; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
import com.fasterxml.jackson.databind.ser.std.StdSerializer; | ||
|
||
/** | ||
* Serializer for tmf tree entry model {@link TreeColumnHeader} | ||
* | ||
* @author Bernd Hufmann | ||
*/ | ||
public class TreeColumnHeaderSerializer extends StdSerializer<@NonNull TreeColumnHeader> { | ||
|
||
/** | ||
* Generated serial UID | ||
*/ | ||
private static final long serialVersionUID = 3393902091244330176L; | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
protected TreeColumnHeaderSerializer() { | ||
super(TreeColumnHeader.class); | ||
} | ||
|
||
@Override | ||
public void serialize(TreeColumnHeader value, JsonGenerator gen, SerializerProvider provider) throws IOException { | ||
gen.writeStartObject(); | ||
gen.writeStringField("name", value.getName()); //$NON-NLS-1$ | ||
gen.writeStringField("tooltip", value.getTooltip()); //$NON-NLS-1$ | ||
if (value.getDataType() != null) { | ||
gen.writeStringField("dataType", value.getDataType()); //$NON-NLS-1$ | ||
} | ||
gen.writeEndObject(); | ||
} | ||
} |