/** * Returns a {@link CreateUserTypeSpecification} for the given entity, including all mapping information. * * @param entity must not be {@literal null}. */ public CreateUserTypeSpecification getCreateUserTypeSpecificationFor(CassandraPersistentEntity<?> entity) { Assert.notNull(entity, "CassandraPersistentEntity must not be null"); CreateUserTypeSpecification specification = CreateUserTypeSpecification.createType(entity.getTableName()); for (CassandraPersistentProperty property : entity) { // Use frozen literal to not resolve types from Cassandra; At this stage, they might be not created yet. specification.field(property.getRequiredColumnName(), getDataTypeWithUserTypeFactory(property, DataTypeProvider.FrozenLiteral)); } if (specification.getFields().isEmpty()) { throw new MappingException(String.format("No fields in user type [%s]", entity.getType())); } return specification; }