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

org.zodiac.fastorm.rdb.metadata.RDBDatabaseMetadata Maven / Gradle / Ivy

The newest version!
package org.zodiac.fastorm.rdb.metadata;

import org.zodiac.fastorm.core.meta.AbstractDatabaseMetadata;
import org.zodiac.fastorm.rdb.metadata.dialect.Dialect;

import reactor.core.publisher.Mono;

import java.util.Optional;

public class RDBDatabaseMetadata extends AbstractDatabaseMetadata {

    protected Dialect dialect;

    public RDBDatabaseMetadata(Dialect dialect) {
        this.dialect = dialect;
    }

    public Dialect getDialect() {
        return dialect;
    }

    public Optional getTableOrView(String name) {
        return this.getObject(name, RDBSchemaMetadata::getTableOrView);
    }

    public Optional getTableOrView(String name, boolean autoLoad) {
        return this.getObject(name, (schema, _name) -> schema.getTableOrView(_name, autoLoad));
    }

    public Optional getTable(String name) {
        return this.getObject(name, RDBSchemaMetadata::getTable);
    }

    public Mono getTableOrViewReactive(String name) {
        return this.getObjectReactive(name, RDBSchemaMetadata::getTableOrViewReactive);
    }

    public Mono getTableOrViewReactive(String name, boolean autoLoad) {
        return this.getObjectReactive(name, (schema, _name) -> schema.getTableOrViewReactive(_name, autoLoad));
    }

    public Mono getTableReactive(String name) {
        return this.getObjectReactive(name, RDBSchemaMetadata::getTableReactive);
    }

    @Override
    public Optional getSchema(String name) {
        return super.getSchema(getDialect().clearQuote(name));
    }

    @Override
    public void addSchema(RDBSchemaMetadata schema) {
        schema.setDatabase(this);
        super.addSchema(schema);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy