/** * Converts underscore based column name to Camel case property name. * * @param beanClass the bean class * @param dbColumnName the db column name * @return the property from column */ public String getPropertyFromColumn(Class<?> beanClass, String dbColumnName) { return toCamelFromUnderscore(dbColumnName); }
/** * Converts Camel case property name to underscore based column name. * * @return the column from property */ public String getColumnFromProperty(Class<?> beanClass, String propertyName) {//Field field) { return toUnderscoreFromCamel(propertyName); }
/** * Returns the last part of the class name. * * @param beanClass the bean class * @return the table name from class */ public TableName getTableNameByConvention(Class<?> beanClass) { return new TableName(getCatalog(), getSchema(), toUnderscoreFromCamel(beanClass.getSimpleName())); }
/** * Set the naming convention to underscore if it has not already been set. */ private void setNamingConvention(ServerConfig config) { if (config.getNamingConvention() == null) { UnderscoreNamingConvention nc = new UnderscoreNamingConvention(); config.setNamingConvention(nc); String v = config.getProperty("namingConvention.useForeignKeyPrefix"); if (v != null) { boolean useForeignKeyPrefix = Boolean.valueOf(v); nc.setUseForeignKeyPrefix(useForeignKeyPrefix); } String sequenceFormat = config.getProperty("namingConvention.sequenceFormat"); if (sequenceFormat != null) { nc.setSequenceFormat(sequenceFormat); } } }
private NamingConvention namingConvention(SqlDbServiceConfig svcConfig) { if (!svcConfig.rawConf.containsKey("naming.convention")) { // https://github.com/actframework/act-ebean2/issues/1 return new UnderscoreNamingConvention(); } //TODO provide more actuate naming convention matching logic if (MATCHING == svcConfig.tableNamingConvention) { return new MatchingNamingConvention(); } return new UnderscoreNamingConvention(); }
/** * Returns the last part of the class name. * * @param beanClass the bean class * * @return the table name from class */ public TableName getTableNameByConvention(Class<?> beanClass) { return new TableName(getCatalog(), getSchema(), toUnderscoreFromCamel(beanClass.getSimpleName())); }
/** * Set the naming convention to underscore if it has not already been set. */ private void setNamingConvention(ServerConfig config) { if (config.getNamingConvention() == null) { UnderscoreNamingConvention nc = new UnderscoreNamingConvention(); config.setNamingConvention(nc); String v = config.getProperty("namingConvention.useForeignKeyPrefix"); if (v != null) { boolean useForeignKeyPrefix = Boolean.valueOf(v); nc.setUseForeignKeyPrefix(useForeignKeyPrefix); } String sequenceFormat = config.getProperty("namingConvention.sequenceFormat"); if (sequenceFormat != null) { nc.setSequenceFormat(sequenceFormat); } } }
/** * Set the naming convention to underscore if it has not already been set. */ private void setNamingConvention(ServerConfig config) { if (config.getNamingConvention() == null) { config.setNamingConvention(new UnderscoreNamingConvention()); } }
/** * Returns the last part of the class name. * * @param beanClass * the bean class * * @return the table name from class */ public TableName getTableNameByConvention(Class<?> beanClass) { return new TableName(getCatalog(), getSchema(), toUnderscoreFromCamel(beanClass.getSimpleName())); }
/** * Converts Camel case property name to underscore based column name. * * @return the column from property */ public String getColumnFromProperty(Class<?> beanClass, String propertyName) {// Field // field) // { return toUnderscoreFromCamel(propertyName); }
/** * Converts underscore based column name to Camel case property name. * * @param beanClass the bean class * @param dbColumnName the db column name * * @return the property from column */ public String getPropertyFromColumn(Class<?> beanClass, String dbColumnName) { return toCamelFromUnderscore(dbColumnName); }
/** * Converts Camel case property name to underscore based column name. * * @return the column from property */ public String getColumnFromProperty(Class<?> beanClass, String propertyName) { return toUnderscoreFromCamel(propertyName); }
/** * Converts underscore based column name to Camel case property name. * * @param beanClass * the bean class * @param dbColumnName * the db column name * * @return the property from column */ public String getPropertyFromColumn(Class<?> beanClass, String dbColumnName) { return toCamelFromUnderscore(dbColumnName); }
@Override public String getForeignKey(String prefix, String fkProperty) { return prefix + "_" + toUnderscoreFromCamel(fkProperty); }