本文整理匯總了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 );
}
}