<commit_before>package org.helianto.core.criteria;

/**
 * Build an EJB-QL "select" and "from" strings, appropriate to be used
 * before the "where" keyword in a query.
 * 
 * @author <NAME>
 */
public class SelectFromBuilder extends SelectBuilder {

    /**
     * Default constructor.
     */
    public SelectFromBuilder() {
        super();
    }
    
    /**
     * Class constructor.
     * 
     * @param clazz
     */
    public SelectFromBuilder(Class<?> clazz) {
    	super(clazz);
    }
    
    /**
     * Class alias constructor.
     * 
     * @param alias
     * @param clazz
     */
    public SelectFromBuilder(Class<?> clazz, String alias) {
        super(clazz, alias);
    }
    
    /**
     * Select from builder.
     * 
     * @param fieldNames
     */
    public SelectFromBuilder createSelectFrom(String... fieldNames) {
    	SelectFromBuilder builder = (SelectFromBuilder) super.createSelect(fieldNames);
    	builder.appendFrom();
    	return builder;
    }
    
    /**
     * From appender.
     */
    public SelectFromBuilder appendFrom() {
    	append("from")
    	    .append(getClazz().getSimpleName())
    	    .append(getAlias());
    	return this;
    }
    
    /**
     * Inner join appender.
     * 
     * @param propertyName
     * @param joinedClassAlias
     */
    public SelectFromBuilder appendInnerJoin(String propertyName, String joinedClassAlias) {
    	append("inner join")
    	    .appendWithPrefix(propertyName)
    	    .append("as")
    	    .append(joinedClassAlias);
    	return this;
    }
    
}<commit_msg>Added inner join helper appenders.<commit_after>package org.helianto.core.criteria;

/**
 * Build an EJB-QL "select" and "from" strings, appropriate to be used
 * before the "where" keyword in a query.
 * 
 * @author <NAME>
 */
public class SelectFromBuilder extends SelectBuilder {

    /**
     * Default constructor.
     */
    public SelectFromBuilder() {
        super();
    }
    
    /**
     * Class constructor.
     * 
     * @param clazz
     */
    public SelectFromBuilder(Class<?> clazz) {
    	super(clazz);
    }
    
    /**
     * Class alias constructor.
     * 
     * @param alias
     * @param clazz
     */
    public SelectFromBuilder(Class<?> clazz, String alias) {
        super(clazz, alias);
    }
    
    /**
     * Select from builder.
     * 
     * @param fieldNames
     */
    public SelectFromBuilder createSelectFrom(String... fieldNames) {
    	SelectFromBuilder builder = (SelectFromBuilder) super.createSelect(fieldNames);
    	builder.appendFrom();
    	return builder;
    }
    
    /**
     * From appender.
     */
    public SelectFromBuilder appendFrom() {
    	append("from")
    	    .append(getClazz().getSimpleName())
    	    .append(getAlias());
    	return this;
    }
    
    /**
     * Inner join appender.
     * 
     * @param propertyName
     * @param joinedClassAlias
     */
    public SelectFromBuilder appendInnerJoin(String propertyName, String joinedClassAlias) {
    	append("inner join")
    	    .appendWithPrefix(propertyName)
    	    .append("as")
    	    .append(joinedClassAlias);
    	return this;
    }
    
    /**
     * Parent association inner join appender.
     */
    public SelectFromBuilder appendParentInnerJoin() {
    	return appendInnerJoin("parentAssociations", "parentAssociations");
    }
    
    /**
     * Child association inner join appender.
     */
    public SelectFromBuilder appendChildInnerJoin() {
    	return appendInnerJoin("childAssociations", "childAssociations");
    }
    
}
{'fraction_non_alphanumeric': 0.11273545122294068, 'fraction_numerical': 0.0, 'mean_word_length': 2.1598579040852575, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2018279', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1036, 'n_words': 226}