Source:
public void testXmlExampleIn107() throws Exception { javax.cache.Cache<Long, Product> productCache = cacheManager.getCache("productCache", Long.class, Product.class); assertThat(productCache, is(notNullValue())); Configuration<Long, Product> configuration = productCache.getConfiguration(Configuration.class); assertThat(configuration.getKeyType(), is(equalTo(Long.class))); assertThat(configuration.getValueType(), is(equalTo(Product.class))); Eh107ReverseConfiguration<Long, Product> eh107ReverseConfiguration = productCache.getConfiguration(Eh107ReverseConfiguration.class); assertThat(eh107ReverseConfiguration.isReadThrough(), is(true)); assertThat(eh107ReverseConfiguration.isWriteThrough(), is(true)); Product product = new Product(1L); productCache.put(1L, product); assertThat(productCache.get(1L).getId(), equalTo(product.getId())); product.setMutable("foo"); assertThat(productCache.get(1L).getMutable(), nullValue()); assertThat(productCache.get(1L), not(sameInstance(product))); javax.cache.Cache<Long, Customer> customerCache = cacheManager.getCache("customerCache", Long.class, Customer.class); assertThat(customerCache, is(notNullValue())); Configuration<Long, Customer> customerConfiguration = customerCache.getConfiguration(Configuration.class); assertThat(customerConfiguration.getKeyType(), is(equalTo(Long.class))); assertThat(customerConfiguration.getValueType(), is(equalTo(Customer.class))); Customer customer = new Customer(1L); customerCache.put(1L, customer); assertThat(customerCache.get(1L).getId(), equalTo(customer.getId())); }

Target:
public void testXmlExampleIn107() throws Exception { javax.cache.Cache<Long, Product> productCache = cacheManager.getCache("productCache", Long.class, Product.class); assertThat(productCache, is(notNullValue())); Configuration<Long, Product> configuration = productCache.getConfiguration(Configuration.class); assertThat(configuration.getKeyType(), is(equalTo(Long.class))); assertThat(configuration.getValueType(), is(equalTo(Product.class))); Eh107ReverseConfiguration<Long, Product> eh107ReverseConfiguration = productCache.getConfiguration(Eh107ReverseConfiguration.class); assertThat(eh107ReverseConfiguration.isReadThrough(), is(true)); assertThat(eh107ReverseConfiguration.isWriteThrough(), is(true)); assertThat(eh107ReverseConfiguration.isStoreByValue(), is(true)); Product product = new Product(1L); productCache.put(1L, product); assertThat(productCache.get(1L).getId(), equalTo(product.getId())); product.setMutable("foo"); assertThat(productCache.get(1L).getMutable(), nullValue()); assertThat(productCache.get(1L), not(sameInstance(product))); javax.cache.Cache<Long, Customer> customerCache = cacheManager.getCache("customerCache", Long.class, Customer.class); assertThat(customerCache, is(notNullValue())); Configuration<Long, Customer> customerConfiguration = customerCache.getConfiguration(Configuration.class); assertThat(customerConfiguration.getKeyType(), is(equalTo(Long.class))); assertThat(customerConfiguration.getValueType(), is(equalTo(Customer.class))); Customer customer = new Customer(1L); customerCache.put(1L, customer); assertThat(customerCache.get(1L).getId(), equalTo(customer.getId())); }