public class DBPolygon2D extends QueryableDatatype<com.vividsolutions.jts.geom.Polygon> implements TransformRequiredForSelectClause, Polygon2DResult
Use DBPolygon2D when the column is a 2 dimensional Polygon,
ST_Polygon, or GEOMETRY that represents a polygon.
Generally DBPolygon2D is declared inside your DBRow sub-class as:
@DBColumn public DBPolygon2D myPolygonColumn = new DBPolygon2D();
Support DBvolution at Patreon
SORT_ASCENDING, SORT_DESCENDING| Constructor and Description |
|---|
DBPolygon2D()
Create an unset undefined DBPolygon2D object to represent a Polygon column
or value.
|
DBPolygon2D(com.vividsolutions.jts.geom.Polygon polygon)
Create DBPolygon2D and set it's value to the JTS
Polygon provided. |
DBPolygon2D(Polygon2DExpression columnExpression)
Create a DBPolygon2D with the column expression specified.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
formatValueForSQLStatement(DBDefinition db)
Returns the value of the object formatted for the database
This should be overridden in each subclass
This method is called by toSQLString after checking for NULLs and should
return a string representation of the object formatted for use within a SQL
select, insert, update, or delete statement.
|
protected com.vividsolutions.jts.geom.Polygon |
getFromResultSet(DBDefinition database,
ResultSet resultSet,
String fullColumnName)
Returns the correct object from the ResultSet for the QueryableDatatype to
handle.
|
boolean |
getIncludesNull()
Returns TRUE if this expression requires support for possible NULL database
values.
|
String |
getSQLDatatype()
Provides the SQL datatype used by default for this type of object.
|
com.vividsolutions.jts.geom.Polygon |
getValue()
Gets the current literal value of this queryable data type.
|
boolean |
isAggregator()
Returns TRUE if this expression is an Aggregator like SUM() or LEAST().
|
com.vividsolutions.jts.geom.Polygon |
jtsPolygonValue()
Convert the value of this object to a JTS
Polygon. |
void |
setValue(com.vividsolutions.jts.geom.Polygon polygon)
Set the value of this DBPolygon2D to the
Polygon specified. |
protected void |
setValueFromStandardStringEncoding(String encodedValue)
Set the value of this QDT to the value provided from the standard string
encoding of this datatype
|
StringExpression |
stringResult()
Converts the expression into the standard string/character expression
representing the value.
|
clear, copy, equals, formatColumnForSQLStatement, getColumnExpression, getLiteralValue, getOperator, getPreviousSQLValue, getPreviousValue, getPropertyWrapperDefinition, getQueryableDatatypeForExpressionValue, getQueryableDatatypeForObject, getQueryableDatatypeInstance, getSortOrder, getTablesInvolved, hasBeenSet, hasChanged, hasColumnExpression, hashCode, includingNulls, isDefined, isNotNull, isNull, isPurelyFunctional, negateOperator, removeConstraints, setChanged, setColumnExpression, setDefined, setFromResultSet, setLiteralValue, setOperator, setPreviousValue, setSortOrderAscending, setSortOrderDescending, setToNull, setToNull, setUnchanged, setValueToNull, stringValue, toSQLString, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcopy, getQueryableDatatypeForExpressionValue, getTablesInvolved, isPurelyFunctional, toSQLStringpublic DBPolygon2D()
public DBPolygon2D(Polygon2DExpression columnExpression)
When retrieving this object from the database the expression will be evaluated to provide the value.
columnExpression - public DBPolygon2D(com.vividsolutions.jts.geom.Polygon polygon)
Polygon provided.
Equivalent to {code polygon2D = new DBPolygon2D(); polygon2D.setValue(aPolygon);}
polygon - public void setValue(com.vividsolutions.jts.geom.Polygon polygon)
Polygon specified.
Set values are used to add the value to the database. Without a set value the database entry will be NULL.
polygon - the value to be set in the database.public String getSQLDatatype()
QueryableDatatypeThis should be overridden in each subclass
Example return value: "VARCHAR(1000)"
Database specific datatypes are provided by the DBDefinition in the method
DBDefinition.getDatabaseDataTypeOfQueryableDatatype(nz.co.gregs.dbvolution.datatypes.QueryableDatatype<?>)
Support DBvolution at Patreon
getSQLDatatype in class QueryableDatatype<com.vividsolutions.jts.geom.Polygon>protected String formatValueForSQLStatement(DBDefinition db)
QueryableDatatypeformatValueForSQLStatement in class QueryableDatatype<com.vividsolutions.jts.geom.Polygon>db - db
Support DBvolution at Patreon
protected com.vividsolutions.jts.geom.Polygon getFromResultSet(DBDefinition database, ResultSet resultSet, String fullColumnName) throws SQLException
QueryableDatatypegetFromResultSet in class QueryableDatatype<com.vividsolutions.jts.geom.Polygon>database - databaseresultSet - resultSetfullColumnName - fullColumnName
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionpublic com.vividsolutions.jts.geom.Polygon jtsPolygonValue()
Polygon.
NULL is valid result from this method.
Support DBvolution at Patreon
public com.vividsolutions.jts.geom.Polygon getValue()
QueryableDatatype
This method will return NULL if the QDT represents a database NULL OR the
field is undefined. Use QueryableDatatype.isNull() and QueryableDatatype.isDefined() to
differentiate the 2 states.
Undefined QDTs represents a QDT that is not a field from the database.
Undefined QDTs are similar to undefined DBRows
Support DBvolution at Patreon
getValue in class QueryableDatatype<com.vividsolutions.jts.geom.Polygon>public boolean isAggregator()
DBExpressionSubclasses must implement this method returning TRUE if the expression will combine the results of several rows to produce a result. If the expression relies on subexpressions, then the isAggregator method must return TRUE if the subexpressions include an aggregator.
Aggregators collect several rows together to produce a single result. Examples are MAX, MIN, and AVERAGE.
They are only appropriate in the SELECT clause and generally require the GROUP BY clause to be useful.
Aggregators are used with DBReport. Aggregator expressions are
included in the SELECT clause but excluded from the GROUP BY clause.
Support DBvolution at Patreon
isAggregator in interface DBExpressionpublic boolean getIncludesNull()
ExpressionCanHaveNullValuesSupport DBvolution at Patreon
getIncludesNull in interface ExpressionCanHaveNullValuespublic StringExpression stringResult()
ExpressionHasStandardStringResultNot all types have a standard string/character representation, notably dates.
Please note that this is not the SQL version of the expression
(toSQLString() will provide that),
nor does this provide a String of the value.
To get the string value use the
stringValue method of the
appropriate QDT.
Support DBvolution at Patreon
stringResult in interface ExpressionHasStandardStringResultprotected void setValueFromStandardStringEncoding(String encodedValue)
QueryableDatatypeSubclass writers should ensure that the method handles nulls correctly and throws an exception if an inappropriate value is supplied.
setValueFromStandardStringEncoding in class QueryableDatatype<com.vividsolutions.jts.geom.Polygon>encodedValue - the value of the QDT in the appropriate encodingCopyright © 2017. All Rights Reserved.