当前位置: 首页>>代码示例>>Java>>正文


Java EModelElement.getEAnnotation方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.EModelElement.getEAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java EModelElement.getEAnnotation方法的具体用法?Java EModelElement.getEAnnotation怎么用?Java EModelElement.getEAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.EModelElement的用法示例。


在下文中一共展示了EModelElement.getEAnnotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setDocumentation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static void setDocumentation(EModelElement eModelElement, String documentation)
{
  EAnnotation eAnnotation = eModelElement.getEAnnotation(GEN_MODEL_PACKAGE_NS_URI);
  if (documentation == null)
  {
    if (eAnnotation != null)
    {
      eAnnotation.getDetails().removeKey("documentation");
    }
  }
  else
  {
    if (eAnnotation == null)
    {
      eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
      eAnnotation.setSource(GEN_MODEL_PACKAGE_NS_URI);
      eModelElement.getEAnnotations().add(eAnnotation);
    }
    eAnnotation.getDetails().put("documentation", documentation);
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:22,代码来源:EcoreUtil.java

示例2: getConstraints

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static List<String> getConstraints(EModelElement eModelElement)
{
  EAnnotation eAnnotation = eModelElement.getEAnnotation(EcorePackage.eNS_URI);
  if (eAnnotation != null)
  {
    String constraints = eAnnotation.getDetails().get("constraints");
    if (constraints != null)
    {
      List<String> result = new ArrayList<String>();
      for (StringTokenizer stringTokenizer = new StringTokenizer(constraints); stringTokenizer.hasMoreTokens();)
      {
        String constraint = stringTokenizer.nextToken();
        result.add(constraint);
      }
      return result;
    }
  }
  return Collections.emptyList();
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:20,代码来源:EcoreUtil.java

示例3: setAnnotation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static void setAnnotation(EModelElement eModelElement, String sourceURI, String key, String value)
{
  EAnnotation eAnnotation = eModelElement.getEAnnotation(sourceURI);
  if (value == null)
  {
    if (eAnnotation != null)
    {
      eAnnotation.getDetails().removeKey(key);
    }
  }
  else 
  {
    if (eAnnotation == null)
    {
      eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
      eAnnotation.setSource(sourceURI);
      eModelElement.getEAnnotations().add(eAnnotation);
    }
    eAnnotation.getDetails().put(key, value);
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:22,代码来源:EcoreUtil.java

示例4: setDocumentation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static void setDocumentation(EModelElement eModelElement, String documentation)
{
  EAnnotation eAnnotation = eModelElement.getEAnnotation(GEN_MODEL_PACKAGE_NS_URI);
  if (documentation == null)
  {
    if (eAnnotation != null)
    {
      eAnnotation.getDetails().remove("documentation");
    }
  }
  else
  {
    if (eAnnotation == null)
    {
      eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
      eAnnotation.setSource(GEN_MODEL_PACKAGE_NS_URI);
      eModelElement.getEAnnotations().add(eAnnotation);
    }
    eAnnotation.getDetails().put("documentation", documentation);
  }
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:22,代码来源:EcoreUtil.java

示例5: appendDocumentation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
/**
 * keep appending to the documentation of the first model element
 * @param firstEl
 * @param secondEl
 */
private void appendDocumentation(EModelElement firstEl,EModelElement secondEl)
{
	EAnnotation firstAnn = firstEl.getEAnnotation(ModelUtil.genModelURI()); 
	String firstDoc = null;
	if (firstAnn != null) firstDoc = firstAnn.getDetails().get("documentation");

	EAnnotation secondAnn = secondEl.getEAnnotation(ModelUtil.genModelURI()); 
	String secondDoc = null;
	if (secondAnn != null) secondDoc = secondAnn.getDetails().get("documentation");

	// append documentation strings if they are both non-null
	String fullDoc = null;
	if (firstDoc == null) fullDoc = secondDoc;
	if (secondDoc == null) fullDoc = firstDoc;
	if ((firstDoc != null) && (secondDoc != null)) fullDoc = firstDoc + secondDoc;
	
	if (fullDoc != null) firstEl.getEAnnotation(ModelUtil.genModelURI()).getDetails().put("documentation",fullDoc);
	
}
 
开发者ID:openmapsoftware,项目名称:mappingtools,代码行数:25,代码来源:MergeModelsAction.java

示例6: addDocumentation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
/**
 * 
 * @param mappedEobject
 * @param docString
 */
private void addDocumentation(EModelElement mappedEobject,String docString)
{
	EAnnotation ann = mappedEobject.getEAnnotation(javaDocURI);

	// if this is the first documentation for this class or feature, add it with the preface defining the message
	if (ann == null)
	{
		ann = EcoreFactory.eINSTANCE.createEAnnotation();
		ann.setSource(javaDocURI);
		ann.getDetails().put(javaDocKey, docPreface() + docString);
		mappedEobject.getEAnnotations().add(ann);			
	}

	// append any subsequent documentation on the same class or feature
	else if (ann != null)
	{
		String previousDoc = ann.getDetails().get(javaDocKey);
		String newDoc = previousDoc + docString;
		ann.getDetails().put(javaDocKey, newDoc);
	}
}
 
开发者ID:openmapsoftware,项目名称:mappingtools,代码行数:27,代码来源:MakeITSMappingsAction.java

示例7: copyAnnotation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
/**
 * copy an ECore annotation from one object to another - 
 * maybe overwriting the values of existing annotations with the same 
 * source and the same key
 * @param toObject
 * @param note
 */
public static void copyAnnotation(EModelElement toObject, EAnnotation note)
{
	String source = note.getSource();

	// if the target does not have an annotation with this source, make one
	EAnnotation existing = toObject.getEAnnotation(source);
	if (existing == null)
	{
		existing = EcoreFactory.eINSTANCE.createEAnnotation();
		existing.setSource(source);
		toObject.getEAnnotations().add(existing);					
	}
	
	// transfer values for all keys, overwriting if values already exist
	for (Iterator<String> it = note.getDetails().keySet().iterator();it.hasNext();)
	{
		String key = it.next();
		existing.getDetails().put(key, note.getDetails().get(key));
	}
}
 
开发者ID:openmapsoftware,项目名称:mappingtools,代码行数:28,代码来源:ModelUtil.java

示例8: addAnnotation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static void addAnnotation(EModelElement eNamedElement, String source, String... details) {
	EAnnotation eAnnotation = eNamedElement.getEAnnotation(source);
	if (eAnnotation == null) {
		eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
		eAnnotation.setSource(source);
		eNamedElement.getEAnnotations().add(eAnnotation);
	}
	EMap<String, String> theDetails = eAnnotation.getDetails();
	for (int i = 1; i < details.length; i += 2) {
		theDetails.put(details[i - 1], details[i]);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:13,代码来源:EMFUtils.java

示例9: getAnnotation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static String getAnnotation(EModelElement eNamedElement, String source, String key) {
	if (eNamedElement != null) {
		EAnnotation annotation = eNamedElement.getEAnnotation(source);
		if (annotation != null) {
			return annotation.getDetails().get(key);
		}
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:10,代码来源:EMFUtils.java

示例10: getOclAnnotation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static EAnnotation getOclAnnotation(EModelElement c) {
	EAnnotation ann = c.getEAnnotation("http://www.eclipse.org/emf/2002/Ecore/OCL");
	if ( ann == null ) {                
		ann = c.getEAnnotation("http://www.eclipse.org/ocl/examples/OCL");
		if ( ann == null ) {                
			ann = c.getEAnnotation("http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot");
		}
	}
	return ann;
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:11,代码来源:MetamodelInvariantsExtension.java

示例11: setConstraints

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static void setConstraints(EModelElement eModelElement, List<String> constraints)
{
  EAnnotation eAnnotation = eModelElement.getEAnnotation(EcorePackage.eNS_URI);
  if (constraints == null || constraints.isEmpty())
  {
    if (eAnnotation != null)
    {
      eAnnotation.getDetails().removeKey("constraints");
    }
  }
  else
  {
    if (eAnnotation == null)
    {
      eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
      eAnnotation.setSource(EcorePackage.eNS_URI);
      eModelElement.getEAnnotations().add(eAnnotation);
    }
    StringBuffer value = new StringBuffer();
    for (Iterator<String> i = constraints.iterator(); i.hasNext();)
    {
      value.append(i.next());
      if (i.hasNext())
      {
        value.append(' ');
      }
    }
    eAnnotation.getDetails().put("constraints", value.toString());
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:31,代码来源:EcoreUtil.java

示例12: setConstraints

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static void setConstraints(EModelElement eModelElement, List<String> constraints)
{
  EAnnotation eAnnotation = eModelElement.getEAnnotation(EcorePackage.eNS_URI);
  if (constraints == null || constraints.isEmpty())
  {
    if (eAnnotation != null)
    {
      eAnnotation.getDetails().remove("constraints");
    }
  }
  else
  {
    if (eAnnotation == null)
    {
      eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
      eAnnotation.setSource(EcorePackage.eNS_URI);
      eModelElement.getEAnnotations().add(eAnnotation);
    }
    StringBuffer value = new StringBuffer();
    for (Iterator<String> i = constraints.iterator(); i.hasNext();)
    {
      value.append(i.next());
      if (i.hasNext())
      {
        value.append(' ');
      }
    }
    eAnnotation.getDetails().put("constraints", value.toString());
  }
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:31,代码来源:EcoreUtil.java

示例13: setAnnotation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
public static void setAnnotation(EModelElement eModelElement, String sourceURI, String key, String value)
{
  EAnnotation eAnnotation = eModelElement.getEAnnotation(sourceURI);
  if (eAnnotation == null)
  {
    eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
    eAnnotation.setSource(sourceURI);
    eModelElement.getEAnnotations().add(eAnnotation);
  }
  eAnnotation.getDetails().put(key, value);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:12,代码来源:EcoreUtil.java

示例14: addAnnotation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
protected void addAnnotation(EModelElement targetObject, String key, String value) {
	EAnnotation annotation = targetObject.getEAnnotation(ANNOTATION_SOURCE);
	if (annotation == null) {
		EcoreFactory factory = EcoreFactory.eINSTANCE;
		annotation = factory.createEAnnotation();
		annotation.setSource(ANNOTATION_SOURCE);
		targetObject.getEAnnotations().add(annotation);
	}
		
	annotation.getDetails().put(key, value);

}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:13,代码来源:DefaultTargetObjectCreator.java

示例15: addMicroITSAnnotation

import org.eclipse.emf.ecore.EModelElement; //导入方法依赖的package包/类
/**
 * 
 * @param toObj a Ecore model element to which an annotation is either to be added,
 * or extended with a new String key and value
 * @param key the key (new or possibly already existing)
 * @param value the new value for the key
 */
public static void addMicroITSAnnotation(EModelElement toObj, String key, String value)
{
	EAnnotation ann = toObj.getEAnnotation(microITSURI());
	if (ann == null)
	{
		ann = EcoreFactory.eINSTANCE.createEAnnotation();
		ann.setSource(microITSURI());
		toObj.getEAnnotations().add(ann);			
	}		
	ann.getDetails().put(key, value);
}
 
开发者ID:openmapsoftware,项目名称:mappingtools,代码行数:19,代码来源:FeatureView.java


注:本文中的org.eclipse.emf.ecore.EModelElement.getEAnnotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。