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

org.joinedworkz.common.strategies.ColumnNameStrategy Maven / Gradle / Ivy

There is a newer version: 1.3.51
Show newest version
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();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy