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


Java Attributes.get方法代码示例

本文整理汇总了Java中org.waveprotocol.wave.model.document.operation.Attributes.get方法的典型用法代码示例。如果您正苦于以下问题:Java Attributes.get方法的具体用法?Java Attributes.get怎么用?Java Attributes.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.waveprotocol.wave.model.document.operation.Attributes的用法示例。


在下文中一共展示了Attributes.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleAttribute

import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
final void handleAttribute(Attributes attrs) throws InvalidSchemaException {
  String name = attrs.get(NAME_ATTRIBUTE_NAME);
  String values = attrs.get(VALUES_ATTRIBUTE_NAME);
  String required = attrs.get(REQUIRED_ATTRIBUTE_NAME);
  if (name == null) {
    throw new InvalidSchemaException("Missing attribute: " + NAME_ATTRIBUTE_NAME);
  }
  if (values == null) {
    throw new InvalidSchemaException("Missing attribute: " + VALUES_ATTRIBUTE_NAME);
  }
  if (required == null) {
    throw new InvalidSchemaException("Missing attribute: " + REQUIRED_ATTRIBUTE_NAME);
  }
  if (attrs.size() != 3) {
    throw new InvalidSchemaException("Encountered more attributes than the expected three");
  }
  checkAttributeName(name);
  if (required.equals(TRUE_ATTRIBUTE_VALUE)) {
    attributesPattern.addRequired(name);
  } else if (!required.equals(FALSE_ATTRIBUTE_VALUE)) {
    throw new InvalidSchemaException(
        "Invalid value for attribute " + REQUIRED_ATTRIBUTE_NAME + ": " + required);
  }
  RegularExpressionChecker.checkRegularExpression(values);
  attributesPattern.addValuePattern(name, values);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:27,代码来源:SchemaFactory.java

示例2: handleText

import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
final void handleText(Attributes attrs) throws InvalidSchemaException {
  String type = attrs.get(TYPE_ATTRIBUTE_NAME);
  String chars = attrs.get(CHARACTERS_ATTRIBUTE_NAME);
  if (type == null) {
    throw new InvalidSchemaException("Missing attribute: " + TYPE_ATTRIBUTE_NAME);
  }
  if (chars == null) {
    throw new InvalidSchemaException("Missing attribute: " + CHARACTERS_ATTRIBUTE_NAME);
  }
  if (attrs.size() != 2) {
    throw new InvalidSchemaException("Encountered more attributes than the expected two");
  }
  if (type.equals(BLACKLIST_ATTRIBUTE_VALUE)) {
    characterPattern.blacklistCharacters(extractCodePoints(chars));
  } else if (type.equals(WHITELIST_ATTRIBUTE_VALUE)) {
    characterPattern.whitelistCharacters(extractCodePoints(chars));
  } else {
    throw new InvalidSchemaException(
        "Invalid value for attribute " + TYPE_ATTRIBUTE_NAME + ": " + type);
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:SchemaFactory.java

示例3: extractName

import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
private static String extractName(String elementType, Attributes attrs)
    throws InvalidSchemaException {
  String name = attrs.get(NAME_ATTRIBUTE_NAME);
  if (name == null) {
    throw new InvalidSchemaException(
        "Missing attribute \"" + NAME_ATTRIBUTE_NAME + "\" in element: " + elementType);
  }
  if (attrs.size() != 1) {
    throw new InvalidSchemaException(
        "Encountered an attribute other than \"" + NAME_ATTRIBUTE_NAME + "\" in element: "
        + elementType);
  }
  return name;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:15,代码来源:SchemaFactory.java

示例4: deleteElementStart

import org.waveprotocol.wave.model.document.operation.Attributes; //导入方法依赖的package包/类
@Override
public void deleteElementStart(String type, Attributes attrs) {
  String deletedThreadId = null;
  boolean isInlineThread = Blips.THREAD_INLINE_ANCHOR_TAGNAME.equals(type);
  if (isInlineThread) {
    deletedThreadId = attrs.get("id");
    if (!isThreadDeletionDiff(deletedThreadId)) {
      target.deleteElementStart(type, attrs);
      return;
    }
  } else {
    if (!isDiff) {
      target.deleteElementStart(type, attrs);
      return;
    }
  }

  // deletion annotations within insertion annotations are annihilated
  // exception: deletion of inline threads
  if (diffDepth == 0 && (isOutsideInsertionAnnotation() || isInlineThread)) {
    ContentElement currentElement = (ContentElement) inner.getCurrentNode();
    Element e = currentElement.getImplNodelet();

    // HACK(danilatos): Line rendering is somewhat special, so special case it
    // for now. Once there are more use cases, we can figure out an appropriate
    // generalisation for this.
    if (LineRendering.isLineElement(currentElement)) {
      // This loses paragraph-level formatting, but is better than nothing.
      // Indentation and direction inherit from the pervious line, which is
      // quite acceptable.
      e = Document.get().createBRElement();
    }

    if (e != null) {
      if (isInlineThread) {
        // Move reply to the temporary place outside the document implementation
        // where it can be found by id
        Document.get().getDocumentElement().appendChild(e);
      } else
      {
        e = e.cloneNode(true).cast();
        deletify(e);
      }
      updateDeleteInfo();
      getCurrentDeleteInfo().add(e, deletedThreadId);
    }
  }

  diffDepth++;

  target.deleteElementStart(type, attrs);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:53,代码来源:DiffHighlightingFilter.java


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