/** Initialize the type parameter. * <p>Caution: This initialization function does not add the type parameter in its container. * The container is responsible of adding the type parameter in its internal object. * @param name the name of the type parameter. * @param typeContext the provider of types or null. */ public void eInit(EObject context, String name, IJvmTypeProvider typeContext) { setTypeResolutionContext(typeContext); this.context = context; this.parameter = this.jvmTypesFactory.createJvmTypeParameter(); this.parameter.setName(name); }
protected JvmTypeParameter createTypeParameter(TypeVariable<?> variable, JvmMember container) { JvmTypeParameter result = TypesFactory.eINSTANCE.createJvmTypeParameter(); result.setName(variable.getName()); Type[] bounds = variable.getBounds(); if (bounds.length != 0) { InternalEList<JvmTypeConstraint> constraints = (InternalEList<JvmTypeConstraint>)result.getConstraints(); for (Type bound : variable.getBounds()) { JvmUpperBound upperBound = TypesFactory.eINSTANCE.createJvmUpperBound(); ((JvmTypeConstraintImplCustom) upperBound).internalSetTypeReference(createTypeReference(bound)); constraints.addUnique(upperBound); } } return result; }
protected JvmTypeParameter createTypeParameter(TypeVariable<?> variable, JvmMember container) { JvmTypeParameter result = TypesFactory.eINSTANCE.createJvmTypeParameter(); result.setName(variable.getName()); Type[] bounds = variable.getBounds(); if (bounds.length != 0) { InternalEList<JvmTypeConstraint> constraints = (InternalEList<JvmTypeConstraint>)result.getConstraints(); for (Type bound : variable.getBounds()) { JvmUpperBound upperBound = TypesFactory.eINSTANCE.createJvmUpperBound(); ((JvmTypeConstraintImplCustom) upperBound).internalSetTypeReference(createTypeReference(bound)); constraints.addUnique(upperBound); } } return result; }
.getTypeParameters(); for (int i = 0; i < typeParameters.size(); i++) { JvmTypeParameter typeParameter = TypesFactory.eINSTANCE.createJvmTypeParameter(); String name = typeParameters.get(i).getName(); typeParameter.setName(name);
.getTypeParameters(); for (int i = 0; i < typeParameters.size(); i++) { JvmTypeParameter typeParameter = TypesFactory.eINSTANCE.createJvmTypeParameter(); String name = typeParameters.get(i).getName(); typeParameter.setName(name);
final JvmTypeParameter typeParameterCopy = jvmTypesFactory.createJvmTypeParameter(); typeParameterCopy.setName(typeParameter.getName()); outputParameters.add(typeParameterCopy);
for (final TypeParameter typeParam : type.typeParameters) { final JvmTypeParameter jvmTypeParam = TypesFactory.eINSTANCE.createJvmTypeParameter(); jvmTypeParam.setName(String.valueOf(typeParam.name)); EList<JvmTypeParameter> _typeParameters = ((JvmGenericType)jvmType).getTypeParameters();
public MutableTypeParameterDeclaration addTypeParameter(final String name, final TypeReference... upperBounds) { this.checkMutable(); ConditionUtils.checkJavaIdentifier(name, "name"); ConditionUtils.checkIterable(((Iterable<?>)Conversions.doWrapArray(upperBounds)), "upperBounds"); ConditionUtils.checkInferredTypeReferences("parameter type", upperBounds); final JvmTypeParameter param = TypesFactory.eINSTANCE.createJvmTypeParameter(); param.setName(name); this.getDelegate().getTypeParameters().add(param); for (final TypeReference upper : upperBounds) { { final JvmTypeReference typeRef = this.getCompilationUnit().toJvmTypeReference(upper); final JvmUpperBound jvmUpperBound = TypesFactory.eINSTANCE.createJvmUpperBound(); jvmUpperBound.setTypeReference(typeRef); param.getConstraints().add(jvmUpperBound); } } TypeParameterDeclaration _typeParameterDeclaration = this.getCompilationUnit().toTypeParameterDeclaration(param); return ((MutableTypeParameterDeclaration) _typeParameterDeclaration); }
@Override public MutableTypeParameterDeclaration addTypeParameter(final String name, final TypeReference... upperBounds) { this.checkMutable(); ConditionUtils.checkJavaIdentifier(name, "name"); ConditionUtils.checkIterable(((Iterable<?>)Conversions.doWrapArray(upperBounds)), "upperBounds"); ConditionUtils.checkInferredTypeReferences("parameter type", upperBounds); final JvmTypeParameter param = TypesFactory.eINSTANCE.createJvmTypeParameter(); param.setName(name); this.getDelegate().getTypeParameters().add(param); for (final TypeReference upper : upperBounds) { { final JvmTypeReference typeRef = this.getCompilationUnit().toJvmTypeReference(upper); final JvmUpperBound jvmUpperBound = TypesFactory.eINSTANCE.createJvmUpperBound(); jvmUpperBound.setTypeReference(typeRef); param.getConstraints().add(jvmUpperBound); } } TypeParameterDeclaration _typeParameterDeclaration = this.getCompilationUnit().toTypeParameterDeclaration(param); return ((MutableTypeParameterDeclaration) _typeParameterDeclaration); } }
@Override public MutableTypeParameterDeclaration addTypeParameter(final String name, final TypeReference... upperBounds) { this.checkMutable(); ConditionUtils.checkJavaIdentifier(name, "name"); ConditionUtils.checkIterable(((Iterable<?>)Conversions.doWrapArray(upperBounds)), "upperBounds"); ConditionUtils.checkInferredTypeReferences("parameter type", upperBounds); final JvmTypeParameter param = TypesFactory.eINSTANCE.createJvmTypeParameter(); param.setName(name); this.getDelegate().getTypeParameters().add(param); for (final TypeReference upper : upperBounds) { { final JvmTypeReference typeRef = this.getCompilationUnit().toJvmTypeReference(upper); final JvmUpperBound jvmUpperBound = TypesFactory.eINSTANCE.createJvmUpperBound(); jvmUpperBound.setTypeReference(typeRef); param.getConstraints().add(jvmUpperBound); } } TypeParameterDeclaration _typeParameterDeclaration = this.getCompilationUnit().toTypeParameterDeclaration(param); return ((MutableTypeParameterDeclaration) _typeParameterDeclaration); } }
final JvmTypeParameter typeParameter = this.typesFactory.createJvmTypeParameter(); typeParameter.setName("C"); //$NON-NLS-1$ final JvmUpperBound constraint = this.typesFactory.createJvmUpperBound();