本文整理汇总了Java中org.springframework.util.AutoPopulatingList.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java AutoPopulatingList.iterator方法的具体用法?Java AutoPopulatingList.iterator怎么用?Java AutoPopulatingList.iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.util.AutoPopulatingList
的用法示例。
在下文中一共展示了AutoPopulatingList.iterator方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showErrorMap
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* This method is used during debugging to dump the contents of the error map, including the key names. It is not
* used by the
* application in normal circumstances at all.
*/
protected void showErrorMap() {
if (GlobalVariables.getMessageMap().hasNoErrors()) {
return;
}
for (Iterator i = GlobalVariables.getMessageMap().getAllPropertiesAndErrors().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
AutoPopulatingList errorList = (AutoPopulatingList) e.getValue();
for (Iterator j = errorList.iterator(); j.hasNext(); ) {
ErrorMessage em = (ErrorMessage) j.next();
if (em.getMessageParameters() == null) {
LOG.error(e.getKey().toString() + " = " + em.getErrorKey());
} else {
LOG.error(e.getKey().toString() + " = " + em.getErrorKey() + " : " +
Arrays.toString(em.getMessageParameters()));
}
}
}
}
示例2: showErrorMap
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* This method is used during debugging to dump the contents of the error map, including the key names. It is not
* used by the
* application in normal circumstances at all.
*/
protected void showErrorMap() {
if (GlobalVariables.getMessageMap().hasNoErrors()) {
return;
}
for (Iterator i = GlobalVariables.getMessageMap().getAllPropertiesAndErrors().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
AutoPopulatingList errorList = (AutoPopulatingList) e.getValue();
for (Iterator j = errorList.iterator(); j.hasNext(); ) {
ErrorMessage em = (ErrorMessage) j.next();
if (em.getMessageParameters() == null) {
LOG.error(e.getKey().toString() + " = " + em.getErrorKey());
} else {
LOG.error(e.getKey().toString() + " = " + em.getErrorKey() + " : " +
Arrays.toString(em.getMessageParameters()));
}
}
}
}
示例3: showErrorMap
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* This method is used during debugging to dump the contents of the error map, including the key names. It is not
* used by the
* application in normal circumstances at all.
*/
protected void showErrorMap() {
if (GlobalVariables.getMessageMap().hasNoErrors()) {
return;
}
for (Iterator i = GlobalVariables.getMessageMap().getAllPropertiesAndErrors().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
AutoPopulatingList errorList = (AutoPopulatingList) e.getValue();
for (Iterator j = errorList.iterator(); j.hasNext(); ) {
ErrorMessage em = (ErrorMessage) j.next();
if (em.getMessageParameters() == null) {
LOG.error(e.getKey().toString() + " = " + em.getErrorKey());
} else {
LOG.error(e.getKey().toString() + " = " + em.getErrorKey() + " : " +
em.getMessageParameters().toString());
}
}
}
}
示例4: showErrorMap
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* This method is used during debugging to dump the contents of the error map, including the key names. It is not
* used by the
* application in normal circumstances at all.
*/
protected void showErrorMap() {
if (GlobalVariables.getMessageMap().hasNoErrors()) {
return;
}
for (Iterator i = GlobalVariables.getMessageMap().getAllPropertiesAndErrors().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
AutoPopulatingList errorList = (AutoPopulatingList) e.getValue();
for (Iterator j = errorList.iterator(); j.hasNext(); ) {
ErrorMessage em = (ErrorMessage) j.next();
if (em.getMessageParameters() == null) {
LOG.error(e.getKey().toString() + " = " + em.getErrorKey());
} else {
LOG.error(e.getKey().toString() + " = " + em.getErrorKey() + " : " +
em.getMessageParameters().toString());
}
}
}
}
示例5: containsMessageKey
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* @return true if the given messageKey is associated with some property in this ErrorMap
*/
public boolean containsMessageKey(String messageKey) {
ErrorMessage foundMessage = null;
if (!hasNoErrors()) {
for (Iterator<Map.Entry<String, AutoPopulatingList<ErrorMessage>>> i =
getAllPropertiesAndErrors().iterator(); (foundMessage == null) && i.hasNext(); ) {
Map.Entry<String, AutoPopulatingList<ErrorMessage>> e = i.next();
AutoPopulatingList<ErrorMessage> entryErrorList = e.getValue();
for (Iterator<ErrorMessage> j = entryErrorList.iterator(); j.hasNext(); ) {
ErrorMessage em = j.next();
if (messageKey.equals(em.getErrorKey())) {
foundMessage = em;
}
}
}
}
return (foundMessage != null);
}
示例6: logErrors
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* This method logs errors.
*/
protected void logErrors() {
if (LOG.isInfoEnabled()) {
if (GlobalVariables.getMessageMap().hasErrors()) {
for (Iterator<Map.Entry<String, AutoPopulatingList<ErrorMessage>>> i =
GlobalVariables.getMessageMap().getAllPropertiesAndErrors().iterator(); i.hasNext(); ) {
Map.Entry<String, AutoPopulatingList<ErrorMessage>> e = i.next();
StringBuffer logMessage = new StringBuffer();
logMessage.append("[" + e.getKey() + "] ");
boolean first = true;
AutoPopulatingList<ErrorMessage> errorList = e.getValue();
for (Iterator<ErrorMessage> j = errorList.iterator(); j.hasNext(); ) {
ErrorMessage em = j.next();
if (first) {
first = false;
} else {
logMessage.append(";");
}
logMessage.append(em);
}
LOG.info(logMessage);
}
}
}
}
示例7: testMessageCollisions
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* Verify that using the same error message multiple times correctly stores different parameters each time. (Reproduces bug
* KULNRVSYS-943).
*/
@Test public void testMessageCollisions() {
final String PROPERTY_NAME = "document.sourceAccounting*,document.targetAccounting*,newSourceLine*,newTargetLine*";
MessageMap testMap = new MessageMap();
testMap.putError(PROPERTY_NAME, "error.inactive", "Chart Code");
testMap.putError(PROPERTY_NAME, "error.document.subAccountClosed", "Sub-Account Number");
testMap.putError(PROPERTY_NAME, "error.inactive", "Object Code");
testMap.putError(PROPERTY_NAME, "error.inactive", "SubObject Code");
testMap.putError(PROPERTY_NAME, "error.inactive", "Project Code");
assertEquals(5, testMap.getErrorCount());
// retrieve error messages for the one known key
Object thing = testMap.getErrorMessagesForProperty(PROPERTY_NAME);
Set usedParams = new HashSet();
for (Iterator i = testMap.getAllPropertiesAndErrors().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
String propertyKey = (String) entry.getKey();
AutoPopulatingList messageList = (AutoPopulatingList) entry.getValue();
for (Iterator j = messageList.iterator(); j.hasNext();) {
ErrorMessage message = (ErrorMessage) j.next();
String[] params = message.getMessageParameters();
if (usedParams.contains(params)) {
fail("usedParams contains duplicate parameters object '" + params + "'");
}
usedParams.add(params);
}
}
}
示例8: testReplace_matchingProperty_matchingKey_noParams
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* test that an existing key and existing property are replaced in the message map
*/
@Test public void testReplace_matchingProperty_matchingKey_noParams() {
final MessageMap constantMap = buildReplaceErrorMap();
MessageMap replaceMap = buildReplaceErrorMap();
assertTrue(replaceMap.equals(constantMap));
assertTrue(replaceMap.containsMessageKey(RiceKeyConstants.ERROR_INACTIVE));
assertFalse(replaceMap.containsMessageKey(RiceKeyConstants.ERROR_NOT_AMONG));
AutoPopulatingList preMessages = replaceMap.getMessages("accountNbr");
assertEquals(2, preMessages.size());
boolean replaced = replaceMap.replaceError("accountNbr", RiceKeyConstants.ERROR_INACTIVE, RiceKeyConstants.ERROR_NOT_AMONG);
assertTrue(replaced);
assertFalse(replaceMap.equals(constantMap));
assertFalse(replaceMap.containsMessageKey(RiceKeyConstants.ERROR_INACTIVE));
assertTrue(replaceMap.containsMessageKey(RiceKeyConstants.ERROR_NOT_AMONG));
AutoPopulatingList postMessages = replaceMap.getMessages("accountNbr");
assertEquals(2, postMessages.size());
int replacedCount = 0;
for (Iterator i = postMessages.iterator(); i.hasNext();) {
ErrorMessage em = (ErrorMessage) i.next();
if (em.getErrorKey().equals(RiceKeyConstants.ERROR_NOT_AMONG)) {
String[] params = em.getMessageParameters();
assertEquals(0, params.length);
++replacedCount;
}
}
assertEquals(1, replacedCount);
}
示例9: testReplace_matchingProperty_matchingKey_withParams
import org.springframework.util.AutoPopulatingList; //导入方法依赖的package包/类
/**
* test that an existing key and existing property are replaced in the message map along with the associated params
*/
@Test public void testReplace_matchingProperty_matchingKey_withParams() {
final MessageMap constantMap = buildReplaceErrorMap();
MessageMap replaceMap = buildReplaceErrorMap();
assertTrue(replaceMap.equals(constantMap));
assertTrue(replaceMap.containsMessageKey(RiceKeyConstants.ERROR_INACTIVE));
assertFalse(replaceMap.containsMessageKey(RiceKeyConstants.ERROR_NOT_AMONG));
AutoPopulatingList preMessages = replaceMap.getMessages("accountNbr");
assertEquals(2, preMessages.size());
boolean replaced = replaceMap.replaceError("accountNbr", RiceKeyConstants.ERROR_INACTIVE, RiceKeyConstants.ERROR_NOT_AMONG, "zero", "one");
assertTrue(replaced);
assertFalse(replaceMap.equals(constantMap));
assertFalse(replaceMap.containsMessageKey(RiceKeyConstants.ERROR_INACTIVE));
assertTrue(replaceMap.containsMessageKey(RiceKeyConstants.ERROR_NOT_AMONG));
AutoPopulatingList postMessages = replaceMap.getMessages("accountNbr");
assertEquals(2, postMessages.size());
int replacedCount = 0;
for (Iterator i = postMessages.iterator(); i.hasNext();) {
ErrorMessage em = (ErrorMessage) i.next();
if (em.getErrorKey().equals(RiceKeyConstants.ERROR_NOT_AMONG)) {
String[] params = em.getMessageParameters();
assertEquals(2, params.length);
assertEquals("zero", params[0]);
assertEquals("one", params[1]);
++replacedCount;
}
}
assertEquals(1, replacedCount);
}