当前位置: 首页>>代码示例>>Java>>正文


Java ETypeParameter类代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.ETypeParameter的典型用法代码示例。如果您正苦于以下问题:Java ETypeParameter类的具体用法?Java ETypeParameter怎么用?Java ETypeParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ETypeParameter类属于org.eclipse.emf.ecore包,在下文中一共展示了ETypeParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBoundGenericType

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
public EGenericType getBoundGenericType(EGenericType genericType, EClass context) {
	ETypeParameter typeParameter = genericType.getETypeParameter();
	if (typeParameter != null) {
		// the reference type is a type parameter
		TypeBindingAcceptor typeBindingAcceptor = new TypeBindingAcceptor();
		addTypeParameterBindingsRecursively(context, typeBindingAcceptor);
		return typeBindingAcceptor.getBoundGenericType(typeParameter);
	} else {
		// the reference type is a generic type
		if (genericType.getEClassifier() == null) {
			throw new IllegalStateException("Either typeParameter or eRawType must be set in EGenericType "
					+ genericType);
		}
		return genericType;
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:EcoreGenericsUtil.java

示例2: addTypeParameterBindingsRecursively

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
protected static void addTypeParameterBindingsRecursively(EClass context, TypeBindingAcceptor bindingAcceptor) {
	for (EGenericType genericSuperType : context.getEGenericSuperTypes()) {
		EClassifier rawSuperType = genericSuperType.getEClassifier();
		EList<EGenericType> typeArguments = genericSuperType.getETypeArguments();
		EList<ETypeParameter> typeParameters = rawSuperType.getETypeParameters();
		if (typeArguments.size() != typeParameters.size()) {
			throw new IllegalStateException(
					"Number of typeArguments does not match number of typeParameters in EGenericType "
							+ genericSuperType);
		}
		for (int i = 0; i < typeArguments.size(); ++i) {
			bindingAcceptor.accept(typeParameters.get(i), typeArguments.get(i));
		}
		if (rawSuperType instanceof EClass) {
			addTypeParameterBindingsRecursively((EClass) rawSuperType, bindingAcceptor);
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:EcoreGenericsUtil.java

示例3: accept

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
public void accept(ETypeParameter typeParameter, EGenericType typeArgument) {
	if(bindings==null) {
		bindings = new HashMap<ETypeParameter, EGenericType>();
	}
	ETypeParameter replacedParameter = typeArgument.getETypeParameter();
	if (replacedParameter != null) {
		EGenericType existingBoundType = bindings.get(replacedParameter);
		if (existingBoundType != null) {
			bindings.remove(replacedParameter);
			bindings.put(typeParameter, existingBoundType);
			return;
		}
	} else {
		if (typeArgument.getEClassifier() == null) {
			throw new IllegalStateException("Either typeParameter or eClassifier must be set in ETypeArgument "
					+ typeArgument);
		}
	}
	bindings.put(typeParameter, typeArgument);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:EcoreGenericsUtil.java

示例4: computeGenericTypes

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
public Object computeGenericTypes(final EClass c) {
  boolean _isEmpty = c.getETypeParameters().isEmpty();
  if (_isEmpty) {
    return "";
  }
  StringBuffer sb = new StringBuffer("<");
  String sep = "";
  EList<ETypeParameter> _eTypeParameters = c.getETypeParameters();
  for (final ETypeParameter pt : _eTypeParameters) {
    {
      sb.append(sep).append(pt.getName());
      sep = ",";
    }
  }
  sb.append(">");
  return sb;
}
 
开发者ID:opcoach,项目名称:genModelAddon,代码行数:18,代码来源:GenerateDevStructure.java

示例5: basicSetETypeParameter

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public NotificationChain basicSetETypeParameter(ETypeParameter newETypeParameter, NotificationChain msgs)
{
  ETypeParameter oldETypeParameter = eTypeParameter;
  eTypeParameter = newETypeParameter;
  if (eNotificationRequired())
  {
    ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EcorePackage.EGENERIC_TYPE__ETYPE_PARAMETER, oldETypeParameter, newETypeParameter);
    if (msgs == null) msgs = notification; else msgs.add(notification);
  }
  if (oldETypeParameter != newETypeParameter)
  {
    if (newETypeParameter != null)
    {
      msgs = setERawType(getErasure(newETypeParameter), msgs);
    }
    else 
    {
      msgs = setERawType(eClassifier, msgs);
    }
  }
  return msgs;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:28,代码来源:EGenericTypeImpl.java

示例6: getErasure

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
protected EClassifier getErasure(ETypeParameter eTypeParameter)
{
  if (eTypeParameter == null)
  {
    return null;
  }
  else
  {
    boolean needEClass = eContainer instanceof EClass || eContainer instanceof EReference;
    boolean needEDataType = !needEClass && eContainer instanceof EAttribute;
    for (EGenericType eBound : eTypeParameter.getEBounds())
    {
      EClassifier eRawType = eBound.getERawType();
      if (needEClass ? eRawType instanceof EClass : needEDataType ? eRawType instanceof EDataType : eRawType!= null)
      {
        return eRawType;
      }
    }
    return needEClass ? EcorePackage.Literals.EOBJECT : EcorePackage.Literals.EJAVA_OBJECT;
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:22,代码来源:EGenericTypeImpl.java

示例7: eSet

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case EcorePackage.EGENERIC_TYPE__EUPPER_BOUND:
      setEUpperBound((EGenericType)newValue);
      return;
    case EcorePackage.EGENERIC_TYPE__ETYPE_ARGUMENTS:
      getETypeArguments().clear();
      getETypeArguments().addAll((Collection<? extends EGenericType>)newValue);
      return;
    case EcorePackage.EGENERIC_TYPE__ELOWER_BOUND:
      setELowerBound((EGenericType)newValue);
      return;
    case EcorePackage.EGENERIC_TYPE__ETYPE_PARAMETER:
      setETypeParameter((ETypeParameter)newValue);
      return;
    case EcorePackage.EGENERIC_TYPE__ECLASSIFIER:
      setEClassifier((EClassifier)newValue);
      return;
  }
  eDynamicSet(featureID, newValue);
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:31,代码来源:EGenericTypeImpl.java

示例8: eUnset

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
  switch (featureID)
  {
    case EcorePackage.EGENERIC_TYPE__EUPPER_BOUND:
      setEUpperBound((EGenericType)null);
      return;
    case EcorePackage.EGENERIC_TYPE__ETYPE_ARGUMENTS:
      getETypeArguments().clear();
      return;
    case EcorePackage.EGENERIC_TYPE__ELOWER_BOUND:
      setELowerBound((EGenericType)null);
      return;
    case EcorePackage.EGENERIC_TYPE__ETYPE_PARAMETER:
      setETypeParameter((ETypeParameter)null);
      return;
    case EcorePackage.EGENERIC_TYPE__ECLASSIFIER:
      setEClassifier((EClassifier)null);
      return;
  }
  eDynamicUnset(featureID);
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:29,代码来源:EGenericTypeImpl.java

示例9: hasReifiedType

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
private static boolean hasReifiedType(Map<ETypeParameter, EGenericType> substitutions, EGenericType eGenericType)
{
  ETypeParameter eTypeParameter = eGenericType.getETypeParameter();
  if (eTypeParameter != null)
  {
    return substitutions.containsKey(eTypeParameter);
  }
  else
  {
    EList<EGenericType> eTypeArguments = eGenericType.getETypeArguments();
    if (!eTypeArguments.isEmpty())
    {
      for (EGenericType eTypeArgument : eTypeArguments)
      {
        if (hasReifiedType(substitutions, eTypeArgument))
        {
          return true;
        }
      }
      return false;
    }
    else
    {
      EGenericType eLowerBound = eGenericType.getELowerBound();
      if (eLowerBound != null)
      {
        return hasReifiedType(substitutions, eLowerBound);
      }
      else
      {
        EGenericType eUpperBound = eGenericType.getEUpperBound();
        return eUpperBound != null && hasReifiedType(substitutions, eUpperBound);
      }
    }
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:37,代码来源:EcoreUtil.java

示例10: setETypeParameter

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public void setETypeParameter(ETypeParameter newETypeParameter)
{
  if (newETypeParameter != eTypeParameter)
  {
    // Maintain a (weak hash) set on the type parameter of all referencing generic types.
    //
    if (eTypeParameter != null)
    {
      synchronized (eTypeParameter)
      {
        ((ETypeParameterImpl)eTypeParameter).getEGenericTypes().remove(this);
      }
    }
    if (newETypeParameter != null)
    {
      synchronized (newETypeParameter)
      {
        ((ETypeParameterImpl)newETypeParameter).getEGenericTypes().add(this);
      }
    }
    NotificationChain msgs = basicSetETypeParameter(newETypeParameter, null);
    if (msgs != null) 
    {
      msgs.dispatch();
    }
  }
  else if (eNotificationRequired())
  {
    eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EGENERIC_TYPE__ETYPE_PARAMETER, newETypeParameter, newETypeParameter));
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:37,代码来源:EGenericTypeImpl.java

示例11: getETypeParameters

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<ETypeParameter> getETypeParameters()
{
  if (eTypeParameters == null)
  {
    eTypeParameters = new EObjectContainmentEList.Resolving<ETypeParameter>(ETypeParameter.class, this, EcorePackage.EOPERATION__ETYPE_PARAMETERS);
  }
  return eTypeParameters;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:14,代码来源:EOperationImpl.java

示例12: addETypeParameter

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
protected ETypeParameter addETypeParameter(EClassifier owner, String name)
{
  ETypeParameter eTypeParameter = ecoreFactory.createETypeParameter();
  eTypeParameter.setName(name);
  owner.getETypeParameters().add(eTypeParameter);
  return eTypeParameter;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:8,代码来源:EPackageImpl.java

示例13: getETypeParameters

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<ETypeParameter> getETypeParameters()
{
  if (eTypeParameters == null)
  {
    eTypeParameters = new EObjectContainmentEList.Resolving<ETypeParameter>(ETypeParameter.class, this, EcorePackage.ECLASSIFIER__ETYPE_PARAMETERS);
  }
  return eTypeParameters;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:14,代码来源:EClassifierImpl.java

示例14: eSet

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case EcorePackage.ECLASSIFIER__EANNOTATIONS:
      getEAnnotations().clear();
      getEAnnotations().addAll((Collection<? extends EAnnotation>)newValue);
      return;
    case EcorePackage.ECLASSIFIER__NAME:
      setName((String)newValue);
      return;
    case EcorePackage.ECLASSIFIER__INSTANCE_CLASS_NAME:
      setInstanceClassName((String)newValue);
      return;
    case EcorePackage.ECLASSIFIER__INSTANCE_TYPE_NAME:
      setInstanceTypeName((String)newValue);
      return;
    case EcorePackage.ECLASSIFIER__ETYPE_PARAMETERS:
      getETypeParameters().clear();
      getETypeParameters().addAll((Collection<? extends ETypeParameter>)newValue);
      return;
  }
  eDynamicSet(featureID, newValue);
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:32,代码来源:EClassifierImpl.java

示例15: eSet

import org.eclipse.emf.ecore.ETypeParameter; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case EcorePackage.EENUM__EANNOTATIONS:
      getEAnnotations().clear();
      getEAnnotations().addAll((Collection<? extends EAnnotation>)newValue);
      return;
    case EcorePackage.EENUM__NAME:
      setName((String)newValue);
      return;
    case EcorePackage.EENUM__INSTANCE_CLASS_NAME:
      setInstanceClassName((String)newValue);
      return;
    case EcorePackage.EENUM__INSTANCE_TYPE_NAME:
      setInstanceTypeName((String)newValue);
      return;
    case EcorePackage.EENUM__ETYPE_PARAMETERS:
      getETypeParameters().clear();
      getETypeParameters().addAll((Collection<? extends ETypeParameter>)newValue);
      return;
    case EcorePackage.EENUM__SERIALIZABLE:
      setSerializable((Boolean)newValue);
      return;
    case EcorePackage.EENUM__ELITERALS:
      getELiterals().clear();
      getELiterals().addAll((Collection<? extends EEnumLiteral>)newValue);
      return;
  }
  eDynamicSet(featureID, newValue);
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:39,代码来源:EEnumImpl.java


注:本文中的org.eclipse.emf.ecore.ETypeParameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。