Top Description Inners Fields Constructors Methods
org.apache.commons.text.lookup

pack-priv final Class PathFence

extends Object
Class Inheritance
Imports
java.nio.file.Path, .Paths, java.util.Arrays, .List, .Optional, java.util.function.Supplier, java.util.stream.Collectors

A Path fence guards against using paths outside of a "fence" of made of root paths. Keep package-private.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
PathFence.Builder

Builds PathFence instances.

Field Summary

Modifier and TypeField and Description
private final List<Path>
roots

A fence is made of Paths guarding Path resolution.

Constructor Summary

AccessConstructor and Description
private
PathFence(final PathFence.Builder
A builder.
builder
)

Constructs a new instance.

Method Summary

Modifier and TypeMethod and Description
pack-priv Path

Returns:

a fenced Path.
apply
(final String
the file name to resolve.
fileName
)

Gets a Path for the given file name checking that it resolves within our fence.

pack-priv static PathFence.Builder

Returns:

a new builder.
builder
()

Creates a new builder.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rootsback to summary
private final List<Path> roots

A fence is made of Paths guarding Path resolution.

Constructor Detail

PathFenceback to summary
private PathFence(final PathFence.Builder builder)

Constructs a new instance.

Parameters
builder:PathFence.Builder

A builder.

Method Detail

applyback to summary
pack-priv Path apply(final String fileName)

Gets a Path for the given file name checking that it resolves within our fence.

Parameters
fileName:String

the file name to resolve.

Returns:Path

a fenced Path.

Exceptions
IllegalArgumentException:
if the file name is not without our fence.
builderback to summary
pack-priv static PathFence.Builder builder()

Creates a new builder.

Returns:PathFence.Builder

a new builder.

org.apache.commons.text.lookup back to summary

pack-priv final Class PathFence.Builder

extends Object
implements Supplier<PathFence>
Class Inheritance
All Implemented Interfaces
java.util.function.Supplier

Builds PathFence instances.

Field Summary

Modifier and TypeField and Description
private static final Path[]
EMPTY

The empty Path array.

private Path[]
roots

A fence is made of root Paths.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public PathFence
get()

Implements java.util.function.Supplier.get.

Gets a result.

pack-priv PathFence.Builder

Returns:

this instance.
setRoots
(final Path...
the paths that delineate this fence.
paths
)

Sets the paths that delineate this fence.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTYback to summary
private static final Path[] EMPTY

The empty Path array.

rootsback to summary
private Path[] roots

A fence is made of root Paths.

Constructor Detail

Builderback to summary
pack-priv Builder()

Method Detail

getback to summary
public PathFence get()

Implements java.util.function.Supplier.get.

Doc from java.util.function.Supplier.get.

Gets a result.

Annotations
@Override
setRootsback to summary
pack-priv PathFence.Builder setRoots(final Path... paths)

Sets the paths that delineate this fence.

Parameters
paths:Path[]

the paths that delineate this fence.

Returns:PathFence.Builder

this instance.