public interface DronePointContext<DRONE>
DronePoint. It stores configuration, future instance and metadata.| Modifier and Type | Interface and Description |
|---|---|
static interface |
DronePointContext.MetadataKey<VALUE>
Utility interface used for unique identification of metadata in
DronePointContext. |
| Modifier and Type | Method and Description |
|---|---|
<CONF extends DroneConfiguration<CONF>> |
getConfigurationAs(Class<CONF> configurationClass)
Returns an instance of
DroneConfiguration cast to desired type. |
DronePoint<DRONE> |
getDronePoint()
Returns an instance of
DronePoint, which is this context bound to. |
DRONE |
getInstance()
Returns an instance of drone.
|
<CAST_DRONE> |
getInstanceAs(Class<CAST_DRONE> droneClass)
Returns an instance of drone, cast to desired type.
|
<KEY extends DronePointContext.MetadataKey<VALUE>,VALUE> |
getMetadata(Class<KEY> keyClass)
Returns saved metadata for the given key.
|
boolean |
hasConfiguration()
Returns true if configuration is set.
|
boolean |
hasFutureInstance()
Returns true if future instance (
CachingCallable) is set. |
<KEY extends DronePointContext.MetadataKey<VALUE>,VALUE> |
hasMetadata(Class<KEY> keyClass)
Returns true if there are metadata set for the given key.
|
boolean |
isInstantiated()
Returns true if
CachingCallable.isValueCached() is true. |
void |
removeConfiguration()
Removes configuration.
|
void |
removeFutureInstance()
Removes future or instantiated drone instance, depending on the state.
|
<KEY extends DronePointContext.MetadataKey<VALUE>,VALUE> |
removeMetadata(Class<KEY> keyClass)
Removes metadata set for the given key.
|
<CONF extends DroneConfiguration<CONF>> |
setConfiguration(CONF configuration)
Sets the
DroneConfiguration. |
void |
setFutureInstance(CachingCallable<DRONE> futureInstance)
Sets
CachingCallable for future drone instantiation. |
<KEY extends DronePointContext.MetadataKey<VALUE>,VALUE> |
setMetadata(Class<KEY> keyClass,
VALUE metadata)
Sets given metadata under specified key.
|
DronePoint<DRONE> getDronePoint()
DronePoint, which is this context bound to.DRONE getInstance() throws IllegalStateException
BeforeDroneInstantiated
event, then instantiate the drone and fire AfterDroneInstantiated event.IllegalStateException - if there is no future instance set.<CAST_DRONE> CAST_DRONE getInstanceAs(Class<CAST_DRONE> droneClass) throws IllegalArgumentException, IllegalStateException
BeforeDroneInstantiated event, then instantiate the drone and fire AfterDroneInstantiated event.droneClass - Class to cast drone instance to.IllegalArgumentException - If the given class is null.IllegalStateException - If there is no future instance set or if the instance cannot be cast
to desired type. Use DronePoint.conformsTo(Class) to make sure
the drone can be cast to it.<CONF extends DroneConfiguration<CONF>> CONF getConfigurationAs(Class<CONF> configurationClass) throws IllegalArgumentException, IllegalStateException
DroneConfiguration cast to desired type.IllegalStateException - If there is no configuration set or the configuration cannot be cast
to the desired type.IllegalArgumentException - If the given configuration class is null.<KEY extends DronePointContext.MetadataKey<VALUE>,VALUE> VALUE getMetadata(Class<KEY> keyClass) throws IllegalArgumentException
IllegalArgumentException - If the given key class is null.boolean isInstantiated()
CachingCallable.isValueCached() is true.boolean hasFutureInstance()
CachingCallable) is set.boolean hasConfiguration()
<KEY extends DronePointContext.MetadataKey<VALUE>,VALUE> boolean hasMetadata(Class<KEY> keyClass) throws IllegalArgumentException
IllegalArgumentException - If the given key class is null.void setFutureInstance(CachingCallable<DRONE> futureInstance)
CachingCallable for future drone instantiation. Remember that the best practise is to instantiate
drones lazily, at the very last moment.<CONF extends DroneConfiguration<CONF>> void setConfiguration(CONF configuration)
DroneConfiguration.<KEY extends DronePointContext.MetadataKey<VALUE>,VALUE> void setMetadata(Class<KEY> keyClass, VALUE metadata) throws IllegalArgumentException
IllegalArgumentException - If the given key class is null.void removeFutureInstance()
void removeConfiguration()
<KEY extends DronePointContext.MetadataKey<VALUE>,VALUE> void removeMetadata(Class<KEY> keyClass)
IllegalArgumentException - If the given key class is null.Copyright © 2016 JBoss by Red Hat. All rights reserved.