Java Code Examples for org.eclipse.emf.ecore.EAttribute#getDefaultValue()
The following examples show how to use
org.eclipse.emf.ecore.EAttribute#getDefaultValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstanceImpl.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * Get the value of an instance's attribute * * @param <V> * @param attribute * @return Value */ @SuppressWarnings("unchecked") private <V> V getAttributeValue(EAttribute attribute) { final Slot slot = getSlot(attribute); if (slot == null) { if (attribute.isMany()) { return (V) new UpdatingList(this, attribute); } else if (attribute.getEType().getInstanceClass() != null && Collection.class.isAssignableFrom(attribute.getEType().getInstanceClass())) {//Patch for Notation model return (V) new UpdatingList(this, attribute); } else if (attribute.getDefaultValue() != null) { return (V) attribute.getDefaultValue(); } return null; } final EList<Object> values = new UpdatingList(this, attribute, ((AttributeSlot) slot).getValues()); if (attribute.isMany()) { return (V) values; } else if (!values.isEmpty()) { return (V) values.get(0); } return null; }