Builder - An intermediate builder type that can be changed into a Stringpublic abstract class Printer<Builder> extends Object
Integers and ConceptMaps into a String).
The intermediate Builder type is used when the final type is different to the "in-progress" type when
creating it. For example, you may want to use a StringBuilder for Builder (for efficiency).
If you don't need a Builder type, then set it to the same type as String and implement
#complete(Builder) to just return its argument.| Constructor and Description |
|---|
Printer() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Builder |
answerGroup(AnswerGroup<?> answer)
Convert any
AnswerGroup into its print builder |
protected abstract Builder |
bool(boolean bool)
Convert any boolean into its print builder
|
protected Builder |
build(Object object)
Convert any object into its print builder
|
protected abstract Builder |
collection(Collection<?> collection)
Convert any collection into its print builder
|
protected abstract String |
complete(Builder builder)
Convert a builder into the final type
|
protected abstract Builder |
concept(Concept concept)
Convert any concept into its print builder
|
protected Builder |
conceptList(ConceptList answer)
Convert any
ConceptList into its print builder |
protected abstract Builder |
conceptMap(ConceptMap answer)
Convert any
ConceptMap into its print builder |
protected Builder |
conceptSet(ConceptSet answer)
Convert any
ConceptSet into its print builder |
protected abstract Builder |
conceptSetMeasure(ConceptSetMeasure answer)
Convert any
ConceptSetMeasure into its print builder |
static Printer<mjson.Json> |
jsonPrinter()
Constructs a special type of Printer: JsonPrinter
|
protected abstract Builder |
map(Map<?,?> map)
Convert any map into its print builder
|
protected abstract Builder |
object(Object object)
Default conversion behaviour if none of the more specific methods can be used
|
static Printer<StringBuilder> |
stringPrinter(boolean colorize,
AttributeType... attributeTypes)
Constructs a special type of Printer: StringPrinter
|
java.util.stream.Stream<String> |
toStream(java.util.stream.Stream<?> objects)
Convert a stream of objects into a stream of Strings to be printed
|
String |
toString(Object object)
Convert any object into a String to be printed
|
protected Builder |
value(Value answer)
Convert any
Value into its print builder |
public static Printer<StringBuilder> stringPrinter(boolean colorize, AttributeType... attributeTypes)
colorize - boolean parameter to determine if the String output should be colorizedattributeTypes - list of attribute types that should be included in the String outputpublic static Printer<mjson.Json> jsonPrinter()
public java.util.stream.Stream<String> toStream(java.util.stream.Stream<?> objects)
objects - the objects to be printed@CheckReturnValue public String toString(Object object)
object - the object to be printed@CheckReturnValue protected Builder build(Object object)
object - the object to convert into its print builder@CheckReturnValue protected abstract String complete(Builder builder)
builder - the builder to convert into the final type@CheckReturnValue protected abstract Builder concept(Concept concept)
concept - the concept to convert into its print builder@CheckReturnValue protected abstract Builder bool(boolean bool)
bool - the boolean to convert into its print builder@CheckReturnValue protected abstract Builder collection(Collection<?> collection)
collection - the collection to convert into its print builder@CheckReturnValue protected abstract Builder map(Map<?,?> map)
map - the map to convert into its print builder@CheckReturnValue protected abstract Builder answerGroup(AnswerGroup<?> answer)
AnswerGroup into its print builderanswer - is the answer result of a Graql Compute queries@CheckReturnValue protected Builder conceptList(ConceptList answer)
ConceptList into its print builderanswer - is the answer result of a Graql Compute queries@CheckReturnValue protected abstract Builder conceptMap(ConceptMap answer)
ConceptMap into its print builderanswer - is the answer result of a Graql Compute queries@CheckReturnValue protected Builder conceptSet(ConceptSet answer)
ConceptSet into its print builderanswer - is the answer result of a Graql Compute queries@CheckReturnValue protected abstract Builder conceptSetMeasure(ConceptSetMeasure answer)
ConceptSetMeasure into its print builderanswer - is the answer result of a Graql Compute queries@CheckReturnValue protected Builder value(Value answer)
Value into its print builderanswer - is the answer result of a Graql Compute queries@CheckReturnValue protected abstract Builder object(Object object)
object - the object to convert into its print builderCopyright © 2018 Grakn Labs Ltd. All rights reserved.