org.joinedworkz.common.strategies.ColumnNameStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-base Show documentation
Show all versions of common-base Show documentation
DSL based modeling framework - facilities common base
package org.joinedworkz.common.strategies;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.joinedworkz.common.helper.CmnModelHelper;
import org.joinedworkz.common.helper.NameHelper;
import org.joinedworkz.core.facility.AbstractStrategy;
import org.joinedworkz.core.model.CmnField;
import org.joinedworkz.core.model.CmnObject;
@Singleton
@SuppressWarnings("all")
public class ColumnNameStrategy extends AbstractStrategy {
@Inject
@Extension
private NameHelper _nameHelper;
@Inject
@Extension
private CmnModelHelper _cmnModelHelper;
@Override
public Object apply(final CmnObject obj) {
if ((obj instanceof CmnField)) {
return this.defaultColumnName(((CmnField)obj));
}
return null;
}
public String defaultColumnName(final CmnField it) {
StringConcatenation _builder = new StringConcatenation();
String _lowerCase = this._nameHelper.camelCaseToUnderLineSeperated(this._cmnModelHelper.javaDtoFieldName(it)).toLowerCase();
_builder.append(_lowerCase);
return _builder.toString();
}
}