本文整理汇总了Java中org.eclipse.emf.ecore.EStructuralFeature.getEAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java EStructuralFeature.getEAnnotation方法的具体用法?Java EStructuralFeature.getEAnnotation怎么用?Java EStructuralFeature.getEAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.ecore.EStructuralFeature
的用法示例。
在下文中一共展示了EStructuralFeature.getEAnnotation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processList
import org.eclipse.emf.ecore.EStructuralFeature; //导入方法依赖的package包/类
public void processList(IdEObject originObject, EStructuralFeature feature, Map<Integer, IdEObject> result) {
if (result.containsValue(feature)) {
return;
}
if (feature.getEType() instanceof EClass) {
EList<?> list = (EList<?>) originObject.eGet(feature);
for (Object o : list) {
if (o != null) {
IdEObject listObject = (IdEObject) o;
if (feature.getEAnnotation("twodimensionalarray") != null) {
processList(listObject, feature, result);
} else {
processObject(listObject, result);
}
}
}
}
}
示例2: buildUseForDatabaseStorage
import org.eclipse.emf.ecore.EStructuralFeature; //导入方法依赖的package包/类
private void buildUseForDatabaseStorage(EClass eClass) {
if (this.getSchemaDefinition() != null) {
HashSet<EStructuralFeature> set = new HashSet<>();
for (EStructuralFeature eStructuralFeature : eClass.getEAllStructuralFeatures()) {
EntityDefinition entityBN = this.getSchemaDefinition().getEntityBN(eClass.getName());
if (entityBN == null) {
set.add(eStructuralFeature);
} else {
if (!entityBN.isDerived(eStructuralFeature.getName())) {
boolean derived = false;
if (eStructuralFeature.getEAnnotation("hidden") != null) {
if (eStructuralFeature.getEAnnotation("asstring") == null) {
} else {
if (entityBN.isDerived(eStructuralFeature.getName().substring(0, eStructuralFeature.getName().length() - 8))) {
derived = true;
} else {
set.add(eStructuralFeature);
}
}
}
Attribute attribute = entityBN.getAttributeBNWithSuper(eStructuralFeature.getName());
if (attribute == null) {
// geometry, *AsString
if (!derived) {
set.add(eStructuralFeature);
}
} else {
if (attribute instanceof ExplicitAttribute || attribute instanceof InverseAttribute) {
if (!entityBN.isDerived(attribute.getName())) {
set.add(eStructuralFeature);
}
}
}
}
}
}
useForDatabaseStorage.put(eClass, set);
}
}
示例3: isInverse
import org.eclipse.emf.ecore.EStructuralFeature; //导入方法依赖的package包/类
protected boolean isInverse(EStructuralFeature eStructuralFeature) throws ObjectIDMException {
if (eStructuralFeature instanceof EReference && eStructuralFeature.getEContainingClass().getEAnnotation("wrapped") == null) {
if (eStructuralFeature.getEAnnotation("hidden") == null && eStructuralFeature.getEContainingClass().getEAnnotation("hidden") == null) {
EntityDefinition entityBN = packageMetaData.getSchemaDefinition().getEntityBN(eStructuralFeature.getEContainingClass().getName());
if (entityBN == null) {
throw new ObjectIDMException(eStructuralFeature.getEContainingClass().getName() + " not found");
}
Attribute attribute = entityBN.getAttributeBNWithSuper(eStructuralFeature.getName());
return attribute instanceof InverseAttribute;
} else {
return false;
}
}
return false;
}
示例4: write
import org.eclipse.emf.ecore.EStructuralFeature; //导入方法依赖的package包/类
private void write(VirtualObject object) throws SerializerException, IOException {
if (object.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 = packageMetaData.getUpperCase(object.eClass());
if (upperCase == null) {
throw new SerializerException("Type not found: " + object.eClass().getName());
}
print(upperCase);
print(OPEN_PAREN);
boolean isFirst = true;
EntityDefinition entityBN = getSchemaDefinition().getEntityBN(object.eClass().getName());
for (EStructuralFeature feature : object.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 (!packageMetaData.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);
}
示例5: write
import org.eclipse.emf.ecore.EStructuralFeature; //导入方法依赖的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);
}
示例6: encode
import org.eclipse.emf.ecore.EStructuralFeature; //导入方法依赖的package包/类
public static void encode ( final Map<String, String> data, final String prefix, final EObject object )
{
if ( object == null )
{
return;
}
for ( final EStructuralFeature sf : object.eClass ().getEAllStructuralFeatures () )
{
if ( sf.isMany () )
{
continue;
}
final EAnnotation an = sf.getEAnnotation ( "http://eclipse.org/SCADA/CA/Descriptor" ); //$NON-NLS-1$
if ( an == null )
{
continue;
}
final String name = an.getDetails ().get ( "name" ); //$NON-NLS-1$
if ( name == null )
{
continue;
}
final String format = an.getDetails ().get ( "format" ); //$NON-NLS-1$
String key;
String value;
if ( prefix != null )
{
key = prefix + "." + name;
}
else
{
key = name;
}
final Object v = object.eGet ( sf );
if ( v == null )
{
continue;
}
if ( format != null )
{
value = String.format ( format, v );
}
else
{
value = v == null ? null : v.toString ();
}
data.put ( key, value );
}
}