-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
138 changed files
with
1,180 additions
and
1,731 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
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
48 changes: 4 additions & 44 deletions
48
modules/core/core-api/src/main/java/com/enonic/xp/data/PropertyArrayJson.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 |
---|---|---|
@@ -1,55 +1,15 @@ | ||
package com.enonic.xp.data; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import com.enonic.xp.annotation.PublicApi; | ||
|
||
@PublicApi | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class PropertyArrayJson | ||
public final class PropertyArrayJson | ||
{ | ||
@JsonProperty("name") | ||
private String name; | ||
|
||
@JsonProperty("type") | ||
private String type; | ||
|
||
@JsonProperty("values") | ||
private List<PropertyValueJson> values; | ||
|
||
public PropertyArrayJson() | ||
{ | ||
} | ||
|
||
static PropertyArrayJson toJson( final PropertyArray propertyArray ) | ||
{ | ||
final PropertyArrayJson json = new PropertyArrayJson(); | ||
json.name = propertyArray.getName(); | ||
json.type = propertyArray.getValueType().getName(); | ||
|
||
json.values = new ArrayList<>( propertyArray.size() ); | ||
for ( final Property property : propertyArray.getProperties() ) | ||
{ | ||
json.values.add( new PropertyValueJson( property ) ); | ||
} | ||
|
||
return json; | ||
} | ||
|
||
void fromJson( final PropertySet parent ) | ||
{ | ||
final ValueType valueType = ValueTypes.getByName( type ); | ||
final PropertyArray array = new PropertyArray( parent, name, valueType, values.size() ); | ||
public String name; | ||
|
||
for ( final PropertyValueJson valueJson : values ) | ||
{ | ||
valueJson.fromJson( array, valueType ); | ||
} | ||
public String type; | ||
|
||
parent.addPropertyArray( array ); | ||
} | ||
public List<PropertyValueJson> values; | ||
} |
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
Oops, something went wrong.