com.enonic.xp.data.PropertyTreeJson Maven / Gradle / Ivy
The newest version!
package com.enonic.xp.data;
import java.util.ArrayList;
import java.util.List;
import com.enonic.xp.annotation.PublicApi;
@PublicApi
public class PropertyTreeJson
{
public static PropertyTree fromJson( final List list )
{
final PropertyTree tree = new PropertyTree();
for ( PropertyArrayJson propertyArrayJson : list )
{
propertyArrayJson.fromJson( tree.getRoot() );
}
return tree;
}
public static List toJson( final PropertyTree propertyTree )
{
final List list = new ArrayList<>();
for ( final PropertyArray propertyArray : propertyTree.getRoot().getPropertyArrays() )
{
list.add( PropertyArrayJson.toJson( propertyArray ) );
}
return list;
}
}