use of org.apache.asterix.om.pointables.printer.IPrintVisitor in project asterixdb by apache.
the class AObjectPrinterFactory method createPrinter.
@Override
public IPrinter createPrinter() {
final ARecordVisitablePointable rPointable = new ARecordVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
final AListVisitablePointable olPointable = new AListVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE);
final AListVisitablePointable ulPointable = new AListVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_AUNORDERED_LIST_TYPE);
final Pair<PrintStream, ATypeTag> streamTag = new Pair<>(null, null);
final IPrintVisitor visitor = new APrintVisitor();
return (byte[] b, int s, int l, PrintStream ps) -> {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[s]);
if (!printFlatValue(typeTag, b, s, l, ps)) {
streamTag.first = ps;
streamTag.second = typeTag;
switch(typeTag) {
case OBJECT:
rPointable.set(b, s, l);
visitor.visit(rPointable, streamTag);
break;
case ARRAY:
olPointable.set(b, s, l);
visitor.visit(olPointable, streamTag);
break;
case MULTISET:
ulPointable.set(b, s, l);
visitor.visit(ulPointable, streamTag);
break;
default:
throw new HyracksDataException("No printer for type " + typeTag);
}
}
};
}
use of org.apache.asterix.om.pointables.printer.IPrintVisitor in project asterixdb by apache.
the class AObjectPrinterFactory method createPrinter.
@Override
public IPrinter createPrinter() {
final ARecordVisitablePointable rPointable = new ARecordVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
final AListVisitablePointable olPointable = new AListVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE);
final AListVisitablePointable ulPointable = new AListVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_AUNORDERED_LIST_TYPE);
final Pair<PrintStream, ATypeTag> streamTag = new Pair<>(null, null);
final IPrintVisitor visitor = new APrintVisitor();
return (byte[] b, int s, int l, PrintStream ps) -> {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[s]);
if (!printFlatValue(typeTag, b, s, l, ps)) {
streamTag.first = ps;
streamTag.second = typeTag;
switch(typeTag) {
case OBJECT:
rPointable.set(b, s, l);
visitor.visit(rPointable, streamTag);
break;
case ARRAY:
olPointable.set(b, s, l);
visitor.visit(olPointable, streamTag);
break;
case MULTISET:
ulPointable.set(b, s, l);
visitor.visit(ulPointable, streamTag);
break;
default:
throw new HyracksDataException("No printer for type " + typeTag);
}
}
};
}
use of org.apache.asterix.om.pointables.printer.IPrintVisitor in project asterixdb by apache.
the class AObjectPrinterFactory method createPrinter.
@Override
public IPrinter createPrinter() {
final ARecordVisitablePointable rPointable = new ARecordVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
final Pair<PrintStream, ATypeTag> streamTag = new Pair<>(null, null);
final IPrintVisitor visitor = new APrintVisitor();
return (byte[] b, int s, int l, PrintStream ps) -> {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[s]);
if (!printFlatValue(typeTag, b, s, l, ps)) {
streamTag.first = ps;
streamTag.second = typeTag;
switch(typeTag) {
case OBJECT:
rPointable.set(b, s, l);
visitor.visit(rPointable, streamTag);
break;
default:
throw new HyracksDataException("No printer for type " + typeTag);
}
}
};
}
use of org.apache.asterix.om.pointables.printer.IPrintVisitor in project asterixdb by apache.
the class AObjectPrinterFactory method createPrinter.
@Override
public IPrinter createPrinter() {
final ARecordVisitablePointable rPointable = new ARecordVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
final AListVisitablePointable olPointable = new AListVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE);
final AListVisitablePointable ulPointable = new AListVisitablePointable(DefaultOpenFieldType.NESTED_OPEN_AUNORDERED_LIST_TYPE);
final Pair<PrintStream, ATypeTag> streamTag = new Pair<>(null, null);
final IPrintVisitor visitor = new APrintVisitor();
return (byte[] b, int s, int l, PrintStream ps) -> {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[s]);
if (!printFlatValue(typeTag, b, s, l, ps)) {
streamTag.first = ps;
streamTag.second = typeTag;
switch(typeTag) {
case OBJECT:
rPointable.set(b, s, l);
visitor.visit(rPointable, streamTag);
break;
case ARRAY:
olPointable.set(b, s, l);
visitor.visit(olPointable, streamTag);
break;
case MULTISET:
ulPointable.set(b, s, l);
visitor.visit(ulPointable, streamTag);
break;
default:
throw new HyracksDataException("No printer for type " + typeTag);
}
}
};
}
Aggregations