예제 #1
0
  static <T> Keyword<T> keyword() {
    Declaration declaration = Declaration.declaration();
    ParameterizedType parameterizedType = (ParameterizedType) declaration.type();

    return Keyword.keyword(
        declaration.name(),
        Unchecked.<Class<T>>cast(parameterizedType.getActualTypeArguments()[0]));
  }
예제 #2
0
 public static <K, V, M extends PersistentMap<K, V>> Pair<M, Option<V>> remove(M map, K key) {
   return Pair.pair(Unchecked.<M>cast(map.delete(key)), map.lookup(key));
 }
예제 #3
0
 public static <T> LogicalPredicate<T> in(final Iterable<? extends T> iterable) {
   if (Sequences.isEmpty(iterable)) return never();
   return new InPredicate<T>(Unchecked.<Iterable<T>>cast(iterable));
 }
예제 #4
0
 public static <K, V, M extends PersistentMap<K, V>> Pair<M, Option<V>> put(
     M map, K key, V newValue) {
   return Pair.pair(Unchecked.<M>cast(map.insert(key, newValue)), map.lookup(key));
 }
예제 #5
0
 public Record call(final Record source) throws Exception {
   return keywords.fold(
       Record.constructors.record(),
       (record, keyword) ->
           record.set(Unchecked.<Keyword<Object>>cast(keyword), keyword.call(source)));
 }