Package org.apache.nifi.remote
Class StandardVersionNegotiator
java.lang.Object
org.apache.nifi.remote.StandardVersionNegotiator
- All Implemented Interfaces:
VersionNegotiator
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getPreferredVersion
(int maxVersion) Gets the preferred version of this resource that is no greater than the given maxVersion.int
boolean
isVersionSupported
(int version) Indicates whether or not the specified version is supported by this resourcevoid
setVersion
(int version) Sets the version of this resource to the specified version.
-
Field Details
-
versions
-
curVersion
private int curVersion
-
-
Constructor Details
-
StandardVersionNegotiator
public StandardVersionNegotiator(int... supportedVersions)
-
-
Method Details
-
getVersion
public int getVersion()- Specified by:
getVersion
in interfaceVersionNegotiator
- Returns:
- the currently configured Version of this resource
-
setVersion
Description copied from interface:VersionNegotiator
Sets the version of this resource to the specified version. Only the lower byte of the version is relevant.- Specified by:
setVersion
in interfaceVersionNegotiator
- Parameters:
version
- the version to set- Throws:
IllegalArgumentException
- if the given Version is not supported by this resource, as is indicated by theVersionNegotiator.isVersionSupported(int)
method
-
getPreferredVersion
public int getPreferredVersion()- Specified by:
getPreferredVersion
in interfaceVersionNegotiator
- Returns:
- the Version of this resource that is preferred
-
getPreferredVersion
Description copied from interface:VersionNegotiator
Gets the preferred version of this resource that is no greater than the given maxVersion. If no acceptable version exists that is less thanmaxVersion
, thennull
is returned- Specified by:
getPreferredVersion
in interfaceVersionNegotiator
- Parameters:
maxVersion
- the maximum version desired- Returns:
- the preferred version if found; null otherwise
-
isVersionSupported
public boolean isVersionSupported(int version) Description copied from interface:VersionNegotiator
Indicates whether or not the specified version is supported by this resource- Specified by:
isVersionSupported
in interfaceVersionNegotiator
- Parameters:
version
- the version to test- Returns:
- true if supported; false otherwise
-
getSupportedVersions
- Specified by:
getSupportedVersions
in interfaceVersionNegotiator
-