com.vmware.dcm.compiler.ir.TableRowGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dcm Show documentation
Show all versions of dcm Show documentation
Library for building declarative cluster managers. Please refer to the README at github.com/vmware/declarative-cluster-management/ for instructions on setting up solvers before use.
/*
* Copyright 2018-2020 VMware, Inc. All Rights Reserved.
*
* SPDX-License-Identifier: BSD-2
*/
package com.vmware.dcm.compiler.ir;
import com.vmware.dcm.IRColumn;
import com.vmware.dcm.IRTable;
import com.vmware.dcm.IRPrimaryKey;
import java.util.Optional;
public final class TableRowGenerator extends Qualifier {
private final IRTable table;
public TableRowGenerator(final IRTable table) {
this.table = table;
}
public IRTable getTable() {
return table;
}
public Optional getUniquePrimaryKeyColumn() {
return table.getPrimaryKey().map(IRPrimaryKey::getPrimaryKeyFields)
.filter(l -> l.size() == 1)
.map(l -> l.get(0));
}
@Override
public String toString() {
return "TableRowGenerator{" +
"table=" + table.getName() +
'}';
}
@Override
T acceptVisitor(final IRVisitor visitor, final C context) {
return visitor.visitTableRowGenerator(this, context);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy