public final class IntentParameterInfo
- Object
- IntentParameterInfo
One parameter of a declared intent, as the framework and the simulator see
it. Built by the build-time generated registry from the
IntentParam
annotation; applications read these but never construct them.Constructors
Methods
public String getName() | The parameter name used on the wire and in the parameter map. |
public String getTitle() | The prompt the platform shows when it has to ask for this value – “Which playlist?”. |
public IntentParameterType getType() | The parameter kind. |
public boolean isRequired() | Whether the intent can run without this value. |
public String getEntityType() | The entity type id when getType() is IntentParameterType.ENTITY, otherwise null. |
public String getDefaultValue() | The value substituted when an optional parameter is absent, or null. |
public int getNumericWidthBits() | The width the handler declared for a numeric parameter: 32 for int and float, 64 for long and double, and 0 when it is not known. |
public List<String> getOptions() | The closed vocabulary this parameter accepts, or an empty list when any value is allowed. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Constructor details
IntentParameterInfo
public IntentParameterInfo(String name, String title, IntentParameterType type, boolean required, String entityType, String defaultValue, List<String> options)Framework entry point: builds a parameter description. Called by
generated code.
Parameters
nameString- the parameter name used on the wire
titleString- the prompt shown when the platform asks for this value
typeIntentParameterType- the parameter kind
requiredboolean- whether the intent can run without it
entityTypeString- the entity type id when
typeisENTITY, else null defaultValueString- the value used when an optional parameter is absent
optionsList<String>- the closed vocabulary, or null when the value is free
IntentParameterInfo
public IntentParameterInfo(String name, String title, IntentParameterType type, boolean required, String entityType, String defaultValue, List<String> options, int numericWidthBits)The same, carrying the width the handler actually declared.
Parameters
nameString- Not documented.
titleString- Not documented.
typeIntentParameterType- Not documented.
requiredboolean- Not documented.
entityTypeString- Not documented.
defaultValueString- Not documented.
optionsList<String>- Not documented.
numericWidthBitsint- 32 for
intandfloat, 64 forlonganddouble, 0 when the declaration does not record it
Method details
getName
public String getName()The parameter name used on the wire and in the parameter map.
getTitle
public String getTitle()The prompt the platform shows when it has to ask for this value –
“Which playlist?”. Falls back to the name when the declaration gave none.
getType
public IntentParameterType getType()The parameter kind.
isRequired
public boolean isRequired()Whether the intent can run without this value.
getEntityType
public String getEntityType()The entity type id when
getType() is IntentParameterType.ENTITY,
otherwise null.getDefaultValue
public String getDefaultValue()The value substituted when an optional parameter is absent, or null.
getNumericWidthBits
public int getNumericWidthBits()The width the handler declared for a numeric parameter: 32 for int and float, 64
for long and double, and 0 when it is not known.
getType() collapses int with long into INTEGER and float with double into
NUMBER, which is the right granularity for a platform that has one number type – but
it left the framework unable to tell whether 5000000000 was a value this handler could
hold. Guessing was wrong in both directions: guessing wide published donations that fail
on every tap for an int parameter, guessing narrow refused donations a long would
have run. The generated declarations record it, so there is nothing to guess.
getOptions
public List<String> getOptions()The closed vocabulary this parameter accepts, or an empty list when any
value is allowed.
toString
public String toString()Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + ‘@’ + Integer.toHexString(hashCode())