brooklyn.event
Interface Sensor<T>

All Superinterfaces:
Serializable
All Known Subinterfaces:
AttributeSensor<T>

public interface Sensor<T>
extends Serializable

The interface implemented by concrete sensors. A sensor is a container for a piece of data of a particular type, and exists in a hierarchical namespace. The name of the sensor is described as a set of tokens separated by dots.

See Also:
SensorEvent

Method Summary
 String getDescription()
          Returns the description of the sensor, for display.
 String getName()
          Returns the name of the sensor, in a dot-separated namespace.
 List<String> getNameParts()
          Returns the constituent parts of the sensor name as a List.
 Class<? super T> getType()
          Returns the Java Class for the sensor data.
 String getTypeName()
          Returns the type of the sensor data, as a String representation of the class name.
 com.google.common.reflect.TypeToken<T> getTypeToken()
          Returns the Guava TypeToken (including generics info)
 SensorEvent<T> newEvent(Entity entity, T value)
          Create a new SensorEvent object for a specific Entity and data point.
 

Method Detail

getType

Class<? super T> getType()
Returns the Java Class for the sensor data.

This returns a "super" of T only in the case where T is generified, and in such cases it returns the Class instance for the unadorned T --- i.e. for List this returns Class --- this is of course because there is no actual Class> instance.


getTypeToken

com.google.common.reflect.TypeToken<T> getTypeToken()
Returns the Guava TypeToken (including generics info)


getTypeName

String getTypeName()
Returns the type of the sensor data, as a String representation of the class name. (Useful for contexts where Type is not accessible.)


getName

String getName()
Returns the name of the sensor, in a dot-separated namespace.


getNameParts

List<String> getNameParts()
Returns the constituent parts of the sensor name as a List.


getDescription

String getDescription()
Returns the description of the sensor, for display.


newEvent

SensorEvent<T> newEvent(Entity entity,
                        T value)
Create a new SensorEvent object for a specific Entity and data point.



Copyright © 2013. All Rights Reserved.