Class IntentParameterInfo

java.lang.Object
com.codename1.intents.IntentParameterInfo

public final class IntentParameterInfo extends Object
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.
  • 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
      • name: the parameter name used on the wire
      • title: the prompt shown when the platform asks for this value
      • type: the parameter kind
      • required: whether the intent can run without it
      • entityType: the entity type id when type is ENTITY, else null
      • defaultValue: the value used when an optional parameter is absent
      • options: 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
      • numericWidthBits: 32 for int and float, 64 for long and double, 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()
      Description copied from class: Object
      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())
      Overrides:
      toString in class Object