diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java deleted file mode 100644 index eb69e6457a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.utility.internal.StringTools; - -/** - * Gather together the common implementation behavior. - * T is the type of the object to be converted to and from an expression. - * - * We're still figuring out Java Generics here.... The methods in this abstract - * class work fine with any subclass of Expression E; but a ClassCastException - * will occur as soon as we call any method implemented by a subclass - * (e.g. StringExpressionConverter) that expects a particular subclass of - * Expression (e.g. StringLiteral). - */ -public abstract class AbstractExpressionConverter<T> - implements ExpressionConverter<T> -{ - - protected AbstractExpressionConverter() { - super(); - } - - - // ********** object -> expression ********** - - public Expression convert(T object, AST ast) { - return (object == null) ? this.convertNull(ast) : this.convertObject(object, ast); - } - - /** - * Return the expression for a null object. By default, a null object will - * be converted into a null expression. - */ - protected Expression convertNull(AST ast) { - return null; - } - - /** - * The specified object is not null. - * @see #convert(T, AST) - */ - protected abstract Expression convertObject(T object, AST ast); - - - // ********** expression -> object ********** - - public T convert(Expression expression) { - return (expression == null) ? this.convertNull() : this.convertExpression(expression); - } - - /** - * Return the object for a null expression. By default, a null expression will - * be converted into a null object. - */ - protected T convertNull() { - return null; - } - - /** - * The specified expression is not null. - * @see #convert(Expression) - */ - protected abstract T convertExpression(Expression expression); - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - -} |