/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.jboss.tools.smooks.model.freemarker.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.jboss.tools.smooks.model.common.impl.AbstractAnyTypeImpl;
import org.jboss.tools.smooks.model.freemarker.FreemarkerPackage;
import org.jboss.tools.smooks.model.freemarker.Template;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Template</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.jboss.tools.smooks.model.freemarker.impl.TemplateImpl#getValue <em>Value</em>}</li>
* <li>{@link org.jboss.tools.smooks.model.freemarker.impl.TemplateImpl#getEncoding <em>Encoding</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class TemplateImpl extends AbstractAnyTypeImpl implements Template {
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
* The default value of the '{@link #getEncoding() <em>Encoding</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEncoding()
* @generated
* @ordered
*/
protected static final String ENCODING_EDEFAULT = "UTF-8"; //$NON-NLS-1$
/**
* The cached value of the '{@link #getEncoding() <em>Encoding</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEncoding()
* @generated
* @ordered
*/
protected String encoding = ENCODING_EDEFAULT;
/**
* This is true if the Encoding attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean encodingESet;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TemplateImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FreemarkerPackage.Literals.TEMPLATE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(String newValue) {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FreemarkerPackage.TEMPLATE__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getEncoding() {
return encoding;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEncoding(String newEncoding) {
String oldEncoding = encoding;
encoding = newEncoding;
boolean oldEncodingESet = encodingESet;
encodingESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FreemarkerPackage.TEMPLATE__ENCODING, oldEncoding, encoding, !oldEncodingESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetEncoding() {
String oldEncoding = encoding;
boolean oldEncodingESet = encodingESet;
encoding = ENCODING_EDEFAULT;
encodingESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, FreemarkerPackage.TEMPLATE__ENCODING, oldEncoding, ENCODING_EDEFAULT, oldEncodingESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetEncoding() {
return encodingESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FreemarkerPackage.TEMPLATE__VALUE:
return getValue();
case FreemarkerPackage.TEMPLATE__ENCODING:
return getEncoding();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FreemarkerPackage.TEMPLATE__VALUE:
setValue((String)newValue);
return;
case FreemarkerPackage.TEMPLATE__ENCODING:
setEncoding((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FreemarkerPackage.TEMPLATE__VALUE:
setValue(VALUE_EDEFAULT);
return;
case FreemarkerPackage.TEMPLATE__ENCODING:
unsetEncoding();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FreemarkerPackage.TEMPLATE__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
case FreemarkerPackage.TEMPLATE__ENCODING:
return isSetEncoding();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (value: "); //$NON-NLS-1$
result.append(value);
result.append(", encoding: "); //$NON-NLS-1$
if (encodingESet) result.append(encoding); else result.append("<unset>"); //$NON-NLS-1$
result.append(')');
return result.toString();
}
} //TemplateImpl