public FieldValue create() { return new StringFieldValue(); } }
@Override public Serializer put(FieldBase field, String value) { write(field, new StringFieldValue(value)); return this; }
private static FieldValue asString(List<FieldValue> outputs) { StringBuilder ret = new StringBuilder(); for (FieldValue val : outputs) { if (val == null) { return null; } ret.append(val.toString()); } return new StringFieldValue(ret.toString()); }
final public FieldValue stringValue() throws ParseException {String val; val = string(); {if ("" != null) return new StringFieldValue(val);} throw new IllegalStateException ("Missing return statement in function"); }
public final FieldValue setFieldValue(Field field, String value) { return setFieldValue(field, new StringFieldValue(value)); }
public final FieldValue setFieldValue(String field, String value) { return setFieldValue(field, new StringFieldValue(value)); }
@Override protected void doExecute(ExecutionContext ctx) { ctx.setValue(new StringFieldValue(String.valueOf(ctx.getValue()).trim())); }
@SuppressWarnings({ "unchecked" }) private List<ValueUpdate> createMapValueUpdatesForStruct(StructuredFieldValue struct, MapValueUpdate upd) { List<ValueUpdate> ret = new ArrayList<>(); for (Iterator<Map.Entry<Field, FieldValue>> it = struct.iterator(); it.hasNext();) { Map.Entry<Field, FieldValue> entry = it.next(); for (ValueUpdate childUpd : createValueUpdates(entry.getValue(), upd.getUpdate())) { ret.add(new MapValueUpdate(new StringFieldValue(entry.getKey().getName()), childUpd)); } } return ret; }
@Override protected void doExecute(ExecutionContext ctx) { String input = String.valueOf(ctx.getValue()); int len = input.length(); if (from >= len) { input = ""; } else if (to >= len) { input = input.substring(from); } else { input = input.substring(from, to); } ctx.setValue(new StringFieldValue(input)); }
/** * Creates a TERM annotation which has the lowercase value as annotation (only) if it is different from the * original. * * @param termToLowerCase The term to lower case. * @param origTerm The original term. * @return the created TERM annotation. */ public static Annotation lowerCaseTermAnnotation(String termToLowerCase, String origTerm) { String annotationValue = toLowerCase(termToLowerCase); if (annotationValue.equals(origTerm)) { return new Annotation(AnnotationTypes.TERM); } return new Annotation(AnnotationTypes.TERM, new StringFieldValue(annotationValue)); }
@Override protected void doExecute(ExecutionContext ctx) { ctx.setValue(new StringFieldValue(String.valueOf(ctx.getValue()))); }
/** * Convenience method for adding an annotation to this span, same as * <code>getSpanTree().{@link SpanTree#annotate(SpanNode,AnnotationType,FieldValue) spanTree.annotate(this,type,new StringFieldValue(value))}</code> * * @param type the type of the annotation to add * @param value the string value of the annotation to add * @return this for chaining * @throws NullPointerException if this span is not attached to a tree */ public SpanNode annotate(AnnotationType type,String value) { getNonNullSpanTree().annotate(this, type, new StringFieldValue(value)); return this; }
@SuppressWarnings({ "unchecked" }) @Override protected void doExecute(ExecutionContext ctx) { FieldValue input = ctx.getValue(); if (!(input instanceof Array)) { throw new IllegalArgumentException("Expected Array input, got " + input.getDataType().getName() + "."); } StringBuilder output = new StringBuilder(); for (Iterator<FieldValue> it = ((Array)input).fieldValueIterator(); it.hasNext(); ) { output.append(String.valueOf(it.next())); if (it.hasNext()) { output.append(delimiter); } } ctx.setValue(new StringFieldValue(output.toString())); }
@Override protected void doExecute(ExecutionContext ctx) { ctx.setValue(new StringFieldValue(toLowerCase(String.valueOf(ctx.getValue())))); }
@Override protected void doExecute(ExecutionContext ctx) { long input = ((LongFieldValue)ctx.getValue()).getLong(); ctx.setValue(new StringFieldValue(Long.toHexString(input))); }
@Override protected void doExecute(ExecutionContext ctx) { String input = String.valueOf(ctx.getValue()); Array<StringFieldValue> output = new Array<>(DataType.getArray(DataType.STRING)); if (!input.isEmpty()) { String[] splits = splitPattern.split(input); for (String split : splits) { output.add(new StringFieldValue(split)); } } ctx.setValue(output); }
@Override protected void doExecute(ExecutionContext ctx) { long input = ((LongFieldValue)ctx.getValue()).getLong(); byte[] output = new byte[8]; for (int i = 0; i < output.length; ++i) { output[i] = (byte)(input & 0xffL); input >>>= 8; } String encoded = new Base64(0).encodeToString(output); ctx.setValue(new StringFieldValue(encoded)); }
public Document createRandomDocumentAtLocation(long location, long timestamp, int minSize, int maxSize) { Document document = new Document(getDocumentType("testdoctype1"), new DocumentId("userdoc:footype:" + location + ":" + timestamp)); document.setFieldValue("headerval", new IntegerFieldValue((int)timestamp)); StringBuffer value = new StringBuffer(); int length = (int)(Math.random() * (maxSize - minSize)) + minSize; for (int i = 0; i < length; ++i) { value.append("A"); } document.setFieldValue("content", new StringFieldValue(value.toString())); return document; } }
@Override protected void doExecute(ExecutionContext context) { Transformer transformer = linguistics.getTransformer(); context.setValue(new StringFieldValue(transformer.accentDrop(String.valueOf(context.getValue()), context.resolveLanguage(linguistics)))); }
@Override protected void doExecute(ExecutionContext ctx) { ctx.setValue(new StringFieldValue(normalizeHostName(getDefaults().vespaHostname()))); }