Hystrix: Latency and Fault Tolerance for Distributed Systems



com.netflix.hystrix.strategy.properties
Class HystrixProperty.Factory

java.lang.Object
  extended by com.netflix.hystrix.strategy.properties.HystrixProperty.Factory
Enclosing interface:
HystrixProperty<T>

public static class HystrixProperty.Factory
extends java.lang.Object

Helper methods for wrapping static values and dynamic Archaius (https://github.com/Netflix/archaius) properties in the HystrixProperty interface.


Constructor Summary
HystrixProperty.Factory()
           
 
Method Summary
static
<T> HystrixProperty<T>
asProperty(HystrixProperty<T>... values)
          When retrieved this will iterate over the contained HystrixProperty instances until a non-null value is found and return that.
static
<T> HystrixProperty<T>
asProperty(HystrixProperty<T> value, T defaultValue)
          When retrieved this will return the value from the given HystrixProperty or if that returns null then return the defaultValue.
static
<T> HystrixProperty<T>
asProperty(T value)
           
static
<T> HystrixProperty<T>
nullProperty()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HystrixProperty.Factory

public HystrixProperty.Factory()
Method Detail

asProperty

public static <T> HystrixProperty<T> asProperty(T value)

asProperty

public static <T> HystrixProperty<T> asProperty(HystrixProperty<T> value,
                                                T defaultValue)
When retrieved this will return the value from the given HystrixProperty or if that returns null then return the defaultValue.

Parameters:
value - HystrixProperty of property value that can return null (meaning no value)
defaultValue - value to be returned if value returns null
Returns:
value or defaultValue if value returns null

asProperty

public static <T> HystrixProperty<T> asProperty(HystrixProperty<T>... values)
When retrieved this will iterate over the contained HystrixProperty instances until a non-null value is found and return that.

Parameters:
values -
Returns:
first non-null value or null if none found

nullProperty

public static <T> HystrixProperty<T> nullProperty()