Package net.solarnetwork.service
Class StaticOptionalService<T>
java.lang.Object
net.solarnetwork.service.StaticOptionalService<T>
- Type Parameters:
T- the service type
- All Implemented Interfaces:
FilterableService,OptionalService<T>,OptionalService.OptionalFilterableService<T>
public class StaticOptionalService<T>
extends Object
implements OptionalService.OptionalFilterableService<T>
Implementation of
OptionalService.OptionalFilterableService using a
static service instance.
This can be useful when the OptionalService.OptionalFilterableService
API is required, but the service is known and available statically.
- Version:
- 1.2
- Author:
- matt
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.solarnetwork.service.OptionalService
OptionalService.OptionalFilterableService<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the current map of property filters, with keys representing property names and value their desired associated value.Remove a property filter value.service()Get the configured service, or null if none available.voidsetPropertyFilter(String key, Object value) Set a property filter value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.service.FilterableService
getPropertyValue
-
Constructor Details
-
StaticOptionalService
Constructor.- Parameters:
service- the static service to use
-
-
Method Details
-
service
Description copied from interface:OptionalServiceGet the configured service, or null if none available.- Specified by:
servicein interfaceOptionalService<T>- Returns:
- the service, or null
-
getPropertyFilters
Description copied from interface:FilterableServiceGet the current map of property filters, with keys representing property names and value their desired associated value.- Specified by:
getPropertyFiltersin interfaceFilterableService- Returns:
- filters
-
setPropertyFilter
Description copied from interface:FilterableServiceSet a property filter value.- Specified by:
setPropertyFilterin interfaceFilterableService- Parameters:
key- the key to addvalue- the value
-
removePropertyFilter
Description copied from interface:FilterableServiceRemove a property filter value.- Specified by:
removePropertyFilterin interfaceFilterableService- Parameters:
key- the key to remove- Returns:
- the removed value, or null if no value was available
-