Advertisement
Nitromouse

Untitled

Apr 21st, 2011
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. /**
  2.      * hacked
  3.      */
  4.     public void reallyInjectFragmentMembers(View view) {
  5.         checkNotNull(instance);
  6.  
  7.         Object value = null;
  8.  
  9.         try {
  10.  
  11.             value = view.findViewById(annotation.value());
  12.            
  13.  
  14.             if (value == null && Nullable.notNullable(field))
  15.                 throw new NullPointerException(String.format("Can't inject null value into %s.%s when field is not @Nullable", field.getDeclaringClass(), field.getName()));
  16.  
  17.             field.setAccessible(true);
  18.             field.set(instance, value);
  19.  
  20.         } catch (IllegalAccessException e) {
  21.             throw new RuntimeException(e);
  22.  
  23.         } catch (IllegalArgumentException f) {
  24.             throw new IllegalArgumentException(String.format("Can't assign %s value %s to %s field %s", value != null ? value.getClass() : "(null)", value,
  25.                     field.getType(), field.getName()));
  26.         }
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement