Commit Graph

30 Commits

Author SHA1 Message Date
Oliver Gierke
092972824e DATACMNS-951 - Polishing.
Switched to parameterized tests for newly introduced Converters.

Fixed imports and JavaDoc.

Original pull request: #186.
2016-12-05 09:59:25 +01:00
Barak Schuster
5020c7b8bb DATACMNS-951 - Added Converter implementations for JSR-310 Duration and Period.
Original pull request: #186.
2016-12-05 09:59:25 +01:00
Oliver Gierke
e0d2907905 DATACMNS-815 - Made static type cache non-static in SimpleTypeInformationMapper.
We now use a non-static cache for TypeInformation instances in SimpleTypeInformationMapper to make sure Spring Boot's development tools can correctly reload classes. Removed the static singleton instance of SimpleTypeInformationMapper in favor instantiating it directly.
2016-02-09 14:22:06 +01:00
Oliver Gierke
d2737983c3 DATACMNS-783 - DefaultTypeMapper now specializes raw generic types.
If the type lookup from the store source returns a raw generic type (e.g. resolving the value of a generic property against a value of that generic type - i.e. not a more concrete type binding the generic information) in the context of a generic property, we previously did not apply the generics information of the contextual instance to that very raw type.

We now expose a TypeInformation.specialize(ClassTypeInformation) which applies the current generics context to the given raw type and basically creates a synthetic parameterized TypeInformation instance.

DefaultTypeMapper applies this specialization by default now with ClassTypeInformation simply returning the given type as is so that we don't create any resolution overhead in case no generics are involved in the first place.
2015-11-13 17:16:47 +01:00
Oliver Gierke
828c19a4e5 DATACMNS-773 - Added support for persisting ZoneId instances as Strings.
We now ship converters for JSR-310 and ThreeTenBP's ZoneId conversion to String and back.
2015-10-05 18:03:42 +02:00
Oliver Gierke
a8b64c3828 DATACMNS-710 - Polishing.
Some additional JavaDoc, deprecations, copyright headers.

Original pull request: #128.
2015-06-15 22:16:46 +02:00
Phillip Webb
8156c2a151 DATACMNS-710 - Replace ObjectInstantiatorClassGenerator
Deprecate ObjectInstantiatorClassGenerator and provide a replacement
ClassGeneratingEntityInstantiator which doesn't retain a reference to
the context class loader.

Original pull request: #128.
2015-06-15 22:16:43 +02:00
Oliver Gierke
7107a599bb DATACMNS-710 - ObjectInstantiatorClassGenerator now uses default class loader.
We're now using ClassUtils.getDefaultClassloader() to make sure we adhere to any class loading tricks the framework might impose for domain type instantiation.
2015-06-09 22:01:25 +02:00
Oliver Gierke
ffbaeddedb DATACMNS-613 - Removed custom CollectionFactory after upgrade to Spring 4.1. 2015-03-31 17:13:37 +02:00
Oliver Gierke
53d19c72c3 DATACMNS-663 - Fixed typo in BytecodeGeneratingEntityInstantiator. 2015-03-27 12:33:13 +01:00
Oliver Gierke
0c65c7bb67 DATACMNS-638, DATACMNS-643 - Support for JSR-310 and ThreeTen datetime types.
Extend AuditableBeanWrapper to allow access to the last modification date of a target object. Made AuditableBeanWrapperFactory an interface and renamed what’s been previously known under this name as DefaultAuditableBeanWrapperFactory.

The components previously relying on a MappingContext to lookup a PersistentEntity now use PersistentEntities to be able to back a collection of MappingContexts behind that and also avoid unmanaged types to be added to the MappingContext.

We now also register the JSR-310 and ThreeTen back-port converters with the ConversionService to be able to get and set auditing dates as these types.
2015-02-04 19:30:02 +01:00
Oliver Gierke
df9f8c417e DATACMNS-637 - Performance improvements.
Made ObjectInstantiator interface public as otherwise the generated class to implement it cannot access it and thus the usage of the ByteCodeGeneratingEntityInstantiator fails completely.

PreferredConstructor.isEnclosingClassParameter(…) now eagerly returns if the parameter itself is not an enclosing one and thus avoids a collection lookup and equals check. Moved equals check for the type to the very end of the equals check to increase the chances that other inequality guards kick in earlier.

AbstractMappingContext now leaves the non-null-check for getPersistentEntity(…) to the factory method of ClassTypeInformation.

We now pre-calculate the hash codes for TypeInformation implementations as far as possible as the instances are used as cache keys quite a lot. The same applies to AbstractPersistentProperty.

BasicPersistentEntity now uses an ArrayList we sort during the verify() phase to mimic the previous behavior wich was implemented using a TreeSet as ArrayLists are way more performant when iterating over all elements which doWithProperties(…) is doing which is used quite a lot.

BeanWrapper now avoids the getter lookup if field access is used.

SimpleTypeHolder now uses a CopyOnWriteArrySet to leniently add types detected to be simple to the set of simple types to avoid ongoing checks against the inheritance hierarchy.
2015-01-25 17:43:59 +01:00
Oliver Gierke
9d3fab5e41 DATACMNS-628 - Polishing.
Renamed converter to ThreeTenBackPortConverter to better reflect the project we're integrating with.
2015-01-05 18:14:46 +01:00
Oliver Gierke
adbd363e2d DATACMNS-628 - Added converters for JSR-310 backport library.
We now include Spring Converters for the ThreeTen backport project [0].

[0] http://www.threeten.org/threetenbp
2015-01-04 21:43:26 +01:00
Oliver Gierke
c5d920fa69 DATACMNS-623 - Added converter for JSR-310 Instant instances.
Made the converter types public to be able to reuse them from other projects.

Related tickets: DATAJPA-650.
2014-12-30 19:09:27 +01:00
Oliver Gierke
a5df8d92a7 DATACMNS-606 - Added converters for JSR-310 types.
Added Jsr310Converters to contain converters to map between Date and JDK 8 date/time types.
2014-11-27 14:54:41 +01:00
Oliver Gierke
e1b38faee9 DATACMNS-601 - Fixes for most of the SonarQube warnings. 2014-11-26 09:25:14 +01:00
Oliver Gierke
28b7e0439d DATACMNS-578 - Polishing.
Added some JavaDoc where missing. Better variable names and slightly parameter ordering changes. Formatting in the unit tests and reference to the original ticket.

Original pull request: #98.
2014-10-21 12:18:01 +02:00
Thomas Darimont
1b9cdc941f DATACMNS-578 - Speed up instance creation by generating factory classes with ASM.
Introduced BytecodeGeneratingEntityInstantiator which dynamically generates classes to speed up the dynamic instantiation of objects. Since we cannot support every use case with byte code generation we gracefully fallback to the ReflectiveEntityInstantiator.

BytecodeGeneratingEntityInstantiator has support for unboxing of constructor parameters and more robust handling for cases where we cannot generate a custom ObjectInstantiator.

Original pull request: #98.
2014-10-21 12:18:01 +02:00
Oliver Gierke
3660676338 DATACMNS-558 - Some code cleanups according to the Sonar report. 2014-08-10 12:51:28 +02:00
Oliver Gierke
5791e9b201 DATACMNS-495 - Prepare 1.8.0.RC1.
Removed compiler warnings (obsolete @SuppressWarnings and obsolete code). Upgraded to Spring HATEOAS 0.11.0.
2014-05-01 20:23:58 +02:00
Oliver Gierke
165c0595e3 DATACMNS-485 - API improvements to in TypeInformationMapper area.
The default implementations of the TypeInformation Mapper interfaces now work with ClassTypeInformation where possible to express they only map raw types effectively.

Added TypeInformation.getRawTypeInformation() to easily turn whatever TypeInformation into the raw type representation. Changed ClassTypeInformation.from(…) to return ClassTypeInformations directly.
2014-04-15 07:49:46 +02:00
Oliver Gierke
64caad04a3 DATACMNS-485 - Fixed false negative type alias detection in MappingContextTypeInformationMapper.
MappingContextTypeInformationMapper now considers the raw type only for type alias conflict detection.
2014-04-15 07:49:38 +02:00
Oliver Gierke
3131ffbc5f DATACMNS-451 - Added custom CollectionFactory.
Added a Spring Data specific CollectionFactory that augments Spring's CollectionFactory with support for special collection types like EnumSet and EnumMap. For all other types we delegate to the wrapped class.
2014-02-26 05:12:23 +01:00
Thomas Darimont
cc576a7398 DATACMNS-349 - Opened up SPI in DefaultTypeMapper to allow subclasses to resolve TypeAliases.
Added getAliasFor(TypeInformation) method in DefaultTypeMapper to allow subclasses to resolve TypeAliases.
2013-07-23 13:21:59 +02:00
Oliver Gierke
a9abb40fbd DATACMNS-332 - Performance improvements in conversion subsystem hotspots.
Added caching to DefaultTypeMapper, SimpleTypeInformationMapper, BasicPersistentEntity and PreferredConstructor as these seem to be performance hotspots on the reading side of object conversion.
2013-05-17 13:58:14 +02:00
Johannes Mockenhaupt
596908946d DATACMNS-300 - Fixed exception handling in ReflectionEntityInstantiator.
ReflectionEntityInstantiator now actually throws the wrapped exception created in the catch block handling BeanInstantiationExceptions.

Pull request: #25.
2013-03-25 13:35:09 +01:00
Oliver Gierke
0aef8c60b7 DATACMNS-283 - MappingInstantiationException captures more context now.
If an exception occurs in ReflectionEntityInstantiator we now capture more context about the failed instantiation.
2013-02-15 18:34:56 +01:00
Oliver Gierke
80b6dd2217 DATACMNS-278 - Added Converter implementations for JodaTime types.
Upgraded to JodaTime 2.1 based on super pom property definition.
2013-02-06 17:49:24 +01:00
Oliver Gierke
ac256f9921 DATACMNS-266 - Use new common Maven build infrastructure.
Simplified project setup to be a single module build again. Using Spring Data Build parent POM to simplify project setup. See https://github.com/SpringSource/spring-data-build#spring-data-build-infrastructure
2013-01-16 15:15:24 +01:00