當前位置: 首頁>>代碼示例>>Java>>正文


Java Casts.STRING_ONLY屬性代碼示例

本文整理匯總了Java中nl.basjes.parse.core.Casts.STRING_ONLY屬性的典型用法代碼示例。如果您正苦於以下問題:Java Casts.STRING_ONLY屬性的具體用法?Java Casts.STRING_ONLY怎麽用?Java Casts.STRING_ONLY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在nl.basjes.parse.core.Casts的用法示例。


在下文中一共展示了Casts.STRING_ONLY屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prepareForDissect

@Override
public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) {
    String name = extractFieldName(inputname, outputname);
    switch (name) {
        case "value":   return Casts.STRING_ONLY;
        case "expires": return Casts.STRING_OR_LONG;
        case "path":    return Casts.STRING_ONLY;
        case "domain":  return Casts.STRING_ONLY;
        case "comment": return Casts.STRING_ONLY;
        default:        return Casts.STRING_ONLY;
    }
}
 
開發者ID:nielsbasjes,項目名稱:logparser,代碼行數:12,代碼來源:ResponseSetCookieDissector.java

示例2: NotImplementedTokenParser

public NotImplementedTokenParser(final String nLogFormatToken, final String fieldPrefix, final String regEx, int nPrio) {
    super(nLogFormatToken,
        fieldPrefix + "_" + nLogFormatToken.toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9_]", "_"),
        "NOT_IMPLEMENTED",
        Casts.STRING_ONLY,
        regEx,
        nPrio);
}
 
開發者ID:nielsbasjes,項目名稱:logparser,代碼行數:8,代碼來源:TokenFormatDissector.java

示例3: prepareForDissect

@Override
public EnumSet<Casts> prepareForDissect(final String inputName, final String outputName) {
    requestedFields.add(outputName);
    for (Token token: logFormatTokens) {
        for (TokenOutputField tokenOutputField: token.getOutputFields()) {
            if (outputName.equals(tokenOutputField.getName())) {
                tokenOutputField.wasUsed();
                return tokenOutputField.getCasts();
            }
        }
    }
    return Casts.STRING_ONLY;
}
 
開發者ID:nielsbasjes,項目名稱:logparser,代碼行數:13,代碼來源:TokenFormatDissector.java

示例4: prepareForDissect

@Override
public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) {
    String name = extractFieldName(inputname, outputname);
    if ("protocol".equals(name)) {
        wantProtocol = true;
        return Casts.STRING_ONLY;
    }
    if ("userinfo".equals(name)) {
        wantUserinfo = true;
        return Casts.STRING_ONLY;
    }
    if ("host".equals(name)) {
        wantHost = true;
        return Casts.STRING_ONLY;
    }
    if ("port".equals(name)) {
        wantPort = true;
        return Casts.STRING_OR_LONG;
    }
    if ("path".equals(name)) {
        wantPath = true;
        return Casts.STRING_ONLY;
    }
    if ("query".equals(name)) {
        wantQuery = true;
        return Casts.STRING_ONLY;
    }
    if ("ref".equals(name)) {
        wantRef = true;
        return Casts.STRING_ONLY;
    }
    return null;
}
 
開發者ID:nielsbasjes,項目名稱:logparser,代碼行數:33,代碼來源:HttpUriDissector.java

示例5: prepareForDissect

@Override
public EnumSet<Casts> prepareForDissect(String s, String s1) {
    return Casts.STRING_ONLY; // We ONLY do Strings here
}
 
開發者ID:nielsbasjes,項目名稱:yauaa,代碼行數:4,代碼來源:UserAgentDissector.java

示例6: setupParser

private void setupParser(final MapWriter mapWriter, final String logFormat, final Map<String, String> fieldMapping)
    throws NoSuchMethodException, MissingDissectorsException, InvalidDissectorException {

  /**
   * If the user has selected fields, then we will use them to configure the parser because this would be the most
   * efficient way to parse the log.
   */
  final Map<String, String> requestedPaths;
  final List<String> allParserPaths = parser.getPossiblePaths();
  if (fieldMapping != null && !fieldMapping.isEmpty()) {
    LOG.debug("Using fields defined by user.");
    requestedPaths = fieldMapping;
  }
  else {
    /**
     * Use all possible paths that the parser has determined from the specified log format.
     */
    LOG.debug("No fields defined by user, defaulting to all possible fields.");
    requestedPaths = Maps.newHashMap();
    for (final String parserPath : allParserPaths) {
      requestedPaths.put(drillFormattedFieldName(parserPath), parserPath);
    }
  }

  /**
   * By adding the parse target to the dummy instance we activate it for use. Which we can then use to find out which
   * paths cast to which native data types. After we are done figuring this information out, we throw this away
   * because this will be the slowest parsing path possible for the specified format.
   */
  Parser<Object> dummy = new HttpdLoglineParser<>(Object.class, logFormat);
  dummy.addParseTarget(String.class.getMethod("indexOf", String.class), allParserPaths);

  for (final Map.Entry<String, String> entry : requestedPaths.entrySet()) {
    final EnumSet<Casts> casts;

    /**
     * Check the field specified by the user to see if it is supposed to be remapped.
     */
    if (entry.getValue().startsWith(REMAPPING_FLAG)) {
      /**
       * Because this field is being remapped we need to replace the field name that the parser uses.
       */
      entry.setValue(entry.getValue().substring(REMAPPING_FLAG.length()));

      final String[] pieces = entry.getValue().split(":");
      addTypeRemapping(parser, pieces[1], pieces[0]);

      casts = Casts.STRING_ONLY;
    }
    else {
      casts = dummy.getCasts(entry.getValue());
    }

    LOG.debug("Setting up drill field: {}, parser field: {}, which casts as: {}", entry.getKey(), entry.getValue(), casts);
    record.addField(parser, mapWriter, casts, entry.getValue(), entry.getKey());
  }
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:57,代碼來源:HttpdParser.java

示例7: prepareForDissect

@Override
public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) {
    return Casts.STRING_ONLY;
}
 
開發者ID:nielsbasjes,項目名稱:logparser,代碼行數:4,代碼來源:UrlClassDissector.java

示例8: prepareForDissect

@Override
public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) {
    requestedParameters.add(extractFieldName(inputname, outputname));
    return Casts.STRING_ONLY;
}
 
開發者ID:nielsbasjes,項目名稱:logparser,代碼行數:5,代碼來源:HttpFirstLineDissector.java

示例9: prepareForDissect

@Override
public EnumSet<Casts> prepareForDissect(String inputname, String outputname) {
    return Casts.STRING_ONLY;
}
 
開發者ID:nielsbasjes,項目名稱:logparser,代碼行數:4,代碼來源:StrfTimeStampDissector.java

示例10: prepareForDissect

@Override
public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) {
    requestedCookies.add(extractFieldName(inputname, outputname));
    return Casts.STRING_ONLY;
}
 
開發者ID:nielsbasjes,項目名稱:logparser,代碼行數:5,代碼來源:RequestCookieListDissector.java


注:本文中的nl.basjes.parse.core.Casts.STRING_ONLY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。