use of com.amazon.ion.IonSymbol in project ion-hive-serde by amzn.
the class IonStructToMapObjectInspector method getMapValueElement.
@Override
public Object getMapValueElement(final Object data, final Object key) {
if (IonUtil.isIonNull((IonValue) data)) {
return null;
}
if (key == null) {
throw new IllegalArgumentException("key cannot be null");
}
final IonStruct struct = (IonStruct) data;
final IonSymbol symbol = (IonSymbol) key;
return struct.get(symbol.stringValue());
}
use of com.amazon.ion.IonSymbol in project ion-java by amzn.
the class IonReaderTreeUserX method next_helper_user.
boolean next_helper_user() {
if (_eof)
return false;
if (_next != null)
return true;
clear_system_value_stack();
// read values from the system
// reader and if they are system values
// process them. Return when we've
// read all the immediate system values
IonType next_type;
for (; ; ) {
next_type = next_helper_system();
if (_top == 0 && _parent instanceof IonDatagram) {
if (IonType.SYMBOL.equals(next_type)) {
assert (_next instanceof IonSymbol);
IonSymbol sym = (IonSymbol) _next;
if (sym.isNullValue()) {
// there are no null values we will consume here
break;
}
int sid = sym.getSymbolId();
if (sid == UNKNOWN_SYMBOL_ID) {
String name = sym.stringValue();
if (name != null) {
sid = _system_symtab.findSymbol(name);
}
}
if (sid == ION_1_0_SID && _next.getTypeAnnotationSymbols().length == 0) {
// $ion_1_0 is read as an IVM only if it is not annotated
SymbolTable symbols = _system_symtab;
_symbols = symbols;
push_symbol_table(symbols);
_next = null;
continue;
}
} else if (IonType.STRUCT.equals(next_type) && _next.findTypeAnnotation(ION_SYMBOL_TABLE) == 0) {
assert (_next instanceof IonStruct);
// read a local symbol table
IonReader reader = new IonReaderTreeUserX(_next, _catalog, _lstFactory);
SymbolTable symtab = _lstFactory.newLocalSymtab(_catalog, reader, false);
_symbols = symtab;
push_symbol_table(symtab);
_next = null;
continue;
}
}
// so this is a value the user gets
break;
}
return (next_type != null);
}
use of com.amazon.ion.IonSymbol in project ion-java by amzn.
the class _Private_CurriedValueFactory method newSymbol.
public IonSymbol newSymbol(SymbolToken value) {
IonSymbol v = myFactory.newSymbol(value);
handle(v);
return v;
}
use of com.amazon.ion.IonSymbol in project ion-java by amzn.
the class _Private_CurriedValueFactory method newNullSymbol.
// -------------------------------------------------------------------------
public IonSymbol newNullSymbol() {
IonSymbol v = myFactory.newNullSymbol();
handle(v);
return v;
}
use of com.amazon.ion.IonSymbol in project ion-java by amzn.
the class IonWriterTestCase method testWriteSymbolTokenWithGoodSid.
@Test
public void testWriteSymbolTokenWithGoodSid() throws Exception {
iw = makeWriter();
iw.writeSymbolToken(newSymbolToken((String) null, NAME_SID));
IonDatagram dg = reload();
IonSymbol s = (IonSymbol) dg.get(0);
checkSymbol(SystemSymbols.NAME, NAME_SID, s);
}
Aggregations