Skip to content
Snippets Groups Projects
Commit 7d734227 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

Add column name printing method

parent a33d8fb7
No related branches found
No related tags found
No related merge requests found
package de.unikoblenz.fgbks.core.dmn.domain.vdmn.utils;
import de.unikoblenz.fgbks.base.domain.Name;
import de.unikoblenz.fgbks.core.dmn.domain.ids.RuleId;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnColumn;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecisionTable;
......@@ -213,4 +214,32 @@ public class VDmnFunctions {
}
return clusters;
}
/**
* Get the name of a column as string. If a label is present, the string of the label is returned.
* If the label is not present, the name is returned. If the name is not present, "[no name]" is
* returned.
*
* @param column the {@link VDmnColumn}
* @return a string, representing the "name" of the column
*/
public String getColumnStringName(VDmnColumn column) {
Validate.notNull(column);
return column.getLabel().isPresent()
? column.getLabel().get().toString()
: column.getName().orElse(new Name("[no name]")).toString();
}
/**
* Get the name of a column as string. If a label is present, the string of the label is returned.
* If the label is not present, the name is returned. If the name is not present, "[no name]" is
* returned.
*
* @param column the {@link VDmnColumn}
* @return a string, representing the "name" of the column + "name"
*/
public String getColumnStringNameWithDoubleQuotes(VDmnColumn column) {
Validate.notNull(column);
return "\"" + getColumnStringName(column) + "\"";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment