Search in sources :

Example 1 with MetaType

use of io.crnk.meta.model.MetaType in project crnk-framework by crnk-project.

the class TSMetaDataObjectTransformation method generateAttributes.

private static void generateAttributes(TSMetaTransformationContext context, TSInterfaceType interfaceType, MetaDataObject element) {
    for (MetaAttribute attr : element.getDeclaredAttributes()) {
        MetaType elementType = attr.getType().getElementType();
        TSField field = new TSField();
        field.setName(attr.getName());
        field.setType((TSType) context.transform(elementType, TSMetaTransformationOptions.EMPTY));
        field.setNullable(true);
        interfaceType.getDeclaredMembers().add(field);
    }
}
Also used : TSField(io.crnk.gen.typescript.model.TSField) MetaAttribute(io.crnk.meta.model.MetaAttribute) MetaType(io.crnk.meta.model.MetaType)

Example 2 with MetaType

use of io.crnk.meta.model.MetaType in project crnk-framework by crnk-project.

the class MetaLookupTest method testPrimitiveObject.

@Test
public void testPrimitiveObject() {
    MetaType meta = resourceProvider.getMeta(Object.class);
    Assert.assertEquals("base.object", meta.getId());
    Assert.assertEquals(Object.class, meta.getImplementationClass());
}
Also used : MetaType(io.crnk.meta.model.MetaType) Test(org.junit.Test)

Example 3 with MetaType

use of io.crnk.meta.model.MetaType in project crnk-framework by crnk-project.

the class MetaLookupTest method testPrimitiveFloat.

@Test
public void testPrimitiveFloat() {
    MetaType meta = resourceProvider.getMeta(Float.class);
    Assert.assertEquals("base.float", meta.getId());
    Assert.assertEquals(Float.class, meta.getImplementationClass());
    MetaType primitiveMeta = resourceProvider.getMeta(float.class);
    Assert.assertSame(meta, primitiveMeta);
}
Also used : MetaType(io.crnk.meta.model.MetaType) Test(org.junit.Test)

Example 4 with MetaType

use of io.crnk.meta.model.MetaType in project crnk-framework by crnk-project.

the class MetaLookupTest method testPrimitiveBoolean.

@Test
public void testPrimitiveBoolean() {
    MetaType meta = resourceProvider.getMeta(Boolean.class);
    Assert.assertEquals("base.boolean", meta.getId());
    Assert.assertEquals(Boolean.class, meta.getImplementationClass());
    MetaType primitiveMeta = resourceProvider.getMeta(boolean.class);
    Assert.assertSame(meta, primitiveMeta);
}
Also used : MetaType(io.crnk.meta.model.MetaType) Test(org.junit.Test)

Example 5 with MetaType

use of io.crnk.meta.model.MetaType in project crnk-framework by crnk-project.

the class MetaLookupTest method testPrimitiveByte.

@Test
public void testPrimitiveByte() {
    MetaType meta = resourceProvider.getMeta(Byte.class);
    Assert.assertEquals("base.byte", meta.getId());
    Assert.assertEquals(Byte.class, meta.getImplementationClass());
    MetaType primitiveMeta = resourceProvider.getMeta(byte.class);
    Assert.assertSame(meta, primitiveMeta);
}
Also used : MetaType(io.crnk.meta.model.MetaType) Test(org.junit.Test)

Aggregations

MetaType (io.crnk.meta.model.MetaType)21 Test (org.junit.Test)16 MetaAttribute (io.crnk.meta.model.MetaAttribute)5 MetaDataObject (io.crnk.meta.model.MetaDataObject)3 TSField (io.crnk.gen.typescript.model.TSField)2 MetaResource (io.crnk.meta.model.resource.MetaResource)2 Type (java.lang.reflect.Type)2 ResourceFieldType (io.crnk.core.engine.information.resource.ResourceFieldType)1 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)1 RegistryEntry (io.crnk.core.engine.registry.RegistryEntry)1 ResourceRegistry (io.crnk.core.engine.registry.ResourceRegistry)1 SerializeType (io.crnk.core.resource.annotations.SerializeType)1 TSParameterizedType (io.crnk.gen.typescript.model.TSParameterizedType)1 TSType (io.crnk.gen.typescript.model.TSType)1 MetaJpaDataObject (io.crnk.jpa.meta.MetaJpaDataObject)1 TestEntity (io.crnk.jpa.model.TestEntity)1 MetaArrayType (io.crnk.meta.model.MetaArrayType)1 MetaMapType (io.crnk.meta.model.MetaMapType)1 MetaResourceField (io.crnk.meta.model.resource.MetaResourceField)1 ParameterizedType (java.lang.reflect.ParameterizedType)1