blob: 44f2b5470689abeb06749e4734e4516c62979730 [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.ecview.core.common.model.validation.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.osbp.ecview.core.common.model.validation.ValidationPackage;
import org.eclipse.osbp.ecview.core.common.model.validation.YMaxLengthValidationConfig;
import org.eclipse.osbp.ecview.core.common.model.validation.YMaxLengthValidator;
import org.eclipse.osbp.ecview.core.common.model.validation.YValidationConfig;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>YMax Length Validator</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.validation.impl.YMaxLengthValidatorImpl#getErrorCode <em>Error Code</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.validation.impl.YMaxLengthValidatorImpl#getDefaultErrorMessage <em>Default Error Message</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.validation.impl.YMaxLengthValidatorImpl#getMaxLength <em>Max Length</em>}</li>
* </ul>
*
* @generated
*/
public class YMaxLengthValidatorImpl extends YValidatorImpl implements YMaxLengthValidator {
/**
* The default value of the '{@link #getErrorCode() <em>Error Code</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getErrorCode()
* @generated
* @ordered
*/
protected static final String ERROR_CODE_EDEFAULT = null;
/**
* The cached value of the '{@link #getErrorCode() <em>Error Code</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getErrorCode()
* @generated
* @ordered
*/
protected String errorCode = ERROR_CODE_EDEFAULT;
/**
* The default value of the '{@link #getDefaultErrorMessage() <em>Default Error Message</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefaultErrorMessage()
* @generated
* @ordered
*/
protected static final String DEFAULT_ERROR_MESSAGE_EDEFAULT = null;
/**
* The cached value of the '{@link #getDefaultErrorMessage() <em>Default Error Message</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefaultErrorMessage()
* @generated
* @ordered
*/
protected String defaultErrorMessage = DEFAULT_ERROR_MESSAGE_EDEFAULT;
/**
* The default value of the '{@link #getMaxLength() <em>Max Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMaxLength()
* @generated
* @ordered
*/
protected static final int MAX_LENGTH_EDEFAULT = 0;
/**
* The cached value of the '{@link #getMaxLength() <em>Max Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMaxLength()
* @generated
* @ordered
*/
protected int maxLength = MAX_LENGTH_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected YMaxLengthValidatorImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ValidationPackage.Literals.YMAX_LENGTH_VALIDATOR;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getMaxLength() {
return maxLength;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMaxLength(int newMaxLength) {
int oldMaxLength = maxLength;
maxLength = newMaxLength;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ValidationPackage.YMAX_LENGTH_VALIDATOR__MAX_LENGTH, oldMaxLength, maxLength));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getErrorCode() {
return errorCode;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setErrorCode(String newErrorCode) {
String oldErrorCode = errorCode;
errorCode = newErrorCode;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ValidationPackage.YMAX_LENGTH_VALIDATOR__ERROR_CODE, oldErrorCode, errorCode));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDefaultErrorMessage() {
return defaultErrorMessage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDefaultErrorMessage(String newDefaultErrorMessage) {
String oldDefaultErrorMessage = defaultErrorMessage;
defaultErrorMessage = newDefaultErrorMessage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ValidationPackage.YMAX_LENGTH_VALIDATOR__DEFAULT_ERROR_MESSAGE, oldDefaultErrorMessage, defaultErrorMessage));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ValidationPackage.YMAX_LENGTH_VALIDATOR__ERROR_CODE:
return getErrorCode();
case ValidationPackage.YMAX_LENGTH_VALIDATOR__DEFAULT_ERROR_MESSAGE:
return getDefaultErrorMessage();
case ValidationPackage.YMAX_LENGTH_VALIDATOR__MAX_LENGTH:
return getMaxLength();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ValidationPackage.YMAX_LENGTH_VALIDATOR__ERROR_CODE:
setErrorCode((String)newValue);
return;
case ValidationPackage.YMAX_LENGTH_VALIDATOR__DEFAULT_ERROR_MESSAGE:
setDefaultErrorMessage((String)newValue);
return;
case ValidationPackage.YMAX_LENGTH_VALIDATOR__MAX_LENGTH:
setMaxLength((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ValidationPackage.YMAX_LENGTH_VALIDATOR__ERROR_CODE:
setErrorCode(ERROR_CODE_EDEFAULT);
return;
case ValidationPackage.YMAX_LENGTH_VALIDATOR__DEFAULT_ERROR_MESSAGE:
setDefaultErrorMessage(DEFAULT_ERROR_MESSAGE_EDEFAULT);
return;
case ValidationPackage.YMAX_LENGTH_VALIDATOR__MAX_LENGTH:
setMaxLength(MAX_LENGTH_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ValidationPackage.YMAX_LENGTH_VALIDATOR__ERROR_CODE:
return ERROR_CODE_EDEFAULT == null ? errorCode != null : !ERROR_CODE_EDEFAULT.equals(errorCode);
case ValidationPackage.YMAX_LENGTH_VALIDATOR__DEFAULT_ERROR_MESSAGE:
return DEFAULT_ERROR_MESSAGE_EDEFAULT == null ? defaultErrorMessage != null : !DEFAULT_ERROR_MESSAGE_EDEFAULT.equals(defaultErrorMessage);
case ValidationPackage.YMAX_LENGTH_VALIDATOR__MAX_LENGTH:
return maxLength != MAX_LENGTH_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == YValidationConfig.class) {
switch (derivedFeatureID) {
case ValidationPackage.YMAX_LENGTH_VALIDATOR__ERROR_CODE: return ValidationPackage.YVALIDATION_CONFIG__ERROR_CODE;
case ValidationPackage.YMAX_LENGTH_VALIDATOR__DEFAULT_ERROR_MESSAGE: return ValidationPackage.YVALIDATION_CONFIG__DEFAULT_ERROR_MESSAGE;
default: return -1;
}
}
if (baseClass == YMaxLengthValidationConfig.class) {
switch (derivedFeatureID) {
case ValidationPackage.YMAX_LENGTH_VALIDATOR__MAX_LENGTH: return ValidationPackage.YMAX_LENGTH_VALIDATION_CONFIG__MAX_LENGTH;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == YValidationConfig.class) {
switch (baseFeatureID) {
case ValidationPackage.YVALIDATION_CONFIG__ERROR_CODE: return ValidationPackage.YMAX_LENGTH_VALIDATOR__ERROR_CODE;
case ValidationPackage.YVALIDATION_CONFIG__DEFAULT_ERROR_MESSAGE: return ValidationPackage.YMAX_LENGTH_VALIDATOR__DEFAULT_ERROR_MESSAGE;
default: return -1;
}
}
if (baseClass == YMaxLengthValidationConfig.class) {
switch (baseFeatureID) {
case ValidationPackage.YMAX_LENGTH_VALIDATION_CONFIG__MAX_LENGTH: return ValidationPackage.YMAX_LENGTH_VALIDATOR__MAX_LENGTH;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (errorCode: ");
result.append(errorCode);
result.append(", defaultErrorMessage: ");
result.append(defaultErrorMessage);
result.append(", maxLength: ");
result.append(maxLength);
result.append(')');
return result.toString();
}
} //YMaxLengthValidatorImpl