ro.isdc.wro.model.resource.support.hash
Class ConfigurableHashStrategy
java.lang.Object
ro.isdc.wro.model.resource.support.AbstractConfigurableStrategySupport<S,P>
ro.isdc.wro.model.resource.support.AbstractConfigurableSingleStrategy<HashStrategy,HashStrategyProvider>
ro.isdc.wro.model.resource.support.hash.ConfigurableHashStrategy
- All Implemented Interfaces:
- HashBuilder, HashStrategy
public class ConfigurableHashStrategy
- extends AbstractConfigurableSingleStrategy<HashStrategy,HashStrategyProvider>
- implements HashStrategy
Uses the HashStrategy
implementation associated with an alias read from properties file.
- Since:
- 1.4.7
- Author:
- Alex Objelean
Field Summary |
static String |
KEY
Property name to specify alias. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KEY
public static final String KEY
- Property name to specify alias.
- See Also:
- Constant Field Values
ConfigurableHashStrategy
public ConfigurableHashStrategy()
getHash
public String getHash(InputStream inputStream)
throws IOException
-
- Specified by:
getHash
in interface HashBuilder
- Parameters:
inputStream
- to digest.
- Returns:
- the hash of the content.
- Throws:
IOException
- if there was an error during reading the stream content.
getStrategyKey
protected String getStrategyKey()
-
- Specified by:
getStrategyKey
in class AbstractConfigurableStrategySupport<HashStrategy,HashStrategyProvider>
- Returns:
- the key of the strategy property.
getDefaultStrategy
protected HashStrategy getDefaultStrategy()
-
- Specified by:
getDefaultStrategy
in class AbstractConfigurableSingleStrategy<HashStrategy,HashStrategyProvider>
- Returns:
- the default strategy implementation to use when no key is configured is provided.
getStrategies
protected Map<String,HashStrategy> getStrategies(HashStrategyProvider provider)
-
- Specified by:
getStrategies
in class AbstractConfigurableStrategySupport<HashStrategy,HashStrategyProvider>
- Parameters:
provider
- the instance responsible for strategy lookup.
- Returns:
- the map of provided strategies.
getProviderClass
protected Class<HashStrategyProvider> getProviderClass()
-
- Overrides:
getProviderClass
in class AbstractConfigurableStrategySupport<HashStrategy,HashStrategyProvider>
- Returns:
- the class of the provider of type P. Uses
ParameterizedType
to compute the class. Override it to
support anonymous classes which do not play well with ParameterizedType
's.
Copyright © 2008-2013. All Rights Reserved.