Package org.eolang.maven.objectionary
Class OyFallbackSwap
- java.lang.Object
-
- org.eolang.maven.objectionary.OyFallbackSwap
-
- All Implemented Interfaces:
Objectionary
public final class OyFallbackSwap extends Object implements Objectionary
Fallback which can swap primary/secondary repos. The key purpose of this class is to allow dynamic determination of which Oy (fist or second) to use as primary and which as fallback based on given boolean property. ForPullMojo
this is used to bypass reading from cache by always checking remote first and only fallback to local in case of object miss:new PullMojo.FallbackSwapOy( < local >, < remote >, this.forceUpdate() );
- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description OyFallbackSwap(Objectionary first, Objectionary second, boolean swap)
Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(String name)
Checks whether an Objectionary contains a provided object.org.cactoos.Input
get(String name)
Resolve object.String
toString()
-
-
-
Constructor Detail
-
OyFallbackSwap
public OyFallbackSwap(Objectionary first, Objectionary second, boolean swap)
Ctor.- Parameters:
first
- Initial primarysecond
- Initial secondaryswap
- Whether to swap
-
-
Method Detail
-
get
public org.cactoos.Input get(String name) throws IOException
Description copied from interface:Objectionary
Resolve object.- Specified by:
get
in interfaceObjectionary
- Parameters:
name
- Object name.- Returns:
- Object code.
- Throws:
IOException
- If fails to fetch.
-
contains
public boolean contains(String name) throws IOException
Description copied from interface:Objectionary
Checks whether an Objectionary contains a provided object.- Specified by:
contains
in interfaceObjectionary
- Parameters:
name
- Object name.- Returns:
- Boolean: "true" if found, "false" if not.
- Throws:
IOException
- If fails to fetch.
-
-