org.universAAL.support.utils.service
Class Arg

Package class diagram package Arg
java.lang.Object
  extended by org.universAAL.support.utils.service.Arg

public class Arg
extends Object

Helper class to build arguments in a service request. Arguments are the "leaf" objects at the end of a property path and can be of several types depending on what you want to do with them. This class adds an additional help level to using Request and Profile. Following the example in Profile, thanks to Arg it could be:

Example: Calling a Lighting service that controls LightSources of type ElectricLight, find the light with URI "desiredURI" and turn it off (set to brightness 0)

Request req=new Request(new Lighting(null));

req.put(Path.at(Lighting.PROP_CONTROLS).to(LightSource.PROP_HAS_TYPE), Arg.type(ElectricLight.MY_URI));

req.put(Path.at(Lighting.PROP_CONTROLS), Arg.in(new LightSource(desiredURI)));

req.put(Path.at(Lighting.PROP_CONTROLS).to(LightSource.PROP_SOURCE_BRIGHTNESS), Arg.change(new Integer(0)));

caller.call(req);

Author:
alfiva

Method Summary
static Add add(Object byValue)
          Equivalent to new Add(byValue);.
static Add add(String byTypeURI)
          Equivalent to new Add(byTypeURI);.
static Change change(Object byValue)
          Equivalent to new Change(inputNewValue);.
static Change change(String byTypeURI)
          Equivalent to new Change(byTypeURI);.
static Variable in(Object byValue)
          Equivalent to new Variable(byValue);.
static Variable in(String byTypeURI)
          Equivalent to new Variable(byTypeURI);.
static Output out(Object byValue)
          Equivalent to new Output(byValue);.
static Output out(String byTypeURIorPLACEHOLDER)
          Equivalent to new Output(byTypeURIorPLACEHOLDER);.
static Remove remove(Object byValue)
          Equivalent to new Remove(byValue);.
static Remove remove(String byTypeURI)
          Equivalent to new Remove(byTypeURI);.
static Typematch type(Object byValue)
          Equivalent to new Typematch(byValue);.
static Typematch type(String byTypeURI)
          Equivalent to new Typematch(byTypeURI);.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public static Add add(Object byValue)
Equivalent to new Add(byValue);.

Parameters:
byValue - Value to represent.
Returns:
The argument.

add

public static Add add(String byTypeURI)
Equivalent to new Add(byTypeURI);.

Parameters:
byTypeURI - Type to represent.
Returns:
The argument.

change

public static Change change(Object byValue)
Equivalent to new Change(inputNewValue);.

Parameters:
byValue - Value to represent.
Returns:
The argument.

change

public static Change change(String byTypeURI)
Equivalent to new Change(byTypeURI);.

Parameters:
byTypeURI - Type to represent.
Returns:
The argument.

out

public static Output out(String byTypeURIorPLACEHOLDER)
Equivalent to new Output(byTypeURIorPLACEHOLDER);.

Parameters:
byTypeURIorPLACEHOLDER - Type to represent, or placeholder URI.
Returns:
The argument.

out

public static Output out(Object byValue)
Equivalent to new Output(byValue);.

Parameters:
byValue - Value to represent.
Returns:
The argument.

remove

public static Remove remove(Object byValue)
Equivalent to new Remove(byValue);.

Parameters:
byValue - Value to represent.
Returns:
The argument.

remove

public static Remove remove(String byTypeURI)
Equivalent to new Remove(byTypeURI);.

Parameters:
byTypeURI - Type to represent.
Returns:
The argument.

type

public static Typematch type(String byTypeURI)
Equivalent to new Typematch(byTypeURI);.

Parameters:
byTypeURI - Type to represent.
Returns:
The argument.

type

public static Typematch type(Object byValue)
Equivalent to new Typematch(byValue);.

Parameters:
byValue - Value to represent.
Returns:
The argument.

in

public static Variable in(Object byValue)
Equivalent to new Variable(byValue);.

Parameters:
byValue - Value to represent.
Returns:
The argument.

in

public static Variable in(String byTypeURI)
Equivalent to new Variable(byTypeURI);.

Parameters:
byTypeURI - Type to represent.
Returns:
The argument.


Copyright © 2014 universAAL Consortium. All Rights Reserved.