blob: 7c3d4c368eeaa3a9f38936fba63327575c4a8939 [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 2007 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.library.edit.util;
import java.util.Iterator;
import org.eclipse.epf.uma.MethodElement;
import org.eclipse.epf.uma.Property;
import org.eclipse.epf.uma.UmaFactory;
/**
* @author Phong Nguyen Le
*
* @since 1.2
*/
public class MethodElementPropertyHelper {
public static final Property getProperty(MethodElement e, String propertyName) {
for (Iterator iter = e.getMethodElementProperty().iterator(); iter.hasNext();) {
Property prop = (Property) iter.next();
if(prop.getName().equals(propertyName)) {
return prop;
}
}
return null;
}
public static final void setProperty(MethodElement e, String propName, String propValue) {
Property prop = getProperty(e, propName);
if(prop == null) {
prop = UmaFactory.eINSTANCE.createProperty();
prop.setName(propName);
}
prop.setValue(propValue);
}
public static final void setProperty(MethodElement e, String propName, boolean b) {
setProperty(e, propName, String.valueOf(b));
}
}