blob: d17e4b7c474c69cd6b0cc86f7f5f1631497585f5 [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 2006 IBM Corporation and others.
// 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:
// IBM Corporation - initial implementation
//------------------------------------------------------------------------------
package org.eclipse.epf.uma.ecore.util;
import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Phong Nguyen Le
* @since 1.0
*/
public class OppositeFeature {
private String name;
private EStructuralFeature targetFeature;
private boolean isMany;
private boolean resolveOwner = true;
private Class ownerClass;
/**
* Creates a new instance.
*
* @param name
* @param targetFeature
* @param isMany
*/
public OppositeFeature(Class ownerClass, String name,
EStructuralFeature targetFeature, boolean isMany) {
this(ownerClass, name, targetFeature, isMany, true);
}
public OppositeFeature(Class ownerClass, String name,
EStructuralFeature targetFeature, boolean isMany,
boolean resolveOwner) {
this.ownerClass = ownerClass;
this.name = name;
this.targetFeature = targetFeature;
this.isMany = isMany;
this.resolveOwner = resolveOwner;
}
public Class getOwnerClass() {
return ownerClass;
}
/**
* @return Returns the isMany.
*/
public boolean isMany() {
return isMany;
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @return Returns the targetFeature.
*/
public EStructuralFeature getTargetFeature() {
return targetFeature;
}
public int getFeatureID() {
return -1 - targetFeature.getFeatureID();
}
public boolean resolveOwner() {
return resolveOwner;
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return new StringBuffer(name)
.append(
": targetFeature=" + targetFeature + "; isMany=" + isMany).toString(); //$NON-NLS-1$ //$NON-NLS-2$
}
}