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.config
- the configpublic 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.config
- the configdefaultResourceType
- the default resource typepublic static LayoutBuilder from(Resource resource)
from(Resource, String)
or ComponentHelper.getLayout()
instead.resource
- the resourcepublic static LayoutBuilder from(Resource resource, String defaultResourceType)
resource
- the resourcedefaultResourceType
- the default resource typepublic boolean hasName()
true
if this layout has name. false
otherwise.true
if this layout has a name, false
otherwisepublic String getName()
public void setName(String name)
name
- the name to setpublic String getResourceType()
public void setResourceType(String resourceType)
resourceType
- the resource type to setpublic void add(String key, Object value)
key
- the property keyvalue
- the property valuepublic void add(Map<String,Object> data)
data
- the map of properties to addpublic JSONObject toJSON()
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"