/** * Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments. * * @param type * the type the reference shall point to. * @param typeArgs * type arguments * @return the newly created {@link JvmTypeReference} * * @deprecated use {@link JvmTypeReferenceBuilder#typeRef(JvmType, JvmTypeReference...)} */ @Deprecated public JvmTypeReference newTypeRef(JvmType type, JvmTypeReference... typeArgs) { return references.createTypeRef(type, typeArgs); }
public JvmTypeReference getTypeForName(Class<?> clazz, Notifier context, JvmTypeReference... params) { if (clazz == null) throw new NullPointerException("clazz"); JvmType declaredType = findDeclaredType(clazz, context); if (declaredType == null) return getUnknownTypeReference(clazz.getName()); JvmParameterizedTypeReference result = createTypeRef(declaredType, params); return result; }
public JvmTypeReference getTypeForName(Class<?> clazz, Notifier context, JvmTypeReference... params) { if (clazz == null) throw new NullPointerException("clazz"); JvmType declaredType = findDeclaredType(clazz, context); if (declaredType == null) return getUnknownTypeReference(clazz.getName()); JvmParameterizedTypeReference result = createTypeRef(declaredType, params); return result; }
public JvmTypeReference getTypeForName(String typeName, Notifier context, JvmTypeReference... params) { if (typeName == null) throw new NullPointerException("typeName"); JvmType declaredType = findDeclaredType(typeName, context); if (declaredType == null) return getUnknownTypeReference(typeName); JvmParameterizedTypeReference result = createTypeRef(declaredType, params); return result; }
public JvmTypeReference getTypeForName(String typeName, Notifier context, JvmTypeReference... params) { if (typeName == null) throw new NullPointerException("typeName"); JvmType declaredType = findDeclaredType(typeName, context); if (declaredType == null) return getUnknownTypeReference(typeName); JvmParameterizedTypeReference result = createTypeRef(declaredType, params); return result; }
typeReferences = Lists.newArrayListWithCapacity(list.size()); for (JvmTypeParameter typeParameter : list) { typeReferences.add(createTypeRef(typeParameter));
public JvmTypeReference asWrapperTypeIfPrimitive(JvmTypeReference primitive) { if (primitive == null || !isPrimitive(primitive)) { return primitive; } final JvmType wrapperType = getWrapperType((JvmPrimitiveType) primitive.getType()); if (wrapperType == null) return primitive; return typeReferences.createTypeRef(wrapperType); }
public JvmTypeReference asWrapperTypeIfPrimitive(JvmTypeReference primitive) { if (primitive == null || !isPrimitive(primitive)) { return primitive; } final JvmType wrapperType = getWrapperType((JvmPrimitiveType) primitive.getType()); if (wrapperType == null) return primitive; return typeReferences.createTypeRef(wrapperType); }
public JvmTypeReference getArgument(JvmTypeReference left, int index) { if (left.getType() instanceof JvmGenericType) { List<JvmTypeParameter> typeParameters = ((JvmGenericType) left.getType()).getTypeParameters(); if (typeParameters.size() <= index) { throw new IllegalArgumentException("The type " + left.getType().getIdentifier() + " cannot be parameterized with more than " + typeParameters.size() + " type arguments."); } if (left instanceof JvmParameterizedTypeReference) { List<JvmTypeReference> arguments = ((JvmParameterizedTypeReference) left).getArguments(); if (arguments.size() == typeParameters.size()) { return arguments.get(index); } } final JvmTypeParameter jvmTypeParameter = typeParameters.get(index); return createTypeRef(jvmTypeParameter); } throw new IllegalArgumentException(left.getType().getIdentifier() + " is not generic."); }
public JvmTypeReference getArgument(JvmTypeReference left, int index) { if (left.getType() instanceof JvmGenericType) { List<JvmTypeParameter> typeParameters = ((JvmGenericType) left.getType()).getTypeParameters(); if (typeParameters.size() <= index) { throw new IllegalArgumentException("The type " + left.getType().getIdentifier() + " cannot be parameterized with more than " + typeParameters.size() + " type arguments."); } if (left instanceof JvmParameterizedTypeReference) { List<JvmTypeReference> arguments = ((JvmParameterizedTypeReference) left).getArguments(); if (arguments.size() == typeParameters.size()) { return arguments.get(index); } } final JvmTypeParameter jvmTypeParameter = typeParameters.get(index); return createTypeRef(jvmTypeParameter); } throw new IllegalArgumentException(left.getType().getIdentifier() + " is not generic."); }
typeReferences = Lists.newArrayListWithCapacity(list.size()); for (JvmTypeParameter typeParameter : list) { typeReferences.add(createTypeRef(typeParameter)); JvmParameterizedTypeReference outer = createTypeRef((JvmType)casted.eContainer()); reference = factory.createJvmInnerTypeReference(); ((JvmInnerTypeReference) reference).setOuter(outer);
protected void completeJvmEnumerationLiteral(JvmEnumerationLiteral element) { if (element.getType() == null) { element.setType(references.createTypeRef(element.getDeclaringType())); } element.setStatic(true); }
private JvmTypeReference innerFindType(Notifier context, String typeName) { final IJvmTypeProvider provider = getTypeResolutionContext(); JvmType type = null; if (provider != null) { type = provider.findTypeByName(typeName); } TypeReferences typeRefs = getTypeReferences(); if (type == null) { type = typeRefs.findDeclaredType(typeName, context); } if (type == null) { return null; } return typeRefs.createTypeRef(type); }
@Override public void apply(final JvmGenericType it) { EmfParsleyDslJvmModelInferrer.this.setSuperClassTypeAndFields(it, proposalCreator, ProposalCreator.class); EList<FeatureAssociatedExpression> _proposalsSpecifications = proposalCreator.getProposalsSpecifications(); for (final FeatureAssociatedExpression specification : _proposalsSpecifications) { final Procedure2<JvmOperation, FeatureAssociatedExpression> _function = new Procedure2<JvmOperation, FeatureAssociatedExpression>() { @Override public void apply(final JvmOperation it, final FeatureAssociatedExpression spec) { EList<JvmFormalParameter> _parameters = it.getParameters(); JvmFormalParameter _parameter = EmfParsleyDslJvmModelInferrer.this._jvmTypesBuilder.toParameter(spec, "it", spec.getParameterType()); EmfParsleyDslJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); EList<JvmFormalParameter> _parameters_1 = it.getParameters(); JvmFormalParameter _parameter_1 = EmfParsleyDslJvmModelInferrer.this._jvmTypesBuilder.toParameter(spec, "feature", EmfParsleyDslJvmModelInferrer.this._typeReferenceBuilder.typeRef(EStructuralFeature.class)); EmfParsleyDslJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1); } }; EmfParsleyDslJvmModelInferrer.this.featureAssociatedExpressionToMethod(it, specification, "proposals_", EmfParsleyDslJvmModelInferrer.this._typeReferences.createTypeRef(EmfParsleyDslJvmModelInferrer.this._typeReferenceBuilder.typeRef(List.class).getType(), EmfParsleyDslJvmModelInferrer.this._typeReferences.wildCard()), _function); } } };
@Override public Boolean caseJvmConstraintOwner(JvmConstraintOwner object) { if (!object.eIsProxy()) { List<JvmTypeConstraint> constraints = object.getConstraints(); boolean boundProcessed = false; if (!constraints.isEmpty()) { for(JvmTypeConstraint constraint: constraints) { if (constraint instanceof JvmLowerBound) { doSwitch(constraint); boundProcessed = true; } } if (!boundProcessed) { for(JvmTypeConstraint constraint: constraints) { doSwitch(constraint); boundProcessed = true; } } } if (!boundProcessed) { JvmType objectType = references.findDeclaredType(Object.class, object); if (objectType != null) doSwitch(references.createTypeRef(objectType)); } } return Boolean.FALSE; }
|| Serializable.class.getName().equals(identifier) || Object.class.getName().equals(identifier)) { return getServices().getTypeReferences().createTypeRef(rawType);
protected JvmTypeReference getDeclaredType(JvmIdentifiableElement identifiable) { if (identifiable instanceof JvmOperation) { return ((JvmOperation) identifiable).getReturnType(); } if (identifiable instanceof JvmField) { return ((JvmField) identifiable).getType(); } if (identifiable instanceof JvmConstructor) { return shared.resolver.getServices().getTypeReferences().createTypeRef(((JvmConstructor) identifiable).getDeclaringType()); } if (identifiable instanceof JvmFormalParameter) { JvmTypeReference parameterType = ((JvmFormalParameter) identifiable).getParameterType(); return parameterType; } return null; }
final JvmTypeParameter param = typeParameterIdentifiers.get(id); if (param != null) { return typeReferences.createTypeRef(param);
protected void completeJvmEnumerationType(JvmEnumerationType element) { if (element.getSuperTypes().isEmpty()) { JvmTypeReference objectType = references.getTypeForName(Enum.class, element, references.createTypeRef(element)); if (objectType != null) element.getSuperTypes().add(objectType); values.setStatic(true); values.setSimpleName("values"); values.setReturnType(references.createArrayType(references.createTypeRef(element))); typeExtensions.setSynthetic(values, true); if (primarySourceElement != null) { valueOf.setStatic(true); valueOf.setSimpleName("valueOf"); valueOf.setReturnType(references.createTypeRef(element)); JvmFormalParameter param = typesFactory.createJvmFormalParameter(); param.setName("name");
return typeRefs.createTypeRef(baseType.getType(), args);