use of io.crnk.core.engine.parser.TypeParser 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;
}
use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.
the class RegistryEntryTest method newRepositoryInformation.
private <T> ResourceRepositoryInformation newRepositoryInformation(Class<T> repositoryClass, String path) {
ModuleRegistry moduleRegistry = new ModuleRegistry();
TypeParser typeParser = moduleRegistry.getTypeParser();
return new ResourceRepositoryInformationImpl(path, new ResourceInformation(typeParser, Task.class, path, null, null, null, null), RepositoryMethodAccess.ALL);
}
use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.
the class DefaultInformationBuilderTest method setup.
@Before
public void setup() {
TypeParser parser = new TypeParser();
builder = new DefaultInformationBuilder(parser);
}
use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.
the class TestResourceInformationProvider method build.
@Override
public ResourceInformation build(Class<?> resourceClass) {
ResourceField idField = new ResourceFieldImpl("testId", "id", ResourceFieldType.ID, Integer.class, null, null);
List<ResourceField> fields = Arrays.asList(idField);
TypeParser typeParser = context.getTypeParser();
ResourceInformation info = new ResourceInformation(typeParser, resourceClass, resourceClass.getSimpleName(), null, fields, new OffsetLimitPagingBehavior());
return info;
}
use of io.crnk.core.engine.parser.TypeParser in project crnk-framework by crnk-project.
the class ResourceInformationTest method setup.
@Before
public void setup() throws NoSuchFieldException {
ResourceField idField = new ResourceFieldImpl("id", "id", ResourceFieldType.ID, Long.class, Long.class, null);
ResourceField valueField = new ResourceFieldImpl("value", "value", ResourceFieldType.RELATIONSHIP, String.class, String.class, "projects");
TypeParser typeParser = new TypeParser();
sut = new ResourceInformation(typeParser, Task.class, "tasks", null, Arrays.asList(idField, valueField), new OffsetLimitPagingBehavior());
}
Aggregations