Top Description Constructors Methods
org.hibernate.jpa.internal.util

public final Class PessimisticNumberParser

extends Object
Class Inheritance

An old-style query might pass positional numbers of Query parameters as strings. This implies we always need to attempt parsing string parameters to see if this deprecated feature is being used, but parsing leads to catching (and ignoring) NumberFormatException at runtime which is a performance problem, especially as the parse would fail each time a non-deprecated form is processed. This class is meant to avoid the need to allocate these exceptions at runtime. Use this class to convert String to Integer when it's unlikely to be successful: if you expect it to be a normal number, for example when a non successful parsing would be an error, using this utility is just an overhead.
Author
Sanne Grinovero

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
isValidNumber(final String parameterName)

public static Integer
toNumberOrNull(final String parameterName)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PessimisticNumberParserback to summary
private PessimisticNumberParser()

Method Detail

isValidNumberback to summary
private static boolean isValidNumber(final String parameterName)
toNumberOrNullback to summary
public static Integer toNumberOrNull(final String parameterName)