blob: 13e2a1a230312a9f56f70ef8ce3201a8e68bd6a0 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008, 2018 Borland Software Corporation and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Borland Software Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.m2m.internal.qvt.oml.expressions.util;
import org.eclipse.ocl.parser.ValidationVisitor;
import org.eclipse.ocl.util.ToStringVisitor;
import org.eclipse.ocl.utilities.Visitor;
public class ForeignVisitorDefaultValue {
private ForeignVisitorDefaultValue() {
super();
}
@SuppressWarnings("unchecked")
public static <T> T getDefaultValueForVisitor(Visitor<T, ?, ?, ?, ?, ?, ?, ?, ?, ?> visitor) {
if(visitor != null) {
Class<?> visitorClass = visitor.getClass();
if(visitorClass == ValidationVisitor.class) {
return (T)Boolean.TRUE;
} else if(visitorClass == ToStringVisitor.class) {
return (T)""; //$NON-NLS-1$
}
}
return null;
}
}