blob: cb9ef37f7e4d71c9a468a3942eba0b963e12eaeb [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* 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:
* Pierre Allard,
* Regent L'Archeveque,
* Olivier L. Larouche - initial API and implementation
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.common.emf.impl;
import javax.measure.unit.Unit;
import org.eclipse.emf.ecore.EDataType;
public class ApogyCommonEMFFactoryCustomImpl extends ApogyCommonEMFFactoryImpl {
@Override
public Unit<?> createUnitFromString(EDataType eDataType, String initialValue) {
try {
Unit<?> unit = Unit.valueOf(initialValue);
return unit;
} catch (Throwable t) {
return null;
}
}
@Override
public String convertUnitToString(EDataType eDataType, Object instanceValue) {
Unit<?> unit = (Unit<?>) instanceValue;
return unit.toString();
}
} // ApogyCommonEMFFactoryImpl