@Retention(CLASS) @Target({TYPE})

public @interface IntentEntity

Marks one of your application’s own nouns – an order, a playlist, a saved route – as something the system can name, list, search and hand back to an AppIntent.

@IntentEntity(value = "playlist", title = "Playlist")
public class Playlist {
    @EntityId    public String getId()   { return id; }
    @EntityTitle public String getName() { return name; }

    @EntityQuery(EntityQuery.Kind.BY_ID)
    public static Playlist byId(String id) { return Library.playlist(id); }

    @EntityQuery(EntityQuery.Kind.SUGGESTED)
    public static List<Playlist> recent() { return Library.recentPlaylists(); }
}

Your class stays your class. There is no interface to implement and no base class to extend, because a domain model outlives the framework it is used with; the build reads the annotated members and generates the adapter.

Why this is what makes intents feel intelligent

An entity-typed parameter is what lets the platform run its own picker before your code is ever called. “Play a playlist” with nothing specified makes the system ask “Which one?”, fill the list from your SUGGESTED query, and hand your handler the chosen object. A plain String parameter can never do that – it can only be typed or spoken verbatim.

A BY_ID query is mandatory. Entities cross the platform boundary as their id and nothing else, so resolving that id back to an object is the one operation the framework cannot do without.

Methods

public abstract String value()The entity type id, matching [a-z][a-z0-9_]{2,63}.
public abstract String title() default ""The human-readable type name shown by pickers.
public abstract boolean indexed() default falseTrue to make instances of this type eligible for device search through com.codename1.intents.Intents#index.

Method details

value

public abstract String value()
The entity type id, matching [a-z][a-z0-9_]{2,63}. Required, and stable for the same reason an intent id is: indexed items persist it.

title

public abstract String title() default ""
The human-readable type name shown by pickers. Defaults to the id.

indexed

public abstract boolean indexed() default false
True to make instances of this type eligible for device search through com.codename1.intents.Intents#index. Requires an EntityTitle, since an entry with nothing to display is not a search result.