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


Java EClass.getEAnnotation方法代码示例

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


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

示例1: findAnnotation

import org.eclipse.emf.ecore.EClass; //导入方法依赖的package包/类
/**
 * Finds the annotation even on supertypes
 * 
 * @param target
 *            the object to check
 * @return the annotation or <code>null</code> the object or its supertypes
 *         don't have the annotation
 */
public static EAnnotation findAnnotation ( final EObject target )
{
    EAnnotation annotation;

    annotation = target.eClass ().getEAnnotation ( SOURCE_NAME );
    if ( annotation != null )
    {
        logger.debug ( "Found direct annotation - target: {}, annotation: {}", target, annotation );
        return annotation;
    }

    for ( final EClass clazz : target.eClass ().getEAllSuperTypes () )
    {
        logger.debug ( "Checking supertype: {}", clazz );
        annotation = clazz.getEAnnotation ( SOURCE_NAME );
        if ( annotation != null )
        {
            logger.debug ( "Found annotation - target: {}, superclass: {}, annotation: {}", target, clazz, annotation );
            return annotation;
        }
    }
    logger.debug ( "Annotation on {} not found", target );
    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:33,代码来源:ExclusiveGroups.java

示例2: writeEClass

import org.eclipse.emf.ecore.EClass; //导入方法依赖的package包/类
private void writeEClass(VirtualObject object, EStructuralFeature feature) throws SerializerException, IOException {
	Object referencedObject = object.eGet(feature);
	if (referencedObject instanceof VirtualObject) {
		EClass referencedObjectEClass = ((VirtualObject) referencedObject).eClass();
		if (referencedObjectEClass.getEAnnotation("wrapped") != null) {
			writeWrappedValue(object, feature, referencedObjectEClass);
		}
	} else {
		if (referencedObject instanceof Long) {
			if (object.useFeatureForSerialization(feature)) {
				print(DASH);
				print(String.valueOf(getExpressId((Long) referencedObject)));
			} else {
				print(DOLLAR);
			}
		} else {
			EClass objectEClass = platformService.getEClassForCid(object.getEClassId());
			EntityDefinition entityBN = getSchemaDefinition().getEntityBN(objectEClass.getName());
			if (entityBN != null && entityBN.isDerived(feature.getName())) {
				print(ASTERISK);
			} else if (feature.isMany()) {
				writeList(object, feature);
			} else {
				writeObject(object, feature);
			}
		}
	}
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:29,代码来源:IfcStepStreamingSerializer.java

示例3: write

import org.eclipse.emf.ecore.EClass; //导入方法依赖的package包/类
private void write(IdEObject object) throws SerializerException, IOException {
	EClass eClass = object.eClass();
	if (eClass.getEAnnotation("hidden") != null) {
		return;
	}
	print(DASH);
	int convertedKey = getExpressId(object);
	if (convertedKey == -1) {
		throw new SerializerException("Going to serialize an object with id -1 (" + object.eClass().getName() + ")");
	}
	print(String.valueOf(convertedKey));
	print("= ");
	String upperCase = getPackageMetaData().getUpperCase(eClass);
	if (upperCase == null) {
		throw new SerializerException("Type not found: " + eClass.getName());
	}
	print(upperCase);
	print(OPEN_PAREN);
	boolean isFirst = true;
	EntityDefinition entityBN = getPackageMetaData().getSchemaDefinition().getEntityBN(object.eClass().getName());
	for (EStructuralFeature feature : eClass.getEAllStructuralFeatures()) {
		if (feature.getEAnnotation("hidden") == null && (entityBN != null && (!entityBN.isDerived(feature.getName()) || entityBN.isDerivedOverride(feature.getName())))) {
			EClassifier type = feature.getEType();
			if (type instanceof EEnum) {
				if (!isFirst) {
					print(COMMA);
				}
				writeEnum(object, feature);
				isFirst = false;
			} else if (type instanceof EClass) {
				EReference eReference = (EReference)feature;
				if (!getPackageMetaData().isInverse(eReference)) {
					if (!isFirst) {
						print(COMMA);
					}
					writeEClass(object, feature);
					isFirst = false;
				}
			} else if (type instanceof EDataType) {
				if (!isFirst) {
					print(COMMA);
				}
				writeEDataType(object, entityBN, feature);
				isFirst = false;
			}
		}
	}
	println(PAREN_CLOSE_SEMICOLON);
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:50,代码来源:IfcStepSerializer.java


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