Package net.sf.basedb.core
Class Values
java.lang.Object
net.sf.basedb.core.Values
Utility class to handle the conversion between data objects and
item objects. Only item objects are safe to be exposed to client
applications and plugins, but the database contains data objects.
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2019-02-27 14:18:43 +0100 (ons, 27 feb. 2019) $
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) static <T> T
getDataValue
(Object value) Convert an item values to a data value.(package private) static <T> List<T>
getDataValues
(List<?> itemValues) Convert a list of item values to data values.(package private) static <T> T
getItemValue
(DbControl dc, Object value) Convert a a data value to a item value.(package private) static <T> List<T>
getItemValues
(DbControl dc, List<?> dataValues) Convert a list of data values to item values.
-
Constructor Details
-
Values
Values()
-
-
Method Details
-
getItemValue
static <T> T getItemValue(DbControl dc, Object value) throws PermissionDeniedException, BaseException Convert a a data value to a item value. Ie.BasicData
objects will be converted to their correspodingBasicItem
objects,Date
:s will be copied since they are mutable, etc. This method is needed for example by theAnnotation.getValues()
method to make sure that the database can't be modified without the proper permissions.Objects implementing the
BatchableData
interface are not converted since these objects are safe for use with clients if they are evicted from the Hibernate session.- Parameters:
dc
- The DbControl to use for item conversion and evictionvalue
- The value to convert- Throws:
PermissionDeniedException
- If the value is an item which the logged in user doesn't have read permission forBaseException
- If there is another error
-
getItemValues
static <T> List<T> getItemValues(DbControl dc, List<?> dataValues) throws PermissionDeniedException, ItemNotFoundException, BaseException Convert a list of data values to item values. -
getDataValue
Convert an item values to a data value. Ie.BasicItem
objects will be converted to their correspodingBasicData
objects,Date
:s will be copied since they are mutable, etc.- Parameters:
value
- The value to convert
-
getDataValues
Convert a list of item values to data values.- See Also:
-