| /******************************************************************************* |
| * Copyright (c) 2009, 2019 Xored Software Inc and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.ecl.core.impl; |
| |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| import org.eclipse.rcptt.ecl.core.CorePackage; |
| import org.eclipse.rcptt.ecl.core.Serialized; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Serialized</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.ecl.core.impl.SerializedImpl#getBytes <em>Bytes</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SerializedImpl extends EObjectImpl implements Serialized { |
| /** |
| * The default value of the '{@link #getBytes() <em>Bytes</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBytes() |
| * @generated |
| * @ordered |
| */ |
| protected static final byte[] BYTES_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getBytes() <em>Bytes</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBytes() |
| * @generated |
| * @ordered |
| */ |
| protected byte[] bytes = BYTES_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SerializedImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CorePackage.Literals.SERIALIZED; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public byte[] getBytes() { |
| return bytes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setBytes(byte[] newBytes) { |
| byte[] oldBytes = bytes; |
| bytes = newBytes; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.SERIALIZED__BYTES, oldBytes, bytes)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case CorePackage.SERIALIZED__BYTES: |
| return getBytes(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case CorePackage.SERIALIZED__BYTES: |
| setBytes((byte[])newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case CorePackage.SERIALIZED__BYTES: |
| setBytes(BYTES_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case CorePackage.SERIALIZED__BYTES: |
| return BYTES_EDEFAULT == null ? bytes != null : !BYTES_EDEFAULT.equals(bytes); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (bytes: "); |
| result.append(bytes); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //SerializedImpl |