Class TestError.Builder
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.TestError.Builder
-
- Enclosing class:
- TestError
public static final class TestError.Builder extends Object
A builder for aTestError
.- Since:
- 11129
-
-
Field Summary
Fields Modifier and Type Field Description private int
code
private String
description
private String
descriptionEn
private Supplier<Command>
fixingCommand
private Collection<?>
highlighted
private String
message
private Collection<? extends OsmPrimitive>
primitives
private Severity
severity
private Test
tester
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestError
build()
Returns a new test error with the specified valuesTestError.Builder
fix(Supplier<Command> fixingCommand)
Sets a supplier to obtain a command to fix the error.TestError.Builder
highlight(Area highlighted)
Sets an area to highlight when selecting this error.TestError.Builder
highlight(Collection<? extends OsmPrimitive> highlighted)
Sets the primitives to highlight when selecting this error.TestError.Builder
highlight(OsmPrimitive... highlighted)
Sets the primitives to highlight when selecting this error.TestError.Builder
highlightNodePairs(Collection<List<Node>> highlighted)
Sets the node pairs to highlight when selecting this error.TestError.Builder
highlightWaySegments(Collection<WaySegment> highlighted)
Sets the way segments to highlight when selecting this error.TestError.Builder
message(String message)
Sets the error message.TestError.Builder
message(String message, String marktrDescription, Object... args)
Sets the error message.TestError.Builder
messageWithManuallyTranslatedDescription(String message, String description, String descriptionEn)
Sets the error message.TestError.Builder
primitives(Collection<? extends OsmPrimitive> primitives)
Sets the primitives affected by this error.TestError.Builder
primitives(OsmPrimitive... primitives)
Sets the primitives affected by this error.
-
-
-
Field Detail
-
code
private final int code
-
description
private String description
-
descriptionEn
private String descriptionEn
-
primitives
private Collection<? extends OsmPrimitive> primitives
-
highlighted
private Collection<?> highlighted
-
fixingCommand
private Supplier<Command> fixingCommand
-
-
Method Detail
-
message
public TestError.Builder message(String message)
Sets the error message.- Parameters:
message
- The error message- Returns:
this
-
messageWithManuallyTranslatedDescription
public TestError.Builder messageWithManuallyTranslatedDescription(String message, String description, String descriptionEn)
Sets the error message.- Parameters:
message
- The message of this error groupdescription
- The translated description of this errordescriptionEn
- The English description (for ignoring errors)- Returns:
this
-
message
public TestError.Builder message(String message, String marktrDescription, Object... args)
Sets the error message.- Parameters:
message
- The message of this error groupmarktrDescription
- The prepared for i18n description of this errorargs
- The description arguments to be applied inI18n.tr(String, Object...)
- Returns:
this
-
primitives
public TestError.Builder primitives(OsmPrimitive... primitives)
Sets the primitives affected by this error.- Parameters:
primitives
- the primitives affected by this error- Returns:
this
-
primitives
public TestError.Builder primitives(Collection<? extends OsmPrimitive> primitives)
Sets the primitives affected by this error.- Parameters:
primitives
- the primitives affected by this error- Returns:
this
-
highlight
public TestError.Builder highlight(OsmPrimitive... highlighted)
Sets the primitives to highlight when selecting this error.- Parameters:
highlighted
- the primitives to highlight- Returns:
this
- See Also:
ValidatorVisitor.visit(OsmPrimitive)
-
highlight
public TestError.Builder highlight(Collection<? extends OsmPrimitive> highlighted)
Sets the primitives to highlight when selecting this error.- Parameters:
highlighted
- the primitives to highlight- Returns:
this
- See Also:
ValidatorVisitor.visit(OsmPrimitive)
-
highlightWaySegments
public TestError.Builder highlightWaySegments(Collection<WaySegment> highlighted)
Sets the way segments to highlight when selecting this error.- Parameters:
highlighted
- the way segments to highlight- Returns:
this
- See Also:
ValidatorVisitor.visit(WaySegment)
-
highlightNodePairs
public TestError.Builder highlightNodePairs(Collection<List<Node>> highlighted)
Sets the node pairs to highlight when selecting this error.- Parameters:
highlighted
- the node pairs to highlight- Returns:
this
- See Also:
ValidatorVisitor.visit(List)
-
highlight
public TestError.Builder highlight(Area highlighted)
Sets an area to highlight when selecting this error.- Parameters:
highlighted
- the area to highlight- Returns:
this
-
fix
public TestError.Builder fix(Supplier<Command> fixingCommand)
Sets a supplier to obtain a command to fix the error.- Parameters:
fixingCommand
- the fix supplier. Can be null- Returns:
this
-
build
public TestError build()
Returns a new test error with the specified values- Returns:
- a new test error with the specified values
- Throws:
IllegalArgumentException
- whenmessage
orprimitives
is null.
-
-