@Test public void propertyTest() throws Exception { Collection<PropertyBase> properties = parser.parseProperties("urn:resource:org/richfaces/cdk/xmlconfig/properties.xml"); assertEquals(1, properties.size()); PropertyBase property = Iterables.getOnlyElement(properties); assertEquals("ontest2", property.getName()); assertEquals("int", property.getType().getName()); assertEquals("test2 property", property.getDescription()); assertEquals("ontest2.png", property.getIcon().getSmallIcon()); assertEquals("test2 event property", property.getDisplayName()); assertEquals("3", property.getDefaultValue()); assertEquals("15", property.getSuggestedValue()); assertTrue(property.getGenerate()); assertTrue(property.isHidden()); assertTrue(property.isLiteral()); assertTrue(property.isPassThrough()); assertTrue(property.isRequired()); List<ClassName> signature = property.getSignature().getParameters(); assertEquals(2, signature.size()); String alias = property.getAliasFor(); assertEquals("bar", alias); }
public Collection<PropertyBase> parseProperties(String url) throws CdkException, FileNotFoundException { String schemaLocation = ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION; Class<Fragment> bindClass = Fragment.class; Fragment unmarshal = binding.unmarshal(url, schemaLocation, bindClass); if (null != unmarshal) { ComponentModel component = adapter.unmarshal(unmarshal); return component.getAttributes(); } else { return Collections.<PropertyBase>emptySet(); } }
FragmentParser { public Collection<PropertyBase> parseProperties(String url) throws CdkException, FileNotFoundException { String schemaLocation = ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION; Class<Fragment> bindClass = Fragment.class; Fragment unmarshal = binding.unmarshal(url, schemaLocation, bindClass); if (null != unmarshal) { ComponentModel component = adapter.unmarshal(unmarshal); return component.getAttributes(); } else { return Collections.<PropertyBase>emptySet(); } } }
FragmentParser { public Collection<PropertyBase> parseProperties(String url) throws CdkException, FileNotFoundException { String schemaLocation = ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION; Class<Fragment> bindClass = Fragment.class; Fragment unmarshal = binding.unmarshal(url, schemaLocation, bindClass); if (null != unmarshal) { ComponentModel component = adapter.unmarshal(unmarshal); return component.getAttributes(); } else { return Collections.<PropertyBase>emptySet(); } } @Inject  FragmentParser(JAXB binding); }
FragmentParser { public Collection<PropertyBase> parseProperties(String url) throws CdkException, FileNotFoundException { String schemaLocation = ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION; Class<Fragment> bindClass = Fragment.class; Fragment unmarshal = binding.unmarshal(url, schemaLocation, bindClass); if (null != unmarshal) { ComponentModel component = adapter.unmarshal(unmarshal); return component.getAttributes(); } else { return Collections.<PropertyBase>emptySet(); } } @Inject  FragmentParser(JAXB binding); Collection<PropertyBase> parseProperties(String url); }
FragmentParser { public Collection<PropertyBase> parseProperties(String url) throws CdkException, FileNotFoundException { String schemaLocation = ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION; Class<Fragment> bindClass = Fragment.class; Fragment unmarshal = binding.unmarshal(url, schemaLocation, bindClass); if (null != unmarshal) { ComponentModel component = adapter.unmarshal(unmarshal); return component.getAttributes(); } else { return Collections.<PropertyBase>emptySet(); } } @Inject  FragmentParser(JAXB binding); Collection<PropertyBase> parseProperties(String url);  }