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

com.jk.data.dynamic.query.Keyword Maven / Gradle / Ivy

/*
 * Copyright 2002-2022 Dr. Jalal Kiswani. 
 * Email: [email protected]
 * Check out https://smart-api.com for more details
 * 
 * All the opensource projects of Dr. Jalal Kiswani are free for personal and academic use only, 
 * for commercial usage and support, please contact the author.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jk.data.dynamic.query;

// TODO: Auto-generated Javadoc
/**
 * The Class Keyword.
 */
public class Keyword implements QueryComponent {

	/** The Constant SELECT. */
	public static final QueryComponent SELECT = new Keyword("SELECT");

	/** The Constant FROM. */
	public static final QueryComponent FROM = new Keyword("FROM");

	/** The Constant AND. */
	public static final QueryComponent AND = new Keyword("AND", true);

	/** The Constant OR. */
	public static final QueryComponent OR = new Keyword("OR", true);

	/** The Constant LEFT_JOIN. */
	public static final QueryComponent LEFT_JOIN = new Keyword("LEFT JOIN", true);

	/** The Constant RIGHT_JOIN. */
	public static final QueryComponent RIGHT_JOIN = new Keyword("RIGHT JOIN", true);

	/** The Constant WHERE. */
	public static final QueryComponent WHERE = new Keyword("WHERE");

	/** The Constant INSERT. */
	public static final QueryComponent INSERT = new Keyword("INSERT", true);

	/** The Constant VALUES. */
	public static final QueryComponent VALUES = new Keyword("VALUES");

	/** The Constant INTO. */
	public static final QueryComponent INTO = new Keyword("INTO", true);

	/** The Constant COMMA. */
	public static final QueryComponent COMMA = new Keyword(",", true);

	/** The Constant VARIABLE. */
	public static final QueryComponent VARIABLE = new Keyword("?", true);

	/** The Constant LEFT_PARENTHESES. */
	public static final QueryComponent LEFT_PARENTHESES = new Keyword("(", true);

	/** The Constant RIGHT_PARENTHESES. */
	public static final QueryComponent RIGHT_PARENTHESES = new Keyword(")");

	/** The Constant SEMICOLON. */
	public static final QueryComponent SEMICOLON = new Keyword(";");

	/** The name. */
	String name;

	/** The inline. */
	boolean inline;

	/**
	 * Instantiates a new keyword.
	 */
	public Keyword() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * Instantiates a new keyword.
	 *
	 * @param name the name
	 */
	public Keyword(final String name) {
		this.name = name;
	}

	/**
	 * Instantiates a new keyword.
	 *
	 * @param name   the name
	 * @param inline the inline
	 */
	public Keyword(final String name, final boolean inline) {
		this.name = name;
		this.inline = inline;
	}

	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Checks if is inline.
	 *
	 * @return true, if is inline
	 */
	/*
	 * (non-Javadoc)
	 * 
	 * @see com.jk.metadata.db.query.QueryComponent#isInline()
	 */
	@Override
	public boolean isInline() {
		return this.inline;
	}

	/**
	 * Sets the inline.
	 *
	 * @param inline the new inline
	 */
	public void setInline(final boolean inline) {
		this.inline = inline;
	}

	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(final String name) {
		this.name = name;
	}

	/**
	 * To query element.
	 *
	 * @return the object
	 */
	/*
	 * (non-Javadoc)
	 * 
	 * @see com.jk.metadata.db.query.QueryComponent#toQueryElement()
	 */
	@Override
	public Object toQueryElement() {
		return getName();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy