Class Configuration
- java.lang.Object
-
- com.vladmihalcea.hibernate.type.util.Configuration
-
public class Configuration extends java.lang.Object
Configuration
- It allows declarative configuration through thehibernate.properties
file or thehibernate-types.properties
file. The properties fromhibernate-types.properties
can override the ones from thehibernate.properties
file. It loads theProperties
configuration file and makes them available to other components.- Since:
- 2.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Configuration.PropertyKey
Each Property has a well-defined key.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APPLICATION_PROPERTIES_FILE_NAME
private static boolean
bannerPrinted
static Configuration
INSTANCE
private java.util.Properties
properties
static java.lang.String
PROPERTIES_FILE_NAME
static java.lang.String
PROPERTIES_FILE_PATH
-
Constructor Summary
Constructors Modifier Constructor Description private
Configuration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
booleanProperty(Configuration.PropertyKey propertyKey)
Get Boolean property value<T> java.lang.Class<T>
classProperty(Configuration.PropertyKey propertyKey)
Get Class property valueObjectMapperWrapper
getObjectMapperWrapper()
GetObjectMapperWrapper
referencejava.util.Properties
getProperties()
Get all properties.private <T> T
instantiateClass(Configuration.PropertyKey propertyKey)
Instantiate class associated to the given property keyjava.lang.Integer
integerProperty(Configuration.PropertyKey propertyKey)
Get Integer property valueprivate boolean
isHypersistenceOptimizer()
private void
load()
LoadProperties
from the resolvedInputStream
java.lang.Long
longProperty(Configuration.PropertyKey propertyKey)
Get Long property valueprivate void
printBanner()
Print the banner into the log.private java.io.InputStream
propertiesInputStream(java.lang.String propertiesFilePath)
GetProperties
fileInputStream
-
-
-
Field Detail
-
INSTANCE
public static final Configuration INSTANCE
-
PROPERTIES_FILE_PATH
public static final java.lang.String PROPERTIES_FILE_PATH
- See Also:
- Constant Field Values
-
PROPERTIES_FILE_NAME
public static final java.lang.String PROPERTIES_FILE_NAME
- See Also:
- Constant Field Values
-
APPLICATION_PROPERTIES_FILE_NAME
public static final java.lang.String APPLICATION_PROPERTIES_FILE_NAME
- See Also:
- Constant Field Values
-
properties
private final java.util.Properties properties
-
bannerPrinted
private static boolean bannerPrinted
-
-
Method Detail
-
load
private void load()
LoadProperties
from the resolvedInputStream
-
propertiesInputStream
private java.io.InputStream propertiesInputStream(java.lang.String propertiesFilePath) throws java.io.IOException
GetProperties
fileInputStream
- Parameters:
propertiesFilePath
- properties file path- Returns:
Properties
fileInputStream
- Throws:
java.io.IOException
- the file couldn't be loaded properly
-
getProperties
public java.util.Properties getProperties()
Get all properties.- Returns:
- properties.
-
getObjectMapperWrapper
public ObjectMapperWrapper getObjectMapperWrapper()
GetObjectMapperWrapper
reference- Returns:
ObjectMapperWrapper
reference
-
integerProperty
public java.lang.Integer integerProperty(Configuration.PropertyKey propertyKey)
Get Integer property value- Parameters:
propertyKey
- property key- Returns:
- Integer property value
-
longProperty
public java.lang.Long longProperty(Configuration.PropertyKey propertyKey)
Get Long property value- Parameters:
propertyKey
- property key- Returns:
- Long property value
-
booleanProperty
public java.lang.Boolean booleanProperty(Configuration.PropertyKey propertyKey)
Get Boolean property value- Parameters:
propertyKey
- property key- Returns:
- Boolean property value
-
classProperty
public <T> java.lang.Class<T> classProperty(Configuration.PropertyKey propertyKey)
Get Class property value- Type Parameters:
T
- class generic type- Parameters:
propertyKey
- property key- Returns:
- Class property value
-
instantiateClass
private <T> T instantiateClass(Configuration.PropertyKey propertyKey)
Instantiate class associated to the given property key- Type Parameters:
T
- class parameter type- Parameters:
propertyKey
- property key- Returns:
- class instance
-
printBanner
private void printBanner()
Print the banner into the log.
-
isHypersistenceOptimizer
private boolean isHypersistenceOptimizer()
-
-