public class LayoutBuilder
extends java.lang.Object
name
property.Constructor and Description |
---|
LayoutBuilder() |
LayoutBuilder(Resource resource) |
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Map<java.lang.String,java.lang.Object> data)
Adds a map of properties to this layout.
|
void |
add(java.lang.String key,
java.lang.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,
java.lang.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,
java.lang.String defaultResourceType)
Builds a layout from the given resource.
|
java.lang.String |
getName()
Returns the name of this layout.
|
java.lang.String |
getResourceType()
Returns the resource type of this layout.
|
boolean |
hasName()
true if this layout has name. |
void |
setName(java.lang.String name)
Sets the name of this layout.
|
void |
setResourceType(java.lang.String resourceType)
Sets the resource type of this layout.
|
JSONObject |
toJSON()
Returns this layout as JSON.
|
public LayoutBuilder()
public LayoutBuilder(Resource resource)
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, java.lang.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, java.lang.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 java.lang.String getName()
public void setName(java.lang.String name)
name
- the name to setpublic java.lang.String getResourceType()
public void setResourceType(java.lang.String resourceType)
resourceType
- the resource type to setpublic void add(java.lang.String key, java.lang.Object value)
key
- the property keyvalue
- the property valuepublic void add(java.util.Map<java.lang.String,java.lang.Object> data)
data
- the map of properties to addpublic JSONObject toJSON()
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"