use of io.crnk.meta.model.MetaPrimitiveType in project crnk-framework by crnk-project.
the class BaseMetaPartition method doAllocateMetaElement.
protected Optional<MetaElement> doAllocateMetaElement(Type type) {
if (type instanceof Class) {
Class clazz = (Class) type;
clazz = mapPrimitiveType(clazz);
if (isPrimitiveType(clazz)) {
String id = BASE_ID_PREFIX + firstToLower(clazz.getSimpleName());
Optional<MetaElement> optPrimitiveType = context.getMetaElement(id);
if (!optPrimitiveType.isPresent()) {
MetaPrimitiveType primitiveType = new MetaPrimitiveType();
primitiveType.setElementType(primitiveType);
primitiveType.setImplementationType(clazz);
primitiveType.setName(firstToLower(clazz.getSimpleName()));
primitiveType.setId(id);
return addElement(type, primitiveType);
}
return optPrimitiveType;
}
}
return Optional.empty();
}
Aggregations