use of com.webobjects.foundation.NSMutableDictionary in project wonder-slim by undur.
the class ERXOncePerRequestConditional method displayCountDict.
public NSMutableDictionary displayCountDict() {
NSMutableDictionary displayCountDict = (NSMutableDictionary) ERXWOContext.contextDictionary().objectForKey("ERXOncePerRequestDisplayCountDict");
if (displayCountDict == null) {
displayCountDict = new NSMutableDictionary();
ERXWOContext.contextDictionary().setObjectForKey(displayCountDict, "ERXOncePerRequestDisplayCountDict");
}
return displayCountDict;
}
use of com.webobjects.foundation.NSMutableDictionary in project wonder-slim by undur.
the class WOHelperFunctionDeclarationParser method parseDeclarations.
public NSMutableDictionary parseDeclarations(String declarationStr) throws WOHelperFunctionDeclarationFormatException {
String strWithoutComments = _removeOldStyleCommentsFromString(declarationStr);
strWithoutComments = _removeNewStyleCommentsAndQuotedStringsFromString(strWithoutComments);
NSMutableDictionary declarations = parseDeclarationsWithoutComments(strWithoutComments);
return declarations;
}
use of com.webobjects.foundation.NSMutableDictionary in project wonder-slim by undur.
the class WOHelperFunctionDeclarationParser method _associationsForDictionaryString.
private NSMutableDictionary _associationsForDictionaryString(String declarationHeader, String declarationBody) throws WOHelperFunctionDeclarationFormatException {
NSMutableDictionary associations = new NSMutableDictionary();
String trimmedDeclarationBody = declarationBody.trim();
if (!trimmedDeclarationBody.startsWith("{") && !trimmedDeclarationBody.endsWith("}")) {
throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Internal inconsistency : invalid dictionary for declaration:\n" + declarationHeader + " " + declarationBody);
}
int declarationBodyLength = trimmedDeclarationBody.length();
if (declarationBodyLength <= 2) {
return associations;
}
trimmedDeclarationBody = trimmedDeclarationBody.substring(1, declarationBodyLength - 1).trim();
NSArray bindings = NSArray.componentsSeparatedByString(trimmedDeclarationBody, ";");
Enumeration bindingsEnum = bindings.objectEnumerator();
do {
if (!bindingsEnum.hasMoreElements()) {
break;
}
String binding = ((String) bindingsEnum.nextElement()).trim();
if (binding.length() != 0) {
int equalsIndex = binding.indexOf('=');
if (equalsIndex < 0) {
throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Invalid line. No equal in line:\n" + binding + "\nfor declaration:\n" + declarationHeader + " " + declarationBody);
}
String key = binding.substring(0, equalsIndex).trim();
if (key.length() == 0) {
throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing binding in line:\n" + binding + "\nfor declaration:\n" + declarationHeader + " " + declarationBody);
}
String value = binding.substring(equalsIndex + 1).trim();
if (value.length() == 0) {
throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing value in line:\n" + binding + "\nfor declaration:\n" + declarationHeader + " " + declarationBody);
}
WOAssociation association = WOHelperFunctionDeclarationParser._associationWithKey(value, _quotedStrings);
Object quotedString = _quotedStrings.objectForKey(key);
if (quotedString != null) {
associations.setObjectForKey(association, quotedString);
} else {
associations.setObjectForKey(association, key);
}
}
} while (true);
// }
return associations;
}
use of com.webobjects.foundation.NSMutableDictionary in project wonder-slim by undur.
the class WOHelperFunctionDeclarationParser method declarationsWithString.
public static NSMutableDictionary declarationsWithString(String declarationStr) throws WOHelperFunctionDeclarationFormatException {
WOHelperFunctionDeclarationParser declarationParser = new WOHelperFunctionDeclarationParser();
NSMutableDictionary declarations = declarationParser.parseDeclarations(declarationStr);
return declarations;
}
Aggregations