Class TestError.Builder
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.TestError.Builder
-
- Enclosing class:
- TestError
public static final class TestError.Builder extends java.lang.Object
A builder for aTestError
.- Since:
- 11129
-
-
Field Summary
Fields Modifier and Type Field Description private int
code
private java.lang.String
description
private java.lang.String
descriptionEn
private java.util.function.Supplier<Command>
fixingCommand
private java.util.Collection<?>
highlighted
private boolean
incompletePrimitives
private java.lang.String
message
private java.util.Collection<? extends OsmPrimitive>
primitives
private Severity
severity
private Test
tester
private int
uniqueCode
-
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(java.util.function.Supplier<Command> fixingCommand)
Sets a supplier to obtain a command to fix the error.TestError.Builder
highlight(java.awt.geom.Area highlighted)
Sets an area to highlight when selecting this error.TestError.Builder
highlight(java.util.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(java.util.Collection<java.util.List<Node>> highlighted)
Sets the node pairs to highlight when selecting this error.TestError.Builder
highlightWaySegments(java.util.Collection<WaySegment> highlighted)
Sets the way segments to highlight when selecting this error.TestError.Builder
imcompletePrimitives()
Sets a flag that the list of primitives may be incomplete.TestError.Builder
message(java.lang.String message)
Sets the error message.TestError.Builder
message(java.lang.String message, java.lang.String marktrDescription, java.lang.Object... args)
Sets the error message.TestError.Builder
messageWithManuallyTranslatedDescription(java.lang.String message, java.lang.String description, java.lang.String descriptionEn)
Sets the error message.TestError.Builder
primitives(java.util.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
-
uniqueCode
private final int uniqueCode
-
message
private java.lang.String message
-
description
private java.lang.String description
-
descriptionEn
private java.lang.String descriptionEn
-
primitives
private java.util.Collection<? extends OsmPrimitive> primitives
-
highlighted
private java.util.Collection<?> highlighted
-
fixingCommand
private java.util.function.Supplier<Command> fixingCommand
-
incompletePrimitives
private boolean incompletePrimitives
-
-
Method Detail
-
message
public TestError.Builder message(java.lang.String message)
Sets the error message.- Parameters:
message
- The error message- Returns:
this
-
messageWithManuallyTranslatedDescription
public TestError.Builder messageWithManuallyTranslatedDescription(java.lang.String message, java.lang.String description, java.lang.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(java.lang.String message, java.lang.String marktrDescription, java.lang.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(java.util.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(java.util.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(java.util.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(java.util.Collection<java.util.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(java.awt.geom.Area highlighted)
Sets an area to highlight when selecting this error.- Parameters:
highlighted
- the area to highlight- Returns:
this
-
imcompletePrimitives
public TestError.Builder imcompletePrimitives()
Sets a flag that the list of primitives may be incomplete. See #23397- Returns:
this
-
fix
public TestError.Builder fix(java.util.function.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:
java.lang.IllegalArgumentException
- whenmessage
orprimitives
is null.
-
-