public abstract class TemplatedViolatedConstraintNameExtracter extends Object implements ViolatedConstraintNameExtracter
Knows how to extract a violated constraint name from an error message based on the fact that the constraint name is templated within the message.
| Constructor and Description |
|---|
TemplatedViolatedConstraintNameExtracter() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract String |
doExtractConstraintName(SQLException sqle) |
String |
extractConstraintName(SQLException sqle)
Extract the name of the violated constraint from the given SQLException.
|
protected String |
extractUsingTemplate(String templateStart,
String templateEnd,
String message)
Extracts the constraint name based on a template (i.e., <i>templateStart</i><b>constraintName</b><i>templateEnd</i>).
|
public TemplatedViolatedConstraintNameExtracter()
public String extractConstraintName(SQLException sqle)
ViolatedConstraintNameExtracterExtract the name of the violated constraint from the given SQLException.
extractConstraintName in interface ViolatedConstraintNameExtractersqle - The exception that was the result of the constraint violation.protected abstract String doExtractConstraintName(SQLException sqle) throws NumberFormatException
NumberFormatExceptionprotected String extractUsingTemplate(String templateStart, String templateEnd, String message)
Extracts the constraint name based on a template (i.e., <i>templateStart</i><b>constraintName</b><i>templateEnd</i>).
templateStart - The pattern denoting the start of the constraint name within the message.templateEnd - The pattern denoting the end of the constraint name within the message.message - The templated error message containing the constraint name.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.