Java Code Examples for org.eclipse.emf.ecore.EDataType

The following examples show how to use org.eclipse.emf.ecore.EDataType. These examples are extracted from open source projects. 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 Project: xtext-core   Source File: Xtext2EcoreTransformer.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private void addSuperType(ParserRule rule, TypeRef subTypeRef, EClassifierInfo superTypeInfo) throws TransformationException {
	final EClassifier subType = subTypeRef.getClassifier();
	final EClassifierInfo subTypeInfo = subType == null
	        ? findOrCreateEClassifierInfo(subTypeRef, null, true)
			: eClassifierInfos.getInfoOrNull(subType);
	if (subTypeInfo == null)
		throw new TransformationException(TransformationErrorCode.NoSuchTypeAvailable, "Type '"
				+ superTypeInfo.getEClassifier().getName() + "' is not available.", rule.getType());
	if (superTypeInfo.isAssignableFrom(subTypeInfo))
		return;
	if (subTypeInfo.getEClassifier() instanceof EDataType)
		throw new TransformationException(TransformationErrorCode.InvalidSupertype, "Cannot add supertype '"
				+ superTypeInfo.getEClassifier().getName() + "' to simple datatype '"
				+ subTypeInfo.getEClassifier().getName() + "'.", rule.getType());
	if (!subTypeInfo.isGenerated())
		throw new TransformationException(TransformationErrorCode.CannotCreateTypeInSealedMetamodel,
				"Cannot add supertype '" + superTypeInfo.getEClassifier().getName() + "' to sealed type '"
						+ subTypeInfo.getEClassifier().getName() + "'.", rule.getType());
	subTypeInfo.addSupertype(superTypeInfo);
}
 
Example 2
Source Project: birt   Source File: AttributeFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public ActionType createActionTypeObjectFromString( EDataType eDataType,
		String initialValue )
{
	return createActionTypeFromString( AttributePackage.Literals.ACTION_TYPE,
			initialValue );
}
 
Example 3
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String convertToString(EDataType eDataType, Object instanceValue)
{
  switch (eDataType.getClassifierID())
  {
    case Bug348427TestLanguagePackage.ENUM_TYPE:
      return convertEnumTypeToString(eDataType, instanceValue);
    default:
      throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
  }
}
 
Example 4
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object createFromString(EDataType eDataType, String initialValue)
{
  switch (eDataType.getClassifierID())
  {
    case Bug289187TestLanguagePackage.VISIBILITY:
      return createVisibilityFromString(eDataType, initialValue);
    default:
      throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
  }
}
 
Example 5
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object createFromString(EDataType eDataType, String initialValue)
{
  switch (eDataType.getClassifierID())
  {
    case MultiRuleenumsPackage.MY_ENUM:
      return createMyEnumFromString(eDataType, initialValue);
    default:
      throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
  }
}
 
Example 6
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String convertToString(EDataType eDataType, Object instanceValue)
{
  switch (eDataType.getClassifierID())
  {
    case EnumRulesTestLanguagePackage.GENERATED_ENUM:
      return convertGeneratedEnumToString(eDataType, instanceValue);
    default:
      throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
  }
}
 
Example 7
Source Project: birt   Source File: LayoutFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String convertTitlePercentTypeObjectToString( EDataType eDataType,
		Object instanceValue )
{
	return convertTitlePercentTypeToString( LayoutPackage.Literals.TITLE_PERCENT_TYPE,
			instanceValue );
}
 
Example 8
Source Project: birt   Source File: AttributeFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public ChartType createChartTypeObjectFromString( EDataType eDataType,
		String initialValue )
{
	return createChartTypeFromString( AttributePackage.Literals.CHART_TYPE,
			initialValue );
}
 
Example 9
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Enum1 createEnum1FromString(EDataType eDataType, String initialValue)
{
  Enum1 result = Enum1.get(initialValue);
  if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
  return result;
}
 
Example 10
Source Project: xtext-core   Source File: EnumsFactoryImpl.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object createFromString(EDataType eDataType, String initialValue) {
	switch (eDataType.getClassifierID()) {
		case EnumsPackage.EXISTING_ENUM:
			return createExistingEnumFromString(eDataType, initialValue);
		default:
			throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
	}
}
 
Example 11
Source Project: xtext-core   Source File: RootFactoryImpl.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public RootEnum createRootEnumFromString(EDataType eDataType, String initialValue)
{
	RootEnum result = RootEnum.get(initialValue);
	if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
	return result;
}
 
Example 12
Source Project: neoscada   Source File: ConfigurationFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public VariantTypeType createVariantTypeTypeFromString ( EDataType eDataType, String initialValue )
{
    VariantTypeType result = VariantTypeType.get ( initialValue );
    if ( result == null )
        throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName () + "'" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    return result;
}
 
Example 13
Source Project: birt   Source File: ModelFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String convertToString( EDataType eDataType, Object instanceValue )
{
	switch ( eDataType.getClassifierID( ) )
	{
		case ModelPackage.COVERAGE_TYPE :
			return convertCoverageTypeToString( eDataType, instanceValue );
		case ModelPackage.COVERAGE_TYPE_OBJECT :
			return convertCoverageTypeObjectToString( eDataType,
					instanceValue );
		default :
			throw new IllegalArgumentException( "The datatype '" + eDataType.getName( ) + "' is not a valid classifier" ); //$NON-NLS-1$ //$NON-NLS-2$
	}
}
 
Example 14
Source Project: neoscada   Source File: ProtocolFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Type createTypeFromString ( EDataType eDataType, String initialValue )
{
    Type result = Type.get ( initialValue );
    if ( result == null )
        throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName () + "'" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    return result;
}
 
Example 15
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String convertToString(EDataType eDataType, Object instanceValue)
{
  switch (eDataType.getClassifierID())
  {
    case EnumAndReferenceTestLanguagePackage.KIND_OF_KEYWORD:
      return convertKindOfKeywordToString(eDataType, instanceValue);
    default:
      throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
  }
}
 
Example 16
Source Project: openhab1-addons   Source File: ModelFactoryImpl.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public LaserRangeFinderSubIds createLaserRangeFinderSubIdsFromString(EDataType eDataType, String initialValue) {
    LaserRangeFinderSubIds result = LaserRangeFinderSubIds.get(initialValue);
    if (result == null)
        throw new IllegalArgumentException(
                "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
    return result;
}
 
Example 17
Source Project: birt   Source File: AttributeFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public UnitsOfMeasurement createUnitsOfMeasurementObjectFromString(
		EDataType eDataType, String initialValue )
{
	return createUnitsOfMeasurementFromString( AttributePackage.Literals.UNITS_OF_MEASUREMENT,
			initialValue );
}
 
Example 18
Source Project: fixflow   Source File: Bpmn2FactoryImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EventBasedGatewayType createEventBasedGatewayTypeFromString(EDataType eDataType,
        String initialValue) {
    EventBasedGatewayType result = EventBasedGatewayType.get(initialValue);
    if (result == null)
        throw new IllegalArgumentException("The value '" + initialValue
                + "' is not a valid enumerator of '" + eDataType.getName() + "'");
    return result;
}
 
Example 19
Source Project: openhab1-addons   Source File: ModelFactoryImpl.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public TemperatureIRSubIds createTemperatureIRSubIdsFromString(EDataType eDataType, String initialValue) {
    TemperatureIRSubIds result = TemperatureIRSubIds.get(initialValue);
    if (result == null)
        throw new IllegalArgumentException(
                "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
    return result;
}
 
Example 20
Source Project: birt   Source File: LayoutFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Integer createEllipsisTypeObjectFromString( EDataType eDataType,
		String initialValue )
{
	return createEllipsisTypeFromString( LayoutPackage.Literals.ELLIPSIS_TYPE,
			initialValue );
}
 
Example 21
Source Project: birt   Source File: AttributeFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public VerticalAlignment createVerticalAlignmentFromString(
		EDataType eDataType, String initialValue )
{
	VerticalAlignment result = VerticalAlignment.get( initialValue );
	if ( result == null )
		throw new IllegalArgumentException( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName( ) + "'" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	return result;
}
 
Example 22
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String convertToString(EDataType eDataType, Object instanceValue)
{
  switch (eDataType.getClassifierID())
  {
    case Bug360834TestLanguagePackage.VISIBILITY:
      return convertVisibilityToString(eDataType, instanceValue);
    default:
      throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
  }
}
 
Example 23
Source Project: neoscada   Source File: OsgiFactoryImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public MovingAverageReferenceType createMovingAverageReferenceTypeFromString ( EDataType eDataType, String initialValue )
{
    MovingAverageReferenceType result = MovingAverageReferenceType.get ( initialValue );
    if ( result == null )
        throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName () + "'" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    return result;
}
 
Example 24
Source Project: xtext-core   Source File: Ecore2XtextExtensions.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public static boolean isBoolean(final EClassifier it) {
  return (((it instanceof EDataType) && CollectionLiterals.<String>newArrayList("EBoolean", "EBooleanObject").contains(it.getName())) && Ecore2XtextExtensions.isEcoreType(it));
}
 
Example 25
Source Project: birt   Source File: AttributePackageImpl.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public EDataType getRuleTypeObject( )
{
	return ruleTypeObjectEDataType;
}
 
Example 26
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public TypeType3 createTypeType3FromString(EDataType eDataType, String initialValue) {
	TypeType3 result = TypeType3.get(initialValue);
	if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
	return result;
}
 
Example 27
Source Project: xtext-core   Source File: EFactoryValueConverter.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public EFactoryValueConverter(EDataType dataType) {
	this.dataType = dataType;
}
 
Example 28
Source Project: n4js   Source File: TypesFactoryImpl.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public MemberType createMemberTypeFromString(EDataType eDataType, String initialValue) {
	MemberType result = MemberType.get(initialValue);
	if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
	return result;
}
 
Example 29
Source Project: elexis-3-core   Source File: ModelFactoryImpl.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public DataType createDataTypeFromString(EDataType eDataType, String initialValue) {
	DataType result = DataType.get(initialValue);
	if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
	return result;
}
 
Example 30
Source Project: eip-designer   Source File: EipFactoryImpl.java    License: Apache License 2.0 4 votes vote down vote up
/**
   * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
   * @generated
   */
public MessagePart createMessagePartFromString(EDataType eDataType, String initialValue) {
     MessagePart result = MessagePart.get(initialValue);
     if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
     return result;
  }