Package mil.nga.geopackage.db.table
Class ConstraintParser
- java.lang.Object
-
- mil.nga.geopackage.db.table.ConstraintParser
-
public class ConstraintParser extends Object
SQL constraint parser from create table statements- Since:
- 3.3.0
- Author:
- osbornb
-
-
Constructor Summary
Constructors Constructor Description ConstraintParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Constraint
getColumnConstraint(String constraintSql)
Attempt to get a column constraint by parsing the SQL statementstatic ColumnConstraints
getColumnConstraints(String constraintSql)
Attempt to get column constraints by parsing the SQL statementstatic ConstraintType
getColumnType(String constraintSql)
Get the column constraint type of the constraint SQLstatic Constraint
getConstraint(String constraintSql)
Attempt to get a constraint by parsing the SQL statementstatic TableConstraints
getConstraints(String tableSql)
Get the constraints for the table SQLstatic String
getName(String constraintSql)
Get the constraint name if it has onestatic String[]
getNameAndDefinition(String constraintSql)
Get the constraint name and remaining definitionstatic Constraint
getTableConstraint(String constraintSql)
Attempt to get a table constraint by parsing the SQL statementstatic ConstraintType
getTableType(String constraintSql)
Get the table constraint type of the constraint SQLstatic ConstraintType
getType(String constraintSql)
Get the constraint type of the constraint SQLstatic boolean
isColumnConstraint(String constraintSql)
Check if the SQL is a column type constraintstatic boolean
isColumnType(ConstraintType type, String constraintSql)
Determine if the column constraint SQL is the constraint typestatic boolean
isConstraint(String constraintSql)
Check if the SQL is a constraintstatic boolean
isTableConstraint(String constraintSql)
Check if the SQL is a table type constraintstatic boolean
isTableType(ConstraintType type, String constraintSql)
Determine if the table constraint SQL is the constraint typestatic boolean
isType(ConstraintType type, String constraintSql)
Determine if the constraint SQL is the constraint type
-
-
-
Method Detail
-
getConstraints
public static TableConstraints getConstraints(String tableSql)
Get the constraints for the table SQL- Parameters:
tableSql
- table SQL- Returns:
- constraints
-
getColumnConstraints
public static ColumnConstraints getColumnConstraints(String constraintSql)
Attempt to get column constraints by parsing the SQL statement- Parameters:
constraintSql
- constraint SQL statement- Returns:
- constraints
-
getTableConstraint
public static Constraint getTableConstraint(String constraintSql)
Attempt to get a table constraint by parsing the SQL statement- Parameters:
constraintSql
- constraint SQL statement- Returns:
- constraint or null
-
isTableConstraint
public static boolean isTableConstraint(String constraintSql)
Check if the SQL is a table type constraint- Parameters:
constraintSql
- constraint SQL statement- Returns:
- true if a table constraint
-
getTableType
public static ConstraintType getTableType(String constraintSql)
Get the table constraint type of the constraint SQL- Parameters:
constraintSql
- constraint SQL- Returns:
- constraint type or null
-
isTableType
public static boolean isTableType(ConstraintType type, String constraintSql)
Determine if the table constraint SQL is the constraint type- Parameters:
type
- constraint typeconstraintSql
- constraint SQL- Returns:
- true if the constraint type
-
getColumnConstraint
public static Constraint getColumnConstraint(String constraintSql)
Attempt to get a column constraint by parsing the SQL statement- Parameters:
constraintSql
- constraint SQL statement- Returns:
- constraint or null
-
isColumnConstraint
public static boolean isColumnConstraint(String constraintSql)
Check if the SQL is a column type constraint- Parameters:
constraintSql
- constraint SQL statement- Returns:
- true if a column constraint
-
getColumnType
public static ConstraintType getColumnType(String constraintSql)
Get the column constraint type of the constraint SQL- Parameters:
constraintSql
- constraint SQL- Returns:
- constraint type or null
-
isColumnType
public static boolean isColumnType(ConstraintType type, String constraintSql)
Determine if the column constraint SQL is the constraint type- Parameters:
type
- constraint typeconstraintSql
- constraint SQL- Returns:
- true if the constraint type
-
getConstraint
public static Constraint getConstraint(String constraintSql)
Attempt to get a constraint by parsing the SQL statement- Parameters:
constraintSql
- constraint SQL statement- Returns:
- constraint or null
-
isConstraint
public static boolean isConstraint(String constraintSql)
Check if the SQL is a constraint- Parameters:
constraintSql
- constraint SQL statement- Returns:
- true if a constraint
-
getType
public static ConstraintType getType(String constraintSql)
Get the constraint type of the constraint SQL- Parameters:
constraintSql
- constraint SQL- Returns:
- constraint type or null
-
isType
public static boolean isType(ConstraintType type, String constraintSql)
Determine if the constraint SQL is the constraint type- Parameters:
type
- constraint typeconstraintSql
- constraint SQL- Returns:
- true if the constraint type
-
getName
public static String getName(String constraintSql)
Get the constraint name if it has one- Parameters:
constraintSql
- constraint SQL- Returns:
- constraint name or null
-
-