Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support DTOs with properties typed 'any' through JsonElement
1- Serialzie and de-serialize JsonElement properties as raw JSONs 2- Deep-copy them in the generated copy constructors 3- Avoid redundant copying in fromJsonString() and toJson() cases Signed-off-by: Tareq Sharafy <tareq.sharafy@sap.com>
- Loading branch information
Showing
4 changed files
with
111 additions
and
6 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
31 changes: 31 additions & 0 deletions
31
platform-api/che-core-api-dto/src/test/java/org/eclipse/che/dto/definitions/DtoWithAny.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,31 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2015 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.dto.definitions; | ||
|
||
import org.eclipse.che.dto.shared.DTO; | ||
|
||
import com.google.gson.JsonElement; | ||
|
||
/** | ||
* Makes use of the 'any' (JsonElement) property type feature. | ||
* | ||
* @author Tareq Sharafy (tareq.sharafy@sap.com) | ||
*/ | ||
@DTO | ||
public interface DtoWithAny { | ||
int getId(); | ||
|
||
JsonElement getStuff(); | ||
|
||
void setStuff(JsonElement stuff); | ||
|
||
DtoWithAny withStuff(JsonElement stuff); | ||
} |