mobi.voiceassistant.base
Class PendingRequest.Builder

java.lang.Object
  extended by mobi.voiceassistant.base.PendingRequest.Builder
All Implemented Interfaces:
Parcelable
Enclosing class:
PendingRequest

public static final class PendingRequest.Builder
extends Object
implements Parcelable

Builder for PendingRequest


Nested Class Summary
 
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
 
Field Summary
static Parcelable.Creator<PendingRequest.Builder> CREATOR
           
 
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
 
Constructor Summary
PendingRequest.Builder()
          No-arg constructor -> empty builder
PendingRequest.Builder(String action, Class<?> cls)
          Convenient constructor -> builder with action and class
PendingRequest.Builder(String action, Context pkg, Class<?> cls)
          Convenient constructor -> builder with action and component
 
Method Summary
 PendingRequest build(Request request)
          Build PendingRequest using Request's origin.
 PendingRequest build(Response response)
          Build PendingRequest using Response's uri as origin.
 PendingRequest build(Uri origin)
          Build PendingRequest using origin.
protected  ResId buildDispatch(Uri origin)
           
 PendingRequest.Builder clone()
          Make shallow copy.
 int describeContents()
           
 PendingRequest.Builder putBundleContent(String key, int value)
           
 PendingRequest.Builder putBundleContent(String key, Parcelable value)
           
 PendingRequest.Builder putBundleContent(String key, String value)
           
 PendingRequest.Builder setAction(String action)
          Sets action.
 PendingRequest.Builder setComponent(ComponentName cmp)
          Sets component package and class name.
 PendingRequest.Builder setComponent(Context pkg, Class<?> cls)
          Sets component package and class name.
 PendingRequest.Builder setComponent(Context pkg, String cls)
          Sets component package and class name.
 PendingRequest.Builder setComponent(String pkg, String cls)
          Sets component package and class name.
 PendingRequest.Builder setComponentName(Class<?> cls)
          Sets component class name.
 PendingRequest.Builder setComponentName(String cls)
          Sets component class name.
 PendingRequest.Builder setContent(Object content)
          Sets PendingRequest content.
 PendingRequest.Builder setDispatch(Context pkg, int id)
          Sets dispatch package and id.
 PendingRequest.Builder setDispatch(ResId dsp)
          Sets dispatch package and id.
 PendingRequest.Builder setDispatch(String pkg, int id)
          Sets dispatch package and id.
 PendingRequest.Builder setDispatchId(int id)
          Sets dispatch id.
 PendingRequest.Builder setLabel(Label label)
          Sets label.
 PendingRequest.Builder setMarshalContent(Object content)
           
 void writeToParcel(Parcel parcel, int flags)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATOR

public static final Parcelable.Creator<PendingRequest.Builder> CREATOR
Constructor Detail

PendingRequest.Builder

public PendingRequest.Builder()
No-arg constructor -> empty builder


PendingRequest.Builder

public PendingRequest.Builder(String action,
                              Class<?> cls)
Convenient constructor -> builder with action and class

See Also:
setAction(String), setComponentName(Class)

PendingRequest.Builder

public PendingRequest.Builder(String action,
                              Context pkg,
                              Class<?> cls)
Convenient constructor -> builder with action and component

See Also:
setAction(String), setComponent(Context, Class)
Method Detail

setLabel

public PendingRequest.Builder setLabel(Label label)
Sets label. Label being used in some cases (pickers, etc.).

Parameters:
label - The label
Returns:
this builder
See Also:
PendingRequest.getLabel()

setAction

public PendingRequest.Builder setAction(String action)
Sets action.

Parameters:
action - The action
Returns:
this builder
See Also:
PendingRequest.getAction(), AgentContract.Intents.ACTION_COMMAND

setComponentName

public PendingRequest.Builder setComponentName(String cls)
Sets component class name. Clears component package name.

Returns:
this builder
See Also:
PendingRequest.getComponent(), setComponent(ComponentName)

setComponentName

public PendingRequest.Builder setComponentName(Class<?> cls)
Sets component class name. Clears component package name

Returns:
this builder
See Also:
PendingRequest.getComponent(), setComponent(ComponentName)

setComponent

public PendingRequest.Builder setComponent(Context pkg,
                                           String cls)
Sets component package and class name.

Returns:
this builder
See Also:
PendingRequest.getComponent(), setComponent(ComponentName)

setComponent

public PendingRequest.Builder setComponent(Context pkg,
                                           Class<?> cls)
Sets component package and class name.

Returns:
this builder
See Also:
PendingRequest.getComponent(), setComponent(ComponentName)

setComponent

public PendingRequest.Builder setComponent(String pkg,
                                           String cls)
Sets component package and class name.

Returns:
this builder
See Also:
PendingRequest.getComponent(), setComponent(ComponentName)

setComponent

public PendingRequest.Builder setComponent(ComponentName cmp)
Sets component package and class name.

Returns:
this builder
See Also:
PendingRequest.getComponent()

buildDispatch

protected ResId buildDispatch(Uri origin)

setDispatchId

public PendingRequest.Builder setDispatchId(int id)
Sets dispatch id. Clears dispatch package name.

Returns:
this builder
See Also:
PendingRequest.getDispatch()

setDispatch

public PendingRequest.Builder setDispatch(Context pkg,
                                          int id)
Sets dispatch package and id.

Returns:
this builder
See Also:
PendingRequest.getDispatch()

setDispatch

public PendingRequest.Builder setDispatch(String pkg,
                                          int id)
Sets dispatch package and id.

Returns:
this builder
See Also:
PendingRequest.getDispatch()

setDispatch

public PendingRequest.Builder setDispatch(ResId dsp)
Sets dispatch package and id.

Returns:
this builder
See Also:
PendingRequest.getDispatch()

setContent

public PendingRequest.Builder setContent(Object content)
Sets PendingRequest content.

Returns:
this builder
See Also:
PendingRequest.getContent()

setMarshalContent

public PendingRequest.Builder setMarshalContent(Object content)

putBundleContent

public PendingRequest.Builder putBundleContent(String key,
                                               int value)
Parameters:
key - Content key
value - Content value
Returns:
this builder
See Also:
Request.getBundleIntContent(String)

putBundleContent

public PendingRequest.Builder putBundleContent(String key,
                                               Parcelable value)
Parameters:
key - Content key
value - Content value
Returns:
this builder
See Also:
Request.getBundleParcelableContent(String)

putBundleContent

public PendingRequest.Builder putBundleContent(String key,
                                               String value)
Parameters:
key - Content key
value - Content value
Returns:
this builder
See Also:
Request.getBundleStringContent(String)

build

public PendingRequest build(Uri origin)
Build PendingRequest using origin.

Following rules apply:

Parameters:
origin - Uri to extract missing data from
Returns:
Newly created PendingRequest

build

public PendingRequest build(Request request)
Build PendingRequest using Request's origin.

Parameters:
request - Request to extract missing origin data from
Returns:
Newly created PendingRequest
See Also:
build(Uri)

build

public PendingRequest build(Response response)
Build PendingRequest using Response's uri as origin.

Parameters:
response - Response to extract missing origin data from
Returns:
Newly created PendingRequest
See Also:
build(Uri)

describeContents

public int describeContents()
Specified by:
describeContents in interface Parcelable

clone

public PendingRequest.Builder clone()
Make shallow copy.

Overrides:
clone in class Object
Returns:
Shallow copy of this builder

writeToParcel

public void writeToParcel(Parcel parcel,
                          int flags)
Specified by:
writeToParcel in interface Parcelable