當前位置: 首頁>>代碼示例>>Java>>正文


Java EcoreUtil.copy方法代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.util.EcoreUtil.copy方法的典型用法代碼示例。如果您正苦於以下問題:Java EcoreUtil.copy方法的具體用法?Java EcoreUtil.copy怎麽用?Java EcoreUtil.copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.ecore.util.EcoreUtil的用法示例。


在下文中一共展示了EcoreUtil.copy方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createSelector

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
private static Selector createSelector ( final IPath path ) throws IOException
{
    final ResourceSet rs = new ResourceSetImpl ();
    final Resource r = rs.createResource ( URI.createFileURI ( path.toString () ) );
    r.load ( bundleResource ( path ), null );
    return EcoreUtil.copy ( (Selector)r.getContents ().get ( 0 ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:8,代碼來源:CreateProjectOperation.java

示例2: createPipeline

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
private static CustomizationPipeline createPipeline ( final IPath path ) throws IOException
{
    final ResourceSet rs = new ResourceSetImpl ();
    final Resource r = rs.createResource ( URI.createFileURI ( path.toString () ) );
    r.load ( bundleResource ( path ), null );
    return EcoreUtil.copy ( (CustomizationPipeline)r.getContents ().get ( 0 ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:8,代碼來源:CreateProjectOperation.java

示例3: build

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
public ModbusDataType build ()
{
    final ModbusDataType copy = EcoreUtil.copy ( this.dataType );
    if ( this.factor != null )
    {
        copy.setScale ( this.factor );
    }
    return copy;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:10,代碼來源:TypeBuilder.java

示例4: customize

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
@Override
public void customize ( final Item item )
{
    final LevelMonitor levelMonitor = EcoreUtil.copy ( this.template );
    levelMonitor.setName ( this.name );
    levelMonitor.setPreset ( this.value );
    registerFeature ( item, levelMonitor );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:9,代碼來源:DefaultFeatures.java

示例5: generateFor

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
private void generateFor ( final GenerationContext context, final MasterServer master )
{
    final org.eclipse.scada.configuration.world.osgi.MasterServer mapped = this.context.getEquinoxApplication ( master );
    final DataMapper result = EcoreUtil.copy ( this.service.getDataMapper () );
    mapped.getDataMapper ().add ( result );
    context.addMapping ( this.service, result );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:8,代碼來源:DataMapperServiceGenerator.java

示例6: convert

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
@SuppressWarnings ( "unchecked" )
private EObject convert ( final SingleValue v )
{
    final ExternalValue result = ComponentFactory.eINSTANCE.createExternalValue ();

    for ( final EStructuralFeature sf : ComponentPackage.Literals.SINGLE_VALUE.getEAllStructuralFeatures () )
    {
        final Object value = v.eGet ( sf, true );

        Object nv = value;

        if ( sf instanceof EReference )
        {
            if ( ( (EReference)sf ).isContainment () )
            {
                if ( sf.isMany () )
                {
                    nv = EcoreUtil.copyAll ( (Collection<EObject>)value );
                }
                else
                {
                    nv = EcoreUtil.copy ( (EObject)value );
                }
            }
        }

        result.eSet ( sf, nv );
    }

    return result;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:32,代碼來源:ConvertToExternalHandler.java

示例7: mergeMethod

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
private void mergeMethod(final Method resolvedMethod) {
    final Method existingMethod = resource.getMethod(resolvedMethod.getMethod());
    if (existingMethod == null) {
        if (resolvedMethod.isRequired()) {
            resource.getMethods().add(resolvedMethod);
            typedElementResolver.resolveAll(resolvedMethod);
        }
    } else {
        typedElementResolver.resolveAll(resolvedMethod);
        final EList<EAttribute> allAttributes = ResourcesPackage.Literals.METHOD.getEAllAttributes();
        final Consumer<EAttribute> copyAttribute = attribute -> existingMethod.eSet(attribute, resolvedMethod.eGet(attribute));
        allAttributes.stream()
                .filter(attribute -> !existingMethod.eIsSet(attribute))
                .filter(attribute -> resolvedMethod.eIsSet(attribute))
                .forEach(copyAttribute);
        final Consumer<EReference> copyReference = eReference -> {
            final Object value;
            if (eReference.isContainment()) {
                if (eReference.isMany()) {
                    value = EcoreUtil.copyAll((List) resolvedMethod.eGet(eReference));
                } else {
                    value = EcoreUtil.copy((EObject) resolvedMethod.eGet(eReference));
                }
            } else {
                value = resolvedMethod.eGet(eReference);
            }
            existingMethod.eSet(eReference, value);
        };
        ResourcesPackage.Literals.METHOD.getEAllReferences().stream()
                .filter(reference -> !existingMethod.eIsSet(reference))
                .filter(reference -> resolvedMethod.eIsSet(reference))
                .forEach(copyReference);
    }
}
 
開發者ID:vrapio,項目名稱:rest-modeling-framework,代碼行數:35,代碼來源:RamlModelBuilder.java

示例8: resolve

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
public Method resolve(final Trait trait) {
    for (final Header header : trait.getHeaders()) {
        final Header resolvedHeader = EcoreUtil.copy(header);
        typedElementResolver.resolveAll(resolvedHeader);
        method.getHeaders().add(resolvedHeader);
    }
    for (final QueryParameter queryParameter : trait.getQueryParameters()) {
        final QueryParameter resolvedQueryParameter = EcoreUtil.copy(queryParameter);
        typedElementResolver.resolveAll(resolvedQueryParameter);
        method.getQueryParameters().add(resolvedQueryParameter);
    }

    return method;
}
 
開發者ID:vrapio,項目名稱:rest-modeling-framework,代碼行數:15,代碼來源:RamlModelBuilder.java

示例9: LcDslLaunchConfigBuilder

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
public LcDslLaunchConfigBuilder(LaunchConfig template) {
    this.config = EcoreUtil.copy(template);
}
 
開發者ID:mduft,項目名稱:lcdsl,代碼行數:4,代碼來源:LcDslLaunchConfigBuilder.java

示例10: merge

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
/**
 * Merges the structural features from the {@code from} argument to the {@code to} argument.
 *
 * @param from
 *            the object to copy and merge the features from.
 * @param to
 *            the target of the merge operation.
 * @return the merged object.
 */
public EObject merge(final EObject from, final EObject to) {
	final EObject copy = EcoreUtil.copy(from);
	EcoreUtil.resolveAll(copy);
	return merge(copy, to, newHashSet());
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:EObjectFeatureMerger.java


注:本文中的org.eclipse.emf.ecore.util.EcoreUtil.copy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。