当前位置: 首页>>代码示例>>Java>>正文


Java Attributes.entrySet方法代码示例

本文整理汇总了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);
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:24,代码来源:PrivateReplyAnchorLegacyIdConverter.java

示例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);
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:27,代码来源:AttachmentIdConverter.java

示例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();
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:DocOpUtil.java

示例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();
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:DocOpUtil.java

示例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;
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:10,代码来源:OperationSerializer.java

示例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;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:16,代码来源:DocOpAutomaton.java

示例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;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:11,代码来源:DocOpAutomaton.java

示例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;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:8,代码来源:DocOpAutomaton.java

示例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);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:10,代码来源:DocOpScrub.java


注:本文中的org.waveprotocol.wave.model.document.operation.Attributes.entrySet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。