All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.ydb.yoj.repository.db.ViewSchema Maven / Gradle / Ivy

Go to download

Core YOJ (YDB ORM for Java) abstractions and APIs for domain entities, repositories, transactions etc.

There is a newer version: 2.6.1
Show newest version
package tech.ydb.yoj.repository.db;

import tech.ydb.yoj.databind.schema.Schema;
import tech.ydb.yoj.databind.schema.configuration.SchemaRegistry;
import tech.ydb.yoj.databind.schema.configuration.SchemaRegistry.SchemaKey;
import tech.ydb.yoj.databind.schema.naming.NamingStrategy;
import tech.ydb.yoj.databind.schema.reflect.ReflectField;
import tech.ydb.yoj.databind.schema.reflect.Reflector;

public final class ViewSchema extends Schema {
    private ViewSchema(SchemaKey key, Reflector reflector) {
        super(key, reflector);
    }

    public static  ViewSchema of(Class type) {
        return of(type, null);
    }

    public static  ViewSchema of(Class type, NamingStrategy namingStrategy) {
        return of(SchemaRegistry.getDefault(), type, namingStrategy);
    }

    public static  ViewSchema of(SchemaRegistry registry, Class type) {
        return of(registry, type, null);
    }

    public static  ViewSchema of(SchemaRegistry registry,
                                                                Class type, NamingStrategy namingStrategy) {
        return registry.getOrCreate(ViewSchema.class, ViewSchema::new, SchemaKey.of(type, namingStrategy));
    }

    @Override
    protected boolean isFlattenable(ReflectField field) {
        return Entity.Id.class.isAssignableFrom(field.getType());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy