DESY ACOP Beans Home

com.cosylab.gui.displayers
Class MinimalDataConsumer

java.lang.Object
  extended by com.cosylab.gui.displayers.MinimalDataConsumer
All Implemented Interfaces:
DataConsumer

public class MinimalDataConsumer
extends java.lang.Object
implements DataConsumer

MinimalDataConsumer is minimal implementation of DataConsumer as convenience for cunsumer implementators.

Since:
Feb 14, 2004.
Version:
$Id: MinimalDataConsumer.java,v 1.4 2008-04-22 12:31:02 jbobnar Exp $
Author:
Igor Kriznar

Field Summary
protected  DataState dataState
           
static java.lang.Class[] EMPTY_CLASS_ARRAY
          Zero length array.
static java.lang.String[] EMPTY_STRING_ARRAY
          Zero length array.
protected  java.lang.String name
           
 
Constructor Summary
MinimalDataConsumer()
          Creates new instance.
 
Method Summary
<D extends DataConsumer>
D
getDataConsumer(java.lang.Class<D> type)
           Returns data consumer for requested data consumer type.
 DataConsumer getDefaultDataConsumer()
          Returns the implementation of default consumer type supported by this data consumer.
 java.lang.String getName()
          Returns name of this data consumer.
 java.lang.String[] getSupportedCharacteristics()
          Resturns array with names of supported characteristics.
 java.lang.Class[] getSupportedConsumerTypes()
          Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class) method.
 void setCharacteristics(java.util.Map characteristics)
          Sets new dynamic value characteristics to this data consumer.
 void updateDataState(DataState state)
          Push data state (quality) update change for dynamic value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING_ARRAY

public static final java.lang.String[] EMPTY_STRING_ARRAY
Zero length array.


EMPTY_CLASS_ARRAY

public static final java.lang.Class[] EMPTY_CLASS_ARRAY
Zero length array.


dataState

protected DataState dataState

name

protected java.lang.String name
Constructor Detail

MinimalDataConsumer

public MinimalDataConsumer()
Creates new instance.

Method Detail

getDefaultDataConsumer

public DataConsumer getDefaultDataConsumer()
Description copied from interface: DataConsumer
Returns the implementation of default consumer type supported by this data consumer.

Specified by:
getDefaultDataConsumer in interface DataConsumer
Returns:
the implementation of default consumer type supported by this data consumer

updateDataState

public void updateDataState(DataState state)
Description copied from interface: DataConsumer
Push data state (quality) update change for dynamic value. Usually called by data source.

Specified by:
updateDataState in interface DataConsumer
Parameters:
state - new data state(quality) descriptor

setCharacteristics

public void setCharacteristics(java.util.Map characteristics)
Description copied from interface: DataConsumer
Sets new dynamic value characteristics to this data consumer. This is usually called only at initializaation, before first data state or value is updated. Usually carries characteristics such as value minimum or maximum. Name and meaning of atributes is defined with contract betwean data consumer and source implementation.

Specified by:
setCharacteristics in interface DataConsumer
Parameters:
characteristics - the Map with attri

getName

public java.lang.String getName()
Description copied from interface: DataConsumer
Returns name of this data consumer.

Specified by:
getName in interface DataConsumer
Returns:
the name of this data consumer

getSupportedCharacteristics

public java.lang.String[] getSupportedCharacteristics()
Description copied from interface: DataConsumer
Resturns array with names of supported characteristics. Data source can use this method to optimize setting characteristics to this data consumer. If arrray of length 0 is return, then consumer does not need or support any characteristic. If null is returned, than consumer expect all existing characteristics from data source.

Specified by:
getSupportedCharacteristics in interface DataConsumer
Returns:
array with names of supported characteristics

getSupportedConsumerTypes

public java.lang.Class[] getSupportedConsumerTypes()
Description copied from interface: DataConsumer
Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class) method.

Specified by:
getSupportedConsumerTypes in interface DataConsumer
Returns:
array of supported data consumer types

getDataConsumer

public <D extends DataConsumer> D getDataConsumer(java.lang.Class<D> type)
Description copied from interface: DataConsumer

Returns data consumer for requested data consumer type. If this data consumer does not support required data consumer, null is returned.

If this data cosnumer does not support specific data consumer type, then it means, that it is not desirable to cast data of that type to any by this consumer supported data consumer types.

Specified by:
getDataConsumer in interface DataConsumer
Parameters:
type - Class of specific data consumer (e.g. DoubleConsumer)
Returns:
implementation of required data consumer or null if not supported


Copyright © 2010. All Rights Reserved.