Package com.google.common.base

Examples of com.google.common.base.CharMatcher


  {
    /* 앞뒤 공백 제거 */
    String routeLine = StringUtils.trimToNull(line);
   
    /* 라우터 정보 : 라인에서 공백 및 탭을 구분하여 라우터 정보를 가지고 온다. */
    CharMatcher token    = CharMatcher.WHITESPACE.or(CharMatcher.is('\t'));            // 공백과 탭으로 구분한다.
    Splitter    splitter = Splitter.on(token).trimResults().omitEmptyStrings();        // 앞뒤공백을 제거하고 값이 빌 경우 구분에서 제외시킨다.
    String[]    words    = Iterables.toArray(splitter.split(routeLine), String.class); // 배열로 담는다.
   
    /* 라우터 정보 유효성 체크 */
    if(words.length != RouteConstants.ROUTE_INFO_ARR_LEN) // 정보구성이 3개가 아닌 경우 exception 처리한다.
View Full Code Here


      }
    };
  }

  @Generates private CharMatcher generateCharMatcher() {
    return new CharMatcher() {
      @Override public boolean matches(char c) {
        return false;
      }
      final String string = paramString(CharMatcher.class, generateInt());
      @Override public String toString() {
View Full Code Here

     * @param suffix
     * @return
     */
    private static String formatDirName(final String prefix, final String suffix) {
        // Replace all invalid characters with '-'
        final CharMatcher invalidCharacters = VALID_SUFFIX_CHARS.negate();
        return String.format("%s-%s", prefix, invalidCharacters.trimAndCollapseFrom(suffix.toLowerCase(), '-'));
    }
View Full Code Here

    }
   
  }
 
  private boolean htmlStyleAttributeHash(Map<String, AttributeValue> attrMap) throws JHamlInternalParseException {
    CharMatcher CLOSE_PAREN = CharMatcher.is(')');
    if (reader.isNextChar('(')) {
      reader.skip(1);
      ignoreWhitespaceIncludingNewline();
      boolean attrFound = htmlStyleAttributeMapping(attrMap, CharMatcher.WHITESPACE, CLOSE_PAREN);
      ignoreWhitespaceIncludingNewline();
View Full Code Here

//    fail();
//    return false;
   
  }
  private boolean attributeHash(Map<String, AttributeValue> attrMap) throws JHamlInternalParseException {
    CharMatcher COMMA = CharMatcher.is(',');
    CharMatcher CLOSE_BRACE = CharMatcher.is('}');
    if (reader.isNextChar('{')) {
      reader.skip(1);
      ignoreWhitespaceIncludingNewline();
      boolean attrFound = attributeMapping(attrMap, COMMA, CLOSE_BRACE);
      ignoreWhitespaceIncludingNewline();
View Full Code Here

//      String identifier = reader.consumeMatching(CharMatcher.JAVA_LETTER);
//      if (!identifier.isEmpty()) {
//        identifier += reader.consumeMatching(CharMatcher.JAVA_LETTER_OR_DIGIT);
//        return AttributeValue.literal(identifier);
//      }
      CharMatcher NUMBER_LITERAL_CHARS = CharMatcher.JAVA_LETTER_OR_DIGIT.or(CharMatcher.is('.'));
      if (CharMatcher.JAVA_DIGIT.indexIn(exp) == 0 && NUMBER_LITERAL_CHARS.matchesAllOf(exp)) {
        return AttributeValue.literal(helper.parseNumberLiteral(exp));
      }
      ImmutableSet<String> keywords = ImmutableSet.of("null","true","false");
      if (keywords.contains(exp)) {
        return AttributeValue.literal(exp);
View Full Code Here

  public static int getGeneration(StreamConfig config) throws IOException {
    Location streamLocation = config.getLocation();

    // Default generation is 0.
    int genId = 0;
    CharMatcher numMatcher = CharMatcher.inRange('0', '9');

    List<Location> locations = streamLocation.list();
    if (locations == null) {
      return 0;
    }

    for (Location location : locations) {
      if (numMatcher.matchesAllOf(location.getName()) && location.isDirectory()) {
        int id = Integer.parseInt(location.getName());
        if (id > genId) {
          genId = id;
        }
      }
View Full Code Here

       * The name must be a valid DNS name. From wikipedia: "The characters allowed in a label are a
       * subset of the ASCII character set, a and includes the characters a through z, A through Z,
       * digits 0 through 9". From Azure: Every Dash (-) Must Be Immediately Preceded and Followed
       * by a Letter or Number.
       */
      CharMatcher range = getAcceptableRange();
      if (!range.matchesAllOf(name))
         throw exception(name, "Should have lowercase ASCII letters, " + "numbers, or dashes");
   }
View Full Code Here

    @edu.umd.cs.findbugs.annotations.SuppressWarnings("GBU_GUAVA_BETA_CLASS_USAGE")
    @Override
    public List<String> doValidate(String source, String target) {
        ArrayList<String> errors = new ArrayList<String>();

        CharMatcher tabs = CharMatcher.is('\t');
        int sourceTabs = tabs.countIn(source);
        int targetTabs = tabs.countIn(target);
        if (sourceTabs > targetTabs) {
            errors.add(getMessages().targetHasFewerTabs(sourceTabs, targetTabs));
        } else if (targetTabs > sourceTabs) {
            errors.add(getMessages().targetHasMoreTabs(sourceTabs, targetTabs));
        }
View Full Code Here

       * The name must be a valid DNS name. From wikipedia: "The characters allowed in a label are a
       * subset of the ASCII character set, a and includes the characters a through z, A through Z,
       * digits 0 through 9". From Azure: Every Dash (-) Must Be Immediately Preceded and Followed
       * by a Letter or Number.
       */
      CharMatcher range = getAcceptableRange();
      if (!range.matchesAllOf(name))
         throw exception(name, "Should have lowercase ASCII letters, " + "numbers, or dashes");
   }
View Full Code Here

TOP

Related Classes of com.google.common.base.CharMatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.