@Test public void test1() throws BlurException { ThriftCacheValue<BlurResults> thriftCacheValue = new ThriftCacheValue<BlurResults>(null); BlurResults results = thriftCacheValue.getValue(BlurResults.class); assertNull(results); }
public T getValue(Class<T> clazz) throws BlurException { if (_data == null) { return null; } try { T t = clazz.newInstance(); t.read(new TCompactProtocol(new TMemoryInputTransport(_data))); return t; } catch (InstantiationException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (IllegalAccessException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (TException e) { throw new BException("Unknown error while trying to read from cache.", e); } }
ThriftCacheValue { public T getValue(Class<T> clazz) throws BlurException { if (_data == null) { return null; } try { T t = clazz.newInstance(); t.read(new TCompactProtocol(new TMemoryInputTransport(_data))); return t; } catch (InstantiationException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (IllegalAccessException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (TException e) { throw new BException("Unknown error while trying to read from cache.", e); } } }
ThriftCacheValue { public T getValue(Class<T> clazz) throws BlurException { if (_data == null) { return null; } try { T t = clazz.newInstance(); t.read(new TCompactProtocol(new TMemoryInputTransport(_data))); return t; } catch (InstantiationException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (IllegalAccessException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (TException e) { throw new BException("Unknown error while trying to read from cache.", e); } } ThriftCacheValue(T t); }
ThriftCacheValue { public T getValue(Class<T> clazz) throws BlurException { if (_data == null) { return null; } try { T t = clazz.newInstance(); t.read(new TCompactProtocol(new TMemoryInputTransport(_data))); return t; } catch (InstantiationException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (IllegalAccessException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (TException e) { throw new BException("Unknown error while trying to read from cache.", e); } } ThriftCacheValue(T t); static byte[] toBytes(T t); static byte[] trim(byte[] bs, int len); int size(); T getValue(Class<T> clazz); @Override int hashCode(); @Override boolean equals(Object obj); }
ThriftCacheValue { public T getValue(Class<T> clazz) throws BlurException { if (_data == null) { return null; } try { T t = clazz.newInstance(); t.read(new TCompactProtocol(new TMemoryInputTransport(_data))); return t; } catch (InstantiationException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (IllegalAccessException e) { throw new BException("Unknown error while trying to read from cache.", e); } catch (TException e) { throw new BException("Unknown error while trying to read from cache.", e); } } ThriftCacheValue(T t); static byte[] toBytes(T t); static byte[] trim(byte[] bs, int len); int size(); T getValue(Class<T> clazz); @Override int hashCode(); @Override boolean equals(Object obj);  }