public class ObjectDataSenderBuilder extends Object implements IDataSenderBuilder, Serializable
Constructor and Description |
---|
ObjectDataSenderBuilder()
Raw constructor.
|
ObjectDataSenderBuilder(String objectName)
Base constructor, defining the object name.
|
ObjectDataSenderBuilder(String objectName,
boolean hasItems)
Base constructor, defining the object name and specifying whether fields / children are in an items object
|
ObjectDataSenderBuilder(String objectName,
boolean hasItems,
WWFieldsAttributesInterface[] fieldsEnum)
Constructor, defining the object name and whether fields should be wrapped in an items object.
|
ObjectDataSenderBuilder(String objectName,
Class<?> clazz,
Boolean hasItems)
Constructor, defining the object name, specifying whether fields are in an items object.
|
ObjectDataSenderBuilder(String objectName,
WWFieldsAttributesInterface[] fieldsEnum)
Constructor, defining the object name.
|
Modifier and Type | Method and Description |
---|---|
ObjectDataSenderBuilder |
addAttribute(String key,
Object value)
Add an attribute by which to filter the request
|
ObjectDataSenderBuilder |
addAttribute(WWFieldsAttributesInterface enumName,
Object value)
Add an attribute by which to filter the request
|
ObjectDataSenderBuilder |
addChild(IDataSenderBuilder child)
Add a request for a specific child from the object
|
ObjectDataSenderBuilder |
addField(String field)
Add a field to return from the object
|
ObjectDataSenderBuilder |
addField(WWFieldsAttributesInterface field)
Add a field to request from the object
|
ObjectDataSenderBuilder |
addPageInfo()
Adds a query to retrieve the full, default PageInfo object
|
ObjectDataSenderBuilder |
addPageInfo(ObjectDataSenderBuilder pageInfoCustom)
Adds a query to retrieve a custom set of PageInfo
|
String |
build()
Builds the JSON stream to send.
|
String |
build(boolean pretty)
Builds the JSON stream to send, optionally adding pretty styling
|
Map<String,Object> |
getAttributesList() |
List<IDataSenderBuilder> |
getChildren() |
List<String> |
getFieldsList() |
String |
getObjectForQuery()
If a return type has been defined, we need to return objectName:returnTypeForQuery e.g.
|
String |
getObjectName() |
WWQueryResponseObjectInterface |
getReturnType()
Get enum containing class response needs casting to
|
boolean |
isHasAlias() |
boolean |
isHasItems() |
ObjectDataSenderBuilder |
removeAttribute(String key)
Remove an attribute from the request
|
ObjectDataSenderBuilder |
removeAttribute(WWFieldsAttributesInterface enumName)
Remove an attribute from the request
|
ObjectDataSenderBuilder |
removeChild(IDataSenderBuilder child)
Removes a request for a specific child from the object
|
ObjectDataSenderBuilder |
removeField(String field)
Removes a field to request from the object
|
ObjectDataSenderBuilder |
removeField(WWFieldsAttributesInterface field)
Removes a field to request from the object
|
ObjectDataSenderBuilder |
removePageInfo()
Remove the request for PageInfo from this object
|
ObjectDataSenderBuilder |
setAttributesList(Map<String,Object> attributesList)
Adds a map of attributes by which the filter the request
|
ObjectDataSenderBuilder |
setChildren(List<IDataSenderBuilder> children) |
void |
setFieldsList(List<String> fieldsList) |
void |
setHasAlias(boolean hasAlias) |
ObjectDataSenderBuilder |
setHasItems(boolean hasItems)
Defines whether the object's properties are wrapped in an items container
|
void |
setObjectName(String objectName) |
void |
setReturnType(WWQueryResponseObjectInterface returnType)
When using an alias, we need to capture class to case return to
|
public ObjectDataSenderBuilder()
public ObjectDataSenderBuilder(String objectName)
objectName
- String name of the object, used in the query. Consult WWS GraphQL Builder for detailspublic ObjectDataSenderBuilder(String objectName, boolean hasItems)
objectName
- String name of the object, used in the query. Consult WWS GraphQL Builder for detailshasItems
- boolean whether the fields / children are wrapped in "items{}"public ObjectDataSenderBuilder(String objectName, Class<?> clazz, Boolean hasItems)
objectName
- String name of the object, used in the query. Consult WWS GraphQL Builder for detailsclazz
- Class from which to add all fieldshasItems
- boolean whether the fields / children are wrapped in "items{}"public ObjectDataSenderBuilder(String objectName, WWFieldsAttributesInterface[] fieldsEnum)
isHasItems()
will be falseobjectName
- String name of the object, used in the query. Consult WWS GraphQL Builder for detailsfieldsEnum
- Enum of fields, all of which will be addedpublic ObjectDataSenderBuilder(String objectName, boolean hasItems, WWFieldsAttributesInterface[] fieldsEnum)
objectName
- String name of the object, used in the query. Consult WWS GraphQL Builder for detailshasItems
- boolean whether the fields / children are wrapped in "items{}"fieldsEnum
- Enum of fields, all of which will be addedpublic void setReturnType(WWQueryResponseObjectInterface returnType)
returnType
- Class of return objectpublic WWQueryResponseObjectInterface getReturnType()
public String build()
IDataSenderBuilder
IDataSenderBuilder.build(boolean)
, passing falsebuild
in interface IDataSenderBuilder
public String build(boolean pretty)
IDataSenderBuilder
build
in interface IDataSenderBuilder
pretty
- boolean whether or not to output in a more readable formatpublic String getObjectName()
public String getObjectForQuery()
public void setObjectName(String objectName)
objectName
- String, name of the query objectpublic boolean isHasItems()
public ObjectDataSenderBuilder setHasItems(boolean hasItems)
hasItems
- boolean, whether the object's fields and children are wrapped in an items containerpublic List<String> getFieldsList()
public void setFieldsList(List<String> fieldsList)
fieldsList
- List of string fields to returnpublic ObjectDataSenderBuilder addField(String field)
field
- String, name of the field to addpublic ObjectDataSenderBuilder addField(WWFieldsAttributesInterface field)
field
- WWFieldsAttributesInterface enum, whose label property is the name of the field to addpublic ObjectDataSenderBuilder removeField(String field)
field
- String, name of the field to removepublic ObjectDataSenderBuilder removeField(WWFieldsAttributesInterface field)
field
- String, WWFieldsAttributesInterface field to removepublic Map<String,Object> getAttributesList()
public ObjectDataSenderBuilder setAttributesList(Map<String,Object> attributesList)
attributesList
- Map of attributes to filter the request on. The key will be the attribute name, the value will be the value to filter againstpublic ObjectDataSenderBuilder addAttribute(String key, Object value)
key
- String, attribute name to filter onvalue
- Object, value to filter onpublic ObjectDataSenderBuilder addAttribute(WWFieldsAttributesInterface enumName, Object value) throws WWException
enumName
- enum, from which label property will give attribute name to filter onvalue
- Object, value to filter onWWException
- containing an error message, if the value is a different data type to what the enum expectspublic ObjectDataSenderBuilder removeAttribute(String key)
key
- String, attribute to remove from the requestpublic ObjectDataSenderBuilder removeAttribute(WWFieldsAttributesInterface enumName)
enumName
- enum, from which label property will give attribute name to filter onpublic List<IDataSenderBuilder> getChildren()
IDataSenderBuilder
children to request from the objectpublic ObjectDataSenderBuilder setChildren(List<IDataSenderBuilder> children)
children
- List of IDataSenderBuilder
children to request from the objectpublic ObjectDataSenderBuilder addChild(IDataSenderBuilder child)
child
- DataSenderBuilder, child to addpublic ObjectDataSenderBuilder removeChild(IDataSenderBuilder child)
child
- DataSenderBuilder, child to removepublic ObjectDataSenderBuilder addPageInfo()
public ObjectDataSenderBuilder addPageInfo(ObjectDataSenderBuilder pageInfoCustom)
pageInfoCustom
- ObjectDataSenderBuilder containing the PageInfo fields to returnpublic ObjectDataSenderBuilder removePageInfo()
public boolean isHasAlias()
public void setHasAlias(boolean hasAlias)
Copyright © 2018 OpenNTF. All rights reserved.