@Retention(value=SOURCE) @Target(value=METHOD) public @interface OnLocation
start
and stop requests for obtaining current
location of the application/device/user. Put the OnLocation annotation
on top of a (non-private) method in your class which takes one argument
Position. Based on name of your method (unless a class name is
directly specified via OnLocation.className() attribute) a handle class is
generated. For example if your method name is callMeWhenYouKnowWhereYouAre
a package private class CallMeWhenYouKnowWhereYouAreHandle will
be generated in the same package. One can use its createQuery
and createWatch static method to get one time/repeated time
instance of a handle. After configuring the
handle via its setter methods, one can
start the location request.
In case something goes wrong a method in the same class named OnLocation.onError()
can be specified (should take one Exception parameter).
The overall behavior of the system mimics W3C's Geolocation API.
public abstract String className
handle class to generate. By
default the name is derived from the name of annotated method by
capitalizing the first character and appending Handle.
The generated class contains two static methods: createQuery
and createWatch which take no parameters if this method
is static or one parameter (of this class) if this method is instance
one. Both static methods return Position.Handle.
public abstract String onError
Exception
parameter. If this method is not specified, the exception is just
printed to console.Copyright © 2018 NetBeans. All rights reserved.