use of io.crnk.core.engine.internal.information.resource.DefaultResourceInstanceBuilder in project crnk-framework by crnk-project.
the class JpaResourceInformationProvider method build.
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public ResourceInformation build(final Class<?> resourceClass) {
String resourceType = getResourceType(resourceClass);
MetaDataObject meta = metaProvider.discoverMeta(resourceClass).asDataObject();
DefaultResourceInstanceBuilder instanceBuilder = new DefaultResourceInstanceBuilder(resourceClass);
List<ResourceField> fields = getResourceFields(resourceClass);
Class<?> superclass = resourceClass.getSuperclass();
String superResourceType = superclass != Object.class && superclass.getAnnotation(MappedSuperclass.class) == null ? context.getResourceType(superclass) : null;
TypeParser typeParser = context.getTypeParser();
ResourceInformation info = new ResourceInformation(typeParser, resourceClass, resourceType, superResourceType, instanceBuilder, fields, new OffsetLimitPagingBehavior());
info.setValidator(new JpaOptimisticLockingValidator(meta));
info.setIdStringMapper(new JpaIdMapper(meta));
return info;
}
Aggregations