@Override public List<String> getInterfaces() { List<String> result = new ArrayList<String>(); List<Type> superTypes = JDTHelper.getInterfaces(getBodyDeclaration()); for (Type type : superTypes) { String name = JDTHelper.getTypeName(type); if (Types.isSimpleName(name) && this.hasImport(name)) { Import imprt = this.getImport(name); String pkg = imprt.getPackage(); if (!Strings.isNullOrEmpty(pkg)) { name = pkg + "." + name; } } result.add(name); } return result; }
@Override public List<String> getInterfaces() { List<String> result = new ArrayList<>(); List<Type> superTypes = JDTHelper.getInterfaces(getDeclaration()); for (Type type : superTypes) { String name = JDTHelper.getTypeName(type); String rawName = Types.stripGenerics(name); if (Types.isSimpleName(rawName)) { String pkg; if (this.hasImport(rawName)) { Import imprt = this.getImport(rawName); pkg = imprt.getPackage(); } else { pkg = this.getPackage(); } if (!Strings.isNullOrEmpty(pkg)) { name = pkg + "." + name; } } result.add(name); } return result; }
@Override public Import addImport(final String className) { String strippedClassName = Types.stripGenerics(Types.stripArray(className)); Import imprt; if (Types.isSimpleName(strippedClassName) && !hasImport(strippedClassName)) { throw new IllegalArgumentException("Cannot import class without a package [" + strippedClassName + "]"); } if (!hasImport(strippedClassName) && validImport(strippedClassName)) { imprt = new ImportImpl(this).setName(strippedClassName); unit.imports().add(imprt.getInternal()); } else if (hasImport(strippedClassName)) { imprt = getImport(strippedClassName); } else { throw new IllegalArgumentException("Attempted to import the illegal type [" + strippedClassName + "]"); } return imprt; }
@Override @SuppressWarnings("unchecked") public Import addImport(final String className) { String strippedClassName = Types.stripGenerics(Types.stripArray(className)); Import imprt; if (Types.isSimpleName(strippedClassName) && !hasImport(strippedClassName)) { throw new IllegalArgumentException("Cannot import class without a package [" + strippedClassName + "]"); } if (!hasImport(strippedClassName) && validImport(strippedClassName)) { imprt = new ImportImpl(this).setName(strippedClassName); unit.imports().add(imprt.getInternal()); } else if (hasImport(strippedClassName)) { imprt = getImport(strippedClassName); } else { throw new IllegalArgumentException("Attempted to import the illegal type [" + strippedClassName + "]"); } return imprt; }
@Override @SuppressWarnings("unchecked") public Import addImport(final String className) { String strippedClassName = Types.stripGenerics(Types.stripArray(className)); Import imprt; if (Types.isSimpleName(strippedClassName) && !hasImport(strippedClassName)) { throw new IllegalArgumentException("Cannot import class without a package [" + strippedClassName + "]"); } if (!hasImport(strippedClassName) && validImport(strippedClassName)) { imprt = new ImportImpl(this).setName(strippedClassName); unit.imports().add(imprt.getInternal()); } else if (hasImport(strippedClassName)) { imprt = getImport(strippedClassName); } else { throw new IllegalArgumentException("Attempted to import the illegal type [" + strippedClassName + "]"); } return imprt; }
@Override public List<String> getInterfaces() { List<String> result = new ArrayList<String>(); List<Type> superTypes = JDTHelper.getInterfaces(getBodyDeclaration()); for (Type type : superTypes) { String name = JDTHelper.getTypeName(type); String rawName = Types.stripGenerics(name); if (Types.isSimpleName(rawName)) { String pkg; if (this.hasImport(rawName)) { Import imprt = this.getImport(rawName); pkg = imprt.getPackage(); } else { pkg = this.getPackage(); } if (!Strings.isNullOrEmpty(pkg)) { name = pkg + "." + name; } } result.add(name); } return result; }
if (Types.isSimpleName(result)) if (Types.isSimpleName(result)) if (Types.isSimpleName(result))
if (Types.isSimpleName(result)) if (Types.isSimpleName(result)) if (Types.isSimpleName(result))
if (Types.isSimpleName(result)) if (Types.isSimpleName(result)) if (Types.isSimpleName(result))
if (Types.isSimpleName(result)) if (Types.isSimpleName(result)) if (Types.isSimpleName(result) && getPackage() != null)
if (!Types.isSimpleName(named.getValue())) context.addValidationError(named, "Invalid java type name."); });
Import imprt = addImport(type); if (imprt == null && !Types.isSimpleName(type))
Import imprt = addImport(type); if (imprt == null && !Types.isSimpleName(type))
if (!Types.isSimpleName(named.getValue())) context.addValidationError(named, "Invalid java type name."); });