public static String stripArray(final String type) if (isArray(type))
public static String stripArray(final String type) { String result = type; if (isClassArray(type)) { result = fixClassArray(type); } if (isArray(result)) { Matcher matcher; matcher = SIMPLE_ARRAY_PATTERN.matcher(result); if (matcher.find()) { int idx = result.length() - 2; while (idx > 1 && result.charAt(idx - 2) == '[') { idx -= 2; } result = result.substring(0, idx); } else { return result; } } return result; }
public static String stripArray(final String type) { String result = type; if (isClassArray(type)) { result = fixClassArray(type); } if (isArray(result)) { Matcher matcher; matcher = SIMPLE_ARRAY_PATTERN.matcher(result); if (matcher.find()) { int idx = result.length() - 2; while (idx > 1 && result.charAt(idx - 2) == '[') { idx -= 2; } result = result.substring(0, idx); } else { return result; } } return result; }
public static String fixArray(final String type, boolean stripGenerics) { final String componentType; final int arrayDimensions; if (isArray(type)) { arrayDimensions = getArrayDimension(type); componentType = stripArray(type); } else { arrayDimensions = 0; componentType = type; } final StringBuilder result = new StringBuilder(); if (isGeneric(componentType) && stripGenerics) { result.append(componentType.replaceFirst("^([^<]*)<.*?>$", "$1")); } else { result.append(componentType); } for (int i = 0; i < arrayDimensions; i++) { result.append("[]"); } return result.toString(); }
public static String fixArray(final String type, boolean stripGenerics) { final String componentType; final int arrayDimensions; if (isArray(type)) { arrayDimensions = getArrayDimension(type); componentType = stripArray(type); } else { arrayDimensions = 0; componentType = type; } final StringBuilder result = new StringBuilder(); if (isGeneric(componentType) && stripGenerics) { result.append(componentType.replaceFirst("^([^<]*)<.*?>$", "$1")); } else { result.append(componentType); } for (int i = 0; i < arrayDimensions; i++) { result.append("[]"); } return result.toString(); }
public static String stripGenerics(final String type) { final String componentType; final int arrayDimensions; if (isArray(type)) { arrayDimensions = getArrayDimension(type); componentType = stripArray(type); } else { arrayDimensions = 0; componentType = type; } if (isGeneric(componentType)) { final StringBuilder result = new StringBuilder(componentType.replaceFirst("^([^<]*)<.*?>$", "$1")); for (int i = 0; i < arrayDimensions; i++) { result.append("[]"); } return result.toString(); } return type; }
@Override public boolean hasImport(final String type) { String resultType = type; if (Types.isArray(type)) { resultType = Types.stripArray(type); } if (Types.isGeneric(type)) { resultType = Types.stripGenerics(type); } return getImport(resultType) != null; }
@Override public boolean hasImport(final String type) { String resultType = type; if (Types.isArray(type)) { resultType = Types.stripArray(type); } if (Types.isGeneric(type)) { resultType = Types.stripGenerics(type); } return getImport(resultType) != null; }
@Override public boolean hasImport(final String type) { String resultType = type; if (Types.isArray(type)) { resultType = Types.stripArray(type); } if (Types.isGeneric(type)) { resultType = Types.stripGenerics(type); } return getImport(resultType) != null; }
@Override public boolean hasImport(final String type) { String resultType = type; if (Types.isArray(type)) { resultType = Types.stripArray(type); } if (Types.isGeneric(type)) { resultType = Types.stripGenerics(type); } return getImport(resultType) != null; }
@Override public boolean hasImport(final String type) { String resultType = type; if (Types.isArray(type)) { resultType = Types.stripArray(type); } if (Types.isGeneric(type)) { resultType = Types.stripGenerics(type); } return getImport(resultType) != null; }
@Override public boolean requiresImport(final String type) { String resultType = type; if (Types.isArray(resultType)) { resultType = Types.stripArray(type); } if (Types.isGeneric(resultType)) { resultType = Types.stripGenerics(resultType); } return !(!validImport(resultType) || hasImport(resultType) || Types.isJavaLang(resultType)); }
@Override public boolean requiresImport(final String type) { String resultType = type; if (Types.isArray(resultType)) { resultType = Types.stripArray(type); } if (Types.isGeneric(resultType)) { resultType = Types.stripGenerics(resultType); } if (!validImport(resultType) || hasImport(resultType) || Types.isJavaLang(resultType)) { return false; } return true; }
@Override public boolean requiresImport(final String type) { String resultType = type; if (Types.isArray(resultType)) { resultType = Types.stripArray(type); } if (Types.isGeneric(resultType)) { resultType = Types.stripGenerics(resultType); } if (!validImport(resultType) || hasImport(resultType) || Types.isJavaLang(resultType) || Strings.areEqual(getPackage(), Types.getPackage(resultType))) { return false; } return true; }
@Override public boolean requiresImport(final String type) { boolean requiresImport = false; String resultType = type; if (Types.isArray(resultType)) { resultType = Types.stripArray(resultType); } if (Types.isGeneric(resultType)) { for (String genericPart : Types.splitGenerics(resultType)) { requiresImport |= requiresImport(genericPart); } resultType = Types.stripGenerics(resultType); } requiresImport |= !(!validImport(resultType) || hasImport(resultType) || Types.isJavaLang(resultType) || Strings.areEqual(getPackage(), Types.getPackage(resultType))); return requiresImport; }
@Override public boolean requiresImport(final String type) { boolean requiresImport = false; String resultType = type; if (Types.isArray(resultType)) { resultType = Types.stripArray(resultType); } if (Types.isGeneric(resultType)) { for (String genericPart : Types.splitGenerics(resultType)) { requiresImport |= requiresImport(genericPart); } resultType = Types.stripGenerics(resultType); } requiresImport |= !(!validImport(resultType) || hasImport(resultType) || Types.isJavaLang(resultType) || Strings.areEqual(getPackage(), Types.getPackage(resultType))); return requiresImport; }
if (Types.isArray(typeName))
if (Types.isArray(typeName))
if (Types.isArray(typeName))
if (Types.isArray(typeName))