tech.ydb.yoj.repository.db.ViewSchema Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yoj-repository Show documentation
Show all versions of yoj-repository Show documentation
Core YOJ (YDB ORM for Java) abstractions and APIs for domain entities, repositories, transactions etc.
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());
}
}