@Override public boolean apply(JvmTypeReference input) { return input.getType() == referencedType; } })) {
@Override public JvmType getType() { JvmTypeReference resolvedEquivalent = getEquivalent(); if (resolvedEquivalent != null) return resolvedEquivalent.getType(); return null; }
private Class<?> getRawType(JvmTypeReference ref) { Class<?> result = getRawType(ref.getType()); return result; }
public JvmTypeReference getExtendedClass(JvmDeclaredType type) { for(JvmTypeReference candidate: type.getSuperTypes()) { JvmType candidateType = candidate.getType(); if (candidateType instanceof JvmGenericType && !((JvmGenericType) candidateType).isInterface()) return candidate; } return null; }
@Override public boolean apply(JvmTypeReference typeReference) { JvmType type = typeReference.getType(); if (type != null && type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { return ((JvmGenericType) type).isInterface(); } return false; } });
public boolean is(final JvmTypeReference reference, final Class<?> clazz) { if (isNullOrProxy(reference)) return false; boolean result = is(reference.getType(), clazz); return result; }
private JvmTypeReference getFunctionTypeReference(XtendFunction function) { if (function != null) { final JvmTypeReference reference = function.getReturnType(); if (reference != null) { final JvmType type = reference.getType(); if (type != null) { return reference; } } } return this.typeReferences.getTypeForName(Object.class, function); }
private JvmType getTypeForAnnotationValue(JvmOperation value) { JvmType expectedType = value.getReturnType().getType(); if (expectedType instanceof JvmArrayType) { expectedType = ((JvmArrayType) expectedType).getComponentType(); } return expectedType; }
@Override public JvmArrayType getType() { JvmTypeReference componentTypeReference = getComponentType(); if (componentTypeReference != null) { JvmType componentType = componentTypeReference.getType(); if (componentType instanceof JvmComponentType) { JvmArrayType result = ((JvmComponentType) componentType).getArrayType(); return result; } } return null; }
public String getTypeString(final Variable variable) { final JvmTypeReference ref = this.typeInferrer.getJvmType(variable, variable); String _xifexpression = null; if (((ref == null) || (ref instanceof JvmUnknownTypeReference))) { _xifexpression = ""; } else { _xifexpression = ref.getType().getQualifiedName(); } return _xifexpression; }
/** * @since 1.7 */ public JvmType findMatcherClass(final Pattern pattern) { final JvmType matcherClass = this.findInferredClass(pattern, BaseMatcher.class); if ((matcherClass == null)) { return this._typeReferences.getTypeForName(GenericPatternMatcher.class, pattern).getType(); } else { return matcherClass; } }
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 String getSuperTypeName(JvmTypeReference typeReference) { if (typeReference instanceof JvmParameterizedTypeReference) { JvmType rawType = typeReference.getType(); if (rawType != null && !rawType.eIsProxy()) { return rawType.getIdentifier(); } return null; } else { return typeReference.getIdentifier(); } } });
public Iterable<String> getEnumValues(final JvmTypeReference reference) { JvmType _type = reference.getType(); final JvmEnumerationType enumType = ((JvmEnumerationType) _type); final Function1<JvmEnumerationLiteral, String> _function = (JvmEnumerationLiteral it) -> { return it.getSimpleName(); }; return ListExtensions.<JvmEnumerationLiteral, String>map(enumType.getLiterals(), _function); }
protected void throwNotApplicable(final JvmAnnotationValue it, final String valueType) { JvmTypeReference _returnType = it.getOperation().getReturnType(); JvmType _type = null; if (_returnType!=null) { _type=_returnType.getType(); } String _isNotApplicableMessage = ConditionUtils.isNotApplicableMessage(valueType, this.getAnnotationValueTypeName(_type)); throw new IllegalArgumentException(_isNotApplicableMessage); }
protected String getDeclaratorName(JvmFeature feature) { JvmDeclaredType declarator = feature.getDeclaringType(); if (declarator.isLocal()) { return "new " + Iterables.getLast(declarator.getSuperTypes()).getType().getSimpleName()+ "(){}"; } else { return declarator.getSimpleName(); } }
@Check public void checkFunctionTypeArgsNonVoid(XFunctionTypeRef typeRef) { for (JvmTypeReference paramType : typeRef.getParamTypes()) { JvmType type = paramType.getType(); if (type instanceof JvmVoid && !type.eIsProxy()) { error("The primitive 'void' cannot be the type of a function parameter. ", paramType, null, -1, INVALID_USE_OF_TYPE); } } }
protected void appendConstructedTypeName(XConstructorCall constructorCall, ITreeAppendable typeAppendable) { JvmDeclaredType type = constructorCall.getConstructor().getDeclaringType(); if (type instanceof JvmGenericType && ((JvmGenericType) type).isAnonymous()) { typeAppendable.append(Iterables.getLast(type.getSuperTypes()).getType()); } else { typeAppendable.append(constructorCall.getConstructor().getDeclaringType()); } }