本文整理汇总了Java中org.waveprotocol.wave.model.document.operation.Attributes.entrySet方法的典型用法代码示例。如果您正苦于以下问题:Java Attributes.entrySet方法的具体用法?Java Attributes.entrySet怎么用?Java Attributes.entrySet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.waveprotocol.wave.model.document.operation.Attributes
的用法示例。
在下文中一共展示了Attributes.entrySet方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: elementStart
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
@Override
public void elementStart(String type, Attributes attrs) {
if ("conversation".equals(documentId) && "conversation".equals(type)) {
StringMap<String> newAttrs = CollectionUtils.newStringMap();
for (Map.Entry<String, String> entry : attrs.entrySet()) {
if (!"anchorWavelet".equals(entry.getKey())) {
newAttrs.put(entry.getKey(), entry.getValue());
} else {
String newValue;
try {
newValue = ModernIdSerialiser.INSTANCE.serialiseWaveletId(
LegacyIdSerialiser.INSTANCE.deserialiseWaveletId(entry.getValue()));
} catch (InvalidIdException e) {
throw new InvalidInputException("Failed to convert anchorWavelet: " + attrs);
}
log.info("Replacing " + entry + " with value " + newValue);
newAttrs.put(entry.getKey(), newValue);
}
}
attrs = AttributesImpl.fromStringMap(newAttrs);
}
super.elementStart(type, attrs);
}
示例2: elementStart
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
@Override
public void elementStart(String type, Attributes attrs) {
if (IMAGE_ELEMENT_TYPE.equals(type)) {
StringMap<String> newAttrs = CollectionUtils.newStringMap();
for (Map.Entry<String, String> entry : attrs.entrySet()) {
if (!ATTACHMENT_ID_ATTRIBUTE_NAME.equals(entry.getKey())) {
newAttrs.put(entry.getKey(), entry.getValue());
} else {
String newValue;
AttachmentId mapped = mapping.get(entry.getValue());
if (mapped == null) {
log.warning("Attachment id not found: " + entry);
// Preserve; not sure this is a good idea but it's probably better
// than dropping the value.
newValue = entry.getValue();
} else {
log.info("Replacing " + entry + " with value " + mapped);
newValue = mapped.getId();
}
newAttrs.put(entry.getKey(), newValue);
}
}
attrs = AttributesImpl.fromStringMap(newAttrs);
}
super.elementStart(type, attrs);
}
示例3: toConciseString
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
public static String toConciseString(Attributes attributes) {
if (attributes.isEmpty()) {
return "{}";
}
StringBuilder b = new StringBuilder();
b.append("{ ");
boolean first = true;
for (Map.Entry<String, String> entry : attributes.entrySet()) {
if (first) {
first = false;
} else {
b.append(", ");
}
b.append(entry.getKey());
b.append("=");
b.append(literalString(entry.getValue()));
}
b.append(" }");
return b.toString();
}
示例4: attributeString
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
public static String attributeString(Attributes attributes) {
StringBuilder b = new StringBuilder();
boolean first = true;
for (Map.Entry<String, String> e : attributes.entrySet()) {
if (first) {
first = false;
} else {
b.append(" ");
}
// We're just writing null with no quotes if the value is null.
// This is acceptable since it only occurs in updateAttributes,
// which is a processing instruction, so we define the format of it.
//
// TODO: We should escape ' and " and < and & etc. in the value.
b.append(e.getKey()).append("=")
.append(e.getValue() == null ? "null"
: ("\"" + xmlAttrEscape(e.getValue()) + "\""));
}
return b.toString();
}
示例5: createElementStart
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
private static ElementStart createElementStart(String type, Attributes attrs) {
ElementStart elementStart = MessageFactoryHelper.createDocumentElementStart();
elementStart.setType(type);
for (Map.Entry<String, String> attribute : attrs.entrySet()) {
elementStart.addAttribute(
createKeyValuePair(attribute.getKey(), attribute.getValue()));
}
return elementStart;
}
示例6: checkAttributesWellFormed
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
private ValidationResult checkAttributesWellFormed(Attributes attr, ViolationCollector v) {
if (attr == null) { return nullAttributes(v); }
String previousKey = null;
for (Map.Entry<String, String> e : attr.entrySet()) {
if (e.getKey() == null) { return nullAttributeKey(v); }
if (!Utf16Util.isXmlName(e.getKey())) { return attributeNameNotXmlName(v, e.getKey()); }
if (e.getValue() == null) { return nullAttributeValue(v); }
if (!Utf16Util.isValidUtf16(e.getValue())) { return attributeValueNotValidUtf16(v); }
if (previousKey != null && previousKey.compareTo(e.getKey()) >= 0) {
return attributeKeysNotStrictlyMonotonic(v, previousKey, e.getKey());
}
previousKey = e.getKey();
}
return ValidationResult.VALID;
}
示例7: validateAttributes
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
private ValidationResult validateAttributes(String tag, Attributes attr, ViolationCollector v) {
for (Map.Entry<String, String> e : attr.entrySet()) {
String key = e.getKey();
String value = e.getValue();
if (!elementAllowsAttribute(tag, key, value)) {
return invalidAttribute(v, tag, key, value);
}
}
return ValidationResult.VALID;
}
示例8: attributesEqual
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
private boolean attributesEqual(Attributes a, Attributes b) {
if (a.size() != b.size()) { return false; }
for (Map.Entry<String, String> ae : a.entrySet()) {
if (!equal(ae.getValue(), b.get(ae.getKey()))) { return false; }
}
return true;
}
示例9: scrubAttributes
import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
public static Attributes scrubAttributes(Attributes unscrubbed, ScrubCache nameScrubber) {
List<Attribute> list = new ArrayList<Attribute>();
for (Map.Entry<String, String> entry : unscrubbed.entrySet()) {
list.add(new Attribute(
nameScrubber.scrubUniquely(entry.getKey()),
scrubMostString(entry.getValue())));
}
return AttributesImpl.fromUnsortedAttributesUnchecked(list);
}