本文整理汇总了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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例5: prepareForDissect
@Override
public EnumSet<Casts> prepareForDissect(String s, String s1) {
return Casts.STRING_ONLY; // We ONLY do Strings here
}
示例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());
}
}
示例7: prepareForDissect
@Override
public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) {
return Casts.STRING_ONLY;
}
示例8: prepareForDissect
@Override
public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) {
requestedParameters.add(extractFieldName(inputname, outputname));
return Casts.STRING_ONLY;
}
示例9: prepareForDissect
@Override
public EnumSet<Casts> prepareForDissect(String inputname, String outputname) {
return Casts.STRING_ONLY;
}
示例10: prepareForDissect
@Override
public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) {
requestedCookies.add(extractFieldName(inputname, outputname));
return Casts.STRING_ONLY;
}