public class LayoutBuilder extends Object
name
property.Constructor and Description |
---|
LayoutBuilder() |
Modifier and Type | Method and Description |
---|---|
void |
add(Map<String,Object> data)
Adds a map of properties to this layout.
|
void |
add(String key,
Object value)
Adds the given key-value pair of property to this layout.
|
static LayoutBuilder |
from(Config config)
Builds a layout from the given config.
|
static LayoutBuilder |
from(Config config,
String defaultResourceType)
Builds a layout from the given config.
|
static LayoutBuilder |
from(Resource resource)
Builds a layout from the given resource.
|
static LayoutBuilder |
from(Resource resource,
String defaultResourceType)
Builds a layout from the given resource.
|
String |
getName()
Returns the name of this layout.
|
String |
getResourceType()
Returns the resource type of this layout.
|
boolean |
hasName()
true if this layout has name. |
void |
setName(String name)
Sets the name of this layout.
|
void |
setResourceType(String resourceType)
Sets the resource type of this layout.
|
JSONObject |
toJSON()
Returns this layout as JSON.
|
public static LayoutBuilder from(Config config)
Config.LAYOUT
path. This method doesn't set default resource type of layout, use from(Config, String)
or
ComponentHelper.getLayout()
instead.public static LayoutBuilder from(Config config, String defaultResourceType)
Config.LAYOUT
path. The given defaultResourceType will be used when sling:resourceType property of the resource is not set.public static LayoutBuilder from(Resource resource)
from(Resource, String)
or ComponentHelper.getLayout()
instead.public static LayoutBuilder from(Resource resource, String defaultResourceType)
public boolean hasName()
true
if this layout has name. false
otherwise.public String getName()
public void setName(String name)
public String getResourceType()
public void setResourceType(String resourceType)
public void add(String key, Object value)
public void add(Map<String,Object> data)
public JSONObject toJSON()
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"