/** * Create a proxy object that filter object fields according to set of fields. * If a field is not specified in the set, the get method will return null. * (Primitive returned type cannot be filtered) * The filter is done recursively on sub items. * @param data the object to filter * @param fields list of fields to pass through. */ public Object createFilteredBean(Object data, Set<String> fields) { return createFilteredBean(data, fields, ""); }
@Operation(httpMethods = "GET", path = "/@cajole.supportedFields") public Set<String> cajaSupportedFields(RequestItem request) { return ImmutableSet.copyOf(beanFilter .getBeanFields(GadgetsHandlerApi.CajaResponse.class, 5)); }
@Test public void testProcessFields() { Set<String> srcFields = ImmutableSet.of("A", "b", "c.d.e.f", "Case", "cAse", "CASE"); Set<String> newFields = beanFilter.processBeanFields(srcFields); assertEquals(7, newFields.size()); assertTrue(newFields.contains("a")); assertTrue(newFields.contains("b")); assertTrue(newFields.contains("c")); assertTrue(newFields.contains("c.d")); assertTrue(newFields.contains("c.d.e")); assertTrue(newFields.contains("c.d.e.f")); assertTrue(newFields.contains("case")); }
@Before public void setUp() { tokenCodec = new FakeSecurityTokenCodec(); gadgetHandler = new GadgetsHandlerService(processor, urlGenerator, tokenCodec, new BeanFilter()); }
@Test public void testProcessFields() { Set<String> srcFields = ImmutableSet.of("A", "b", "c.d.e.f", "Case", "cAse", "CASE"); Set<String> newFields = beanFilter.processBeanFields(srcFields); assertEquals(7, newFields.size()); assertTrue(newFields.contains("a")); assertTrue(newFields.contains("b")); assertTrue(newFields.contains("c")); assertTrue(newFields.contains("c.d")); assertTrue(newFields.contains("c.d.e")); assertTrue(newFields.contains("c.d.e.f")); assertTrue(newFields.contains("case")); }
@Before public void setUp() { beanFilter = new BeanFilter(); beanDelegator = BeanDelegatorTest.createSimpleDelegator(); }
/** * Create a proxy object that filter object fields according to set of fields. * If a field is not specified in the set, the get method will return null. * (Primitive returned type cannot be filtered) * The filter is done recursively on sub items. * @param data the object to filter * @param fields list of fields to pass through. */ public Object createFilteredBean(Object data, Set<String> fields) { return createFilteredBean(data, fields, ""); }
@Operation(httpMethods = "GET", path = "/@metadata.supportedFields") public Set<String> supportedFields(RequestItem request) { return ImmutableSet.copyOf(beanFilter .getBeanFields(GadgetsHandlerApi.MetadataResponse.class, 5)); }
@Test public void testProcessFields() { Set<String> srcFields = ImmutableSet.of("A", "b", "c.d.e.f", "Case", "cAse", "CASE"); Set<String> newFields = beanFilter.processBeanFields(srcFields); assertEquals(7, newFields.size()); assertTrue(newFields.contains("a")); assertTrue(newFields.contains("b")); assertTrue(newFields.contains("c")); assertTrue(newFields.contains("c.d")); assertTrue(newFields.contains("c.d.e")); assertTrue(newFields.contains("c.d.e.f")); assertTrue(newFields.contains("case")); }
@Before public void setUp() { beanFilter = new BeanFilter(); beanDelegator = BeanDelegatorTest.createSimpleDelegator(); }
/** * Create a proxy object that filter object fields according to set of fields. * If a field is not specified in the set, the get method will return null. * (Primitive returned type cannot be filtered) * The filter is done recursively on sub items. * @param data the object to filter * @param fields list of fields to pass through. */ public Object createFilteredBean(Object data, Set<String> fields) { return createFilteredBean(data, fields, ""); }
@Operation(httpMethods = "GET", path = "/@token.supportedFields") public Set<String> tokenSupportedFields(RequestItem request) { return ImmutableSet.copyOf( beanFilter.getBeanFields(GadgetsHandlerApi.TokenResponse.class, 5)); }
@Test public void testProcessFields() { Set<String> srcFields = ImmutableSet.of("A", "b", "c.d.e.f", "Case", "cAse", "CASE"); Set<String> newFields = beanFilter.processBeanFields(srcFields); assertEquals(7, newFields.size()); assertTrue(newFields.contains("a")); assertTrue(newFields.contains("b")); assertTrue(newFields.contains("c")); assertTrue(newFields.contains("c.d")); assertTrue(newFields.contains("c.d.e")); assertTrue(newFields.contains("c.d.e.f")); assertTrue(newFields.contains("case")); }
@Before public void setUp() { beanFilter = new BeanFilter(); beanDelegator = BeanDelegatorTest.createSimpleDelegator(); }
/** * Create a proxy object that filter object fields according to set of fields. * If a field is not specified in the set, the get method will return null. * (Primitive returned type cannot be filtered) * The filter is done recursively on sub items. * @param data the object to filter * @param fields list of fields to pass through. */ public Object createFilteredBean(Object data, Set<String> fields) { return createFilteredBean(data, fields, ""); }
@Operation(httpMethods = "GET", path = "/@js.supportedFields") public Set<String> jsSupportedFields(RequestItem request) { return ImmutableSet.copyOf( beanFilter.getBeanFields(GadgetsHandlerApi.JsResponse.class, 5)); }
@Test public void testProcessFields() { Set<String> srcFields = ImmutableSet.of("A", "b", "c.d.e.f", "Case", "cAse", "CASE"); Set<String> newFields = beanFilter.processBeanFields(srcFields); assertEquals(7, newFields.size()); assertTrue(newFields.contains("a")); assertTrue(newFields.contains("b")); assertTrue(newFields.contains("c")); assertTrue(newFields.contains("c.d")); assertTrue(newFields.contains("c.d.e")); assertTrue(newFields.contains("c.d.e.f")); assertTrue(newFields.contains("case")); }
@Before public void setUp() { beanFilter = new BeanFilter(); beanDelegator = BeanDelegatorTest.createSimpleDelegator(); }
/** * Create a proxy object that filter object fields according to set of fields. * If a field is not specified in the set, the get method will return null. * (Primitive returned type cannot be filtered) * The filter is done recursively on sub items. * @param data the object to filter * @param fields list of fields to pass through. */ public Object createFilteredBean(Object data, Set<String> fields) { return createFilteredBean(data, fields, ""); }
@Operation(httpMethods = "GET", path = "/@token.supportedFields") public Set<String> tokenSupportedFields(RequestItem request) { return ImmutableSet.copyOf( beanFilter.getBeanFields(GadgetsHandlerApi.TokenResponse.class, 5)); }