public String _toString(int indent) { String indentString = ""; for (int i = 0; i < indent; i++) indentString = new StringBuilder().append(indentString).append('\t').toString(); StringBuilder aLog = new StringBuilder(); aLog.append(new StringBuilder().append(indentString).append("<EOAttribute ").append(name()).append('\n').toString()); String aKey = ""; try { NSMutableDictionary aDictionary = new NSMutableDictionary(); encodeIntoPropertyList(aDictionary); for (Enumeration enumerator = aDictionary.keyEnumerator(); enumerator.hasMoreElements(); aLog.append(new StringBuilder().append(indentString).append('\t').append(aKey).append(" : '").append(aDictionary.objectForKey(aKey)).append("'\n").toString())) aKey = (String) enumerator.nextElement(); } catch (Exception exception) { aLog.append(new StringBuilder().append(indentString).append('\t').append(getClass().getName()).append(".toString: characteristics ").append(aKey).append(" exception ").append(exception).append('\n').toString()); } aLog.append(new StringBuilder().append(indentString).append('>').toString()); return aLog.toString(); }
public static WODeclaration createDeclaration(String declarationName, String declarationType, NSMutableDictionary associations) { WODeclaration declaration = new WODeclaration(declarationName, declarationType, associations); if (WOHelperFunctionParser._debugSupport && associations != null && associations.objectForKey(WOHTMLAttribute.Debug) == null) { //associations.setObjectForKey(new WOConstantValueAssociation(Boolean.TRUE), WOHTMLAttribute.Debug); Enumeration associationsEnum = associations.keyEnumerator(); while (associationsEnum.hasMoreElements()) { String bindingName = (String) associationsEnum.nextElement(); WOAssociation association = (WOAssociation) associations.objectForKey(bindingName); association.setDebugEnabledForBinding(bindingName, declarationName, declarationType); association._setDebuggingEnabled(false); } } return declaration; } }
protected void processDeclaration(WODeclaration declaration) { NSMutableDictionary associations = (NSMutableDictionary) declaration.associations(); Enumeration bindingNameEnum = associations.keyEnumerator(); while (bindingNameEnum.hasMoreElements()) { String bindingName = (String) bindingNameEnum.nextElement(); WOAssociation association = (WOAssociation) associations.valueForKey(bindingName); WOAssociation helperAssociation = parserHelperAssociation(association); if (helperAssociation != association) { associations.setObjectForKey(helperAssociation, bindingName); } } // This will replace constant associations with ognl associations // when needed. WOOgnl.factory().convertOgnlConstantAssociations(associations); }
private NSMutableDictionary parseDeclarationsWithoutComments(String declarationWithoutComment) throws WOHelperFunctionDeclarationFormatException { NSMutableDictionary declarations = new NSMutableDictionary(); NSMutableDictionary rawDeclarations = _rawDeclarationsWithoutComment(declarationWithoutComment); String tagName; WODeclaration declaration; Enumeration rawDeclarationHeaderEnum = rawDeclarations.keyEnumerator(); while (rawDeclarationHeaderEnum.hasMoreElements()) { String declarationHeader = (String) rawDeclarationHeaderEnum.nextElement(); String declarationBody = (String) rawDeclarations.objectForKey(declarationHeader); int colonIndex = declarationHeader.indexOf(':'); if (colonIndex < 0) { throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing ':' for declaration:\n" + declarationHeader + " " + declarationBody); } tagName = declarationHeader.substring(0, colonIndex).trim(); if (tagName.length() == 0) { throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing tag name for declaration:\n" + declarationHeader + " " + declarationBody); } if (declarations.objectForKey(tagName) != null) { throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Duplicate tag name '" + tagName + "' in declaration:\n" + declarationBody); } String type = declarationHeader.substring(colonIndex + 1).trim(); if (type.length() == 0) { throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing element name for declaration:\n" + declarationHeader + " " + declarationBody); } NSMutableDictionary associations = _associationsForDictionaryString(declarationHeader, declarationBody); declaration = WOHelperFunctionParser.createDeclaration(tagName, type, associations); declarations.setObjectForKey(declaration, tagName); } return declarations; }
public void convertOgnlConstantAssociations(NSMutableDictionary associations) { for (Enumeration e = associations.keyEnumerator(); e.hasMoreElements();) { String name = (String) e.nextElement(); WOAssociation association = (WOAssociation) associations.objectForKey(name);