Java Code Examples for com.googlecode.totallylazy.Option#get()
The following examples show how to use
com.googlecode.totallylazy.Option#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonRecord.java From totallylazy with Apache License 2.0 | 5 votes |
@Override public Object put(String key, Object value) { try { Option<Field> field = field(key); if (field.isDefined()) { Field actual = field.get(); actual.set(this, Coercer.coerce(actual.getGenericType(), value)); return Fields.get(actual, this); } else { return _otherFields.put(key, value); } } catch (IllegalAccessException e) { throw lazyException(e); } }
Example 2
Source File: UnfoldRightIterator.java From totallylazy with Apache License 2.0 | 5 votes |
@Override protected A getNext() throws Exception { Option<Pair<A, B>> result = callable.call(state); if (result.isEmpty()) return finished(); Pair<A, B> pair = result.get(); state = pair.second(); return pair.first(); }
Example 3
Source File: Xml.java From totallylazy with Apache License 2.0 | 4 votes |
public static Node expectNode(final Node node, String xpath) { Option<Node> foundNode = selectNode(node, xpath); if (foundNode.isEmpty()) throw new NoSuchElementException("No node for xpath " + xpath); return foundNode.get(); }
Example 4
Source File: Xml.java From totallylazy with Apache License 2.0 | 4 votes |
public static Element expectElement(final Node node, String xpath) { Option<Element> element = selectElement(node, xpath); if (element.isEmpty()) throw new NoSuchElementException("No element for xpath " + xpath); return element.get(); }