/*-
* ============LICENSE_START==========================================
* OPENECOMP - DCAE
* ===================================================================
* Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
*/
/**
*/
package org.openecomp.ncomp.docker.impl;
import org.openecomp.ncomp.core.impl.NamedEntityImpl;
import org.openecomp.ncomp.docker.ContainerPortBindings;
import org.openecomp.ncomp.docker.DockerPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
*
* An implementation of the model object 'Container Port Bindings'.
*
*
* The following features are implemented:
*
* - {@link org.openecomp.ncomp.docker.impl.ContainerPortBindingsImpl#getContainerPort Container Port}
* - {@link org.openecomp.ncomp.docker.impl.ContainerPortBindingsImpl#getProtocol Protocol}
* - {@link org.openecomp.ncomp.docker.impl.ContainerPortBindingsImpl#getVmPort Vm Port}
*
*
*
* @generated
*/
public class ContainerPortBindingsImpl extends NamedEntityImpl implements ContainerPortBindings {
/**
* The default value of the '{@link #getContainerPort() Container Port}' attribute.
*
*
* @see #getContainerPort()
* @generated
* @ordered
*/
protected static final int CONTAINER_PORT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getContainerPort() Container Port}' attribute.
*
*
* @see #getContainerPort()
* @generated
* @ordered
*/
protected int containerPort = CONTAINER_PORT_EDEFAULT;
/**
* The default value of the '{@link #getProtocol() Protocol}' attribute.
*
*
* @see #getProtocol()
* @generated
* @ordered
*/
protected static final String PROTOCOL_EDEFAULT = null;
/**
* The cached value of the '{@link #getProtocol() Protocol}' attribute.
*
*
* @see #getProtocol()
* @generated
* @ordered
*/
protected String protocol = PROTOCOL_EDEFAULT;
/**
* The default value of the '{@link #getVmPort() Vm Port}' attribute.
*
*
* @see #getVmPort()
* @generated
* @ordered
*/
protected static final int VM_PORT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getVmPort() Vm Port}' attribute.
*
*
* @see #getVmPort()
* @generated
* @ordered
*/
protected int vmPort = VM_PORT_EDEFAULT;
/**
*
*
* @generated
*/
protected ContainerPortBindingsImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return DockerPackage.Literals.CONTAINER_PORT_BINDINGS;
}
/**
*
*
* @generated
*/
public int getContainerPort() {
return containerPort;
}
/**
*
*
* @generated
*/
public void setContainerPort(int newContainerPort) {
int oldContainerPort = containerPort;
containerPort = newContainerPort;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DockerPackage.CONTAINER_PORT_BINDINGS__CONTAINER_PORT, oldContainerPort, containerPort));
}
/**
*
*
* @generated
*/
public String getProtocol() {
return protocol;
}
/**
*
*
* @generated
*/
public void setProtocol(String newProtocol) {
String oldProtocol = protocol;
protocol = newProtocol;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DockerPackage.CONTAINER_PORT_BINDINGS__PROTOCOL, oldProtocol, protocol));
}
/**
*
*
* @generated
*/
public int getVmPort() {
return vmPort;
}
/**
*
*
* @generated
*/
public void setVmPort(int newVmPort) {
int oldVmPort = vmPort;
vmPort = newVmPort;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DockerPackage.CONTAINER_PORT_BINDINGS__VM_PORT, oldVmPort, vmPort));
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case DockerPackage.CONTAINER_PORT_BINDINGS__CONTAINER_PORT:
return getContainerPort();
case DockerPackage.CONTAINER_PORT_BINDINGS__PROTOCOL:
return getProtocol();
case DockerPackage.CONTAINER_PORT_BINDINGS__VM_PORT:
return getVmPort();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DockerPackage.CONTAINER_PORT_BINDINGS__CONTAINER_PORT:
setContainerPort((Integer)newValue);
return;
case DockerPackage.CONTAINER_PORT_BINDINGS__PROTOCOL:
setProtocol((String)newValue);
return;
case DockerPackage.CONTAINER_PORT_BINDINGS__VM_PORT:
setVmPort((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DockerPackage.CONTAINER_PORT_BINDINGS__CONTAINER_PORT:
setContainerPort(CONTAINER_PORT_EDEFAULT);
return;
case DockerPackage.CONTAINER_PORT_BINDINGS__PROTOCOL:
setProtocol(PROTOCOL_EDEFAULT);
return;
case DockerPackage.CONTAINER_PORT_BINDINGS__VM_PORT:
setVmPort(VM_PORT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DockerPackage.CONTAINER_PORT_BINDINGS__CONTAINER_PORT:
return containerPort != CONTAINER_PORT_EDEFAULT;
case DockerPackage.CONTAINER_PORT_BINDINGS__PROTOCOL:
return PROTOCOL_EDEFAULT == null ? protocol != null : !PROTOCOL_EDEFAULT.equals(protocol);
case DockerPackage.CONTAINER_PORT_BINDINGS__VM_PORT:
return vmPort != VM_PORT_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (containerPort: ");
result.append(containerPort);
result.append(", protocol: ");
result.append(protocol);
result.append(", vmPort: ");
result.append(vmPort);
result.append(')');
return result.toString();
}
} //ContainerPortBindingsImpl