类 TemplatedViolatedConstraintNameExtracter
- java.lang.Object
-
- org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter
-
- 所有已实现的接口:
ViolatedConstraintNameExtracter
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.- 作者:
- Steve Ebersole, Brett Meyer
-
-
构造器概要
构造器 构造器 说明 TemplatedViolatedConstraintNameExtracter()
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected abstract StringdoExtractConstraintName(SQLException sqle)StringextractConstraintName(SQLException sqle)Extract the name of the violated constraint from the given SQLException.protected StringextractUsingTemplate(String templateStart, String templateEnd, String message)Extracts the constraint name based on a template (i.e., templateStartconstraintNametemplateEnd).
-
-
-
方法详细资料
-
extractConstraintName
public String extractConstraintName(SQLException sqle)
从接口复制的说明:ViolatedConstraintNameExtracterExtract the name of the violated constraint from the given SQLException.- 指定者:
extractConstraintName在接口中ViolatedConstraintNameExtracter- 参数:
sqle- The exception that was the result of the constraint violation.- 返回:
- The extracted constraint name.
-
doExtractConstraintName
protected abstract String doExtractConstraintName(SQLException sqle) throws NumberFormatException
-
extractUsingTemplate
protected String extractUsingTemplate(String templateStart, String templateEnd, String message)
Extracts the constraint name based on a template (i.e., templateStartconstraintNametemplateEnd).- 参数:
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.- 返回:
- The found constraint name, or null.
-
-