T
- the builder type subclassU
- class of data object to be createdprotected abstract static class DXDataObject.Builder<T extends DXDataObject.Builder<T,U>,U extends DXDataObject> extends Object
U
.Modifier and Type | Field and Description |
---|---|
protected Boolean |
createParents |
protected com.fasterxml.jackson.databind.JsonNode |
details |
protected DXEnvironment |
env |
protected String |
folder |
protected Boolean |
hidden |
protected String |
name |
protected DXContainer |
project |
protected com.google.common.collect.ImmutableMap.Builder<String,String> |
properties |
protected List<String> |
tags |
protected List<String> |
types |
Modifier | Constructor and Description |
---|---|
protected |
Builder() |
protected |
Builder(DXEnvironment env) |
Modifier and Type | Method and Description |
---|---|
T |
addTags(Collection<String> tags)
Adds the specified tags to the newly created data object.
|
T |
addTypes(Collection<String> types)
Adds the specified types to the newly created data object.
|
abstract U |
build()
Creates the new data object.
|
protected void |
checkAndFixParameters()
Ensures that the project was either explicitly set or that the environment specifies a
workspace.
|
protected static String |
getNewObjectId(com.fasterxml.jackson.databind.JsonNode responseJson)
Deserializes the response to a
/class-xxxx/new API call and returns the ID of the
newly created object. |
protected abstract T |
getThisInstance()
Returns the builder object.
|
T |
putAllProperties(Map<String,String> properties)
Sets the specified properties on the newly created data object.
|
T |
putProperty(String key,
String value)
Sets the specified property on the newly created data object.
|
T |
setDetails(Object details)
Sets the details of the data object to be created.
|
T |
setFolder(String folder)
Sets the folder in which the data object will be created.
|
T |
setFolder(String folder,
boolean createParents)
Sets the folder in which the data object will be created, optionally specifying that the
folder and its parents should be created if necessary.
|
T |
setName(String name)
Sets the name of the newly created data object.
|
T |
setProject(DXContainer project)
Sets the project or container where the new data object will be created.
|
T |
setVisibility(boolean visible)
Sets the visibility of the new data object.
|
protected DXContainer project
protected String name
protected String folder
protected Boolean createParents
protected com.fasterxml.jackson.databind.JsonNode details
protected Boolean hidden
protected final DXEnvironment env
protected Builder()
protected Builder(DXEnvironment env)
protected static String getNewObjectId(com.fasterxml.jackson.databind.JsonNode responseJson)
/class-xxxx/new
API call and returns the ID of the
newly created object.public T addTags(Collection<String> tags)
tags
- tags to addBuilder
objectpublic T addTypes(Collection<String> types)
types
- types to addBuilder
objectpublic abstract U build()
DXDataObject
corresponding to the newly created objectprotected void checkAndFixParameters()
protected abstract T getThisInstance()
This abstract method is implemented by the Builder methods so that common methods can get an instance of the subclass for chaining purposes.
public T putAllProperties(Map<String,String> properties)
properties
- Map containing non-null keys and values which will be set as property
keys and values respectivelyBuilder
objectpublic T putProperty(String key, String value)
key
- property key to setvalue
- property value to setBuilder
objectpublic T setDetails(Object details)
details
- an object whose JSON serialized form will be set as the detailsBuilder
objectpublic T setFolder(String folder)
folder
- full path to destination folder (a String starting with "/"
)Builder
objectpublic T setFolder(String folder, boolean createParents)
folder
- full path to destination folder (a String starting with "/"
)createParents
- if true, the folder will be created if it doesn't existBuilder
objectpublic T setName(String name)
name
- name to setBuilder
objectpublic T setProject(DXContainer project)
project
- DXProject
or DXContainer
Builder
objectpublic T setVisibility(boolean visible)
visible
- if false, the object will be hiddenBuilder
objectCopyright © 2023. All Rights Reserved.