use of freemarker.core._DelayedConversionToString in project freemarker by apache.
the class OverloadedMethods method memberListToString.
private _DelayedConversionToString memberListToString() {
return new _DelayedConversionToString(null) {
@Override
protected String doConversion(Object obj) {
final Iterator fixArgMethodsIter = fixArgMethods.getMemberDescriptors();
final Iterator varargMethodsIter = varargMethods != null ? varargMethods.getMemberDescriptors() : null;
boolean hasMethods = fixArgMethodsIter.hasNext() || (varargMethodsIter != null && varargMethodsIter.hasNext());
if (hasMethods) {
StringBuilder sb = new StringBuilder();
HashSet fixArgMethods = new HashSet();
while (fixArgMethodsIter.hasNext()) {
if (sb.length() != 0)
sb.append(",\n");
sb.append(" ");
CallableMemberDescriptor callableMemberDesc = (CallableMemberDescriptor) fixArgMethodsIter.next();
fixArgMethods.add(callableMemberDesc);
sb.append(callableMemberDesc.getDeclaration());
}
if (varargMethodsIter != null) {
while (varargMethodsIter.hasNext()) {
CallableMemberDescriptor callableMemberDesc = (CallableMemberDescriptor) varargMethodsIter.next();
if (!fixArgMethods.contains(callableMemberDesc)) {
if (sb.length() != 0)
sb.append(",\n");
sb.append(" ");
sb.append(callableMemberDesc.getDeclaration());
}
}
}
return sb.toString();
} else {
return "No members";
}
}
};
}
Aggregations