Code example for LoadingCache

Methods: getUnchecked

    this.fieldAccessorCache = CacheBuilder.newBuilder().build(new FieldAccessorLoader());
  public FieldAccessor getFieldAccessor(TypeToken<?> type, String fieldName) {
    return fieldAccessorCache.getUnchecked(new FieldEntry(type, fieldName));
   * The {@link CacheLoader} for generating instance of {@link FieldAccessor} instance. 
  private static final class FieldAccessorLoader extends CacheLoader<FieldEntry, FieldAccessor> {
    // See if are able to use the "defineClass" method in the ClassLoader of the field class. 
    private final Method defineClass;
    FieldAccessorLoader() { 
      Method defineClass = null;
      try { 
        defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class,