@Test public void testGetRenderer() { ResourceDefinition resource = getResourceDefinition(); assertTrue(resource.getRenderer(null) instanceof DefaultRenderer); assertTrue(resource.getRenderer("default") instanceof DefaultRenderer); assertTrue(resource.getRenderer("minimal") instanceof MinimalRenderer); try { resource.getRenderer("foo"); fail("Should have thrown an exception due to invalid renderer type"); } catch (IllegalArgumentException e) { } }
@Override public Renderer getRenderer(String name) { if (name == null || name.equals("default")) { return new DefaultRenderer(); } else if (name.equals("minimal")) { return new MinimalRenderer(); } else if (name.contains("null_padding") || name.contains("no_padding") || name.contains("zero_padding")) { return new MetricsPaddingRenderer(name); } else { throw new IllegalArgumentException("Invalid renderer name: " + name + " for resource of type: " + m_type); } }
BaseResourceDefinition implements ResourceDefinition { @Override public Renderer getRenderer(String name) { if (name == null || name.equals("default")) { return new DefaultRenderer(); } else if (name.equals("minimal")) { return new MinimalRenderer(); } else if (name.contains("null_padding") || name.contains("no_padding") || name.contains("zero_padding")) { return new MetricsPaddingRenderer(name); } else { throw new IllegalArgumentException("Invalid renderer name: " + name + " for resource of type: " + m_type); } } }
BaseResourceDefinition implements ResourceDefinition { @Override public Renderer getRenderer(String name) { if (name == null || name.equals("default")) { return new DefaultRenderer(); } else if (name.equals("minimal")) { return new MinimalRenderer(); } else if (name.contains("null_padding") || name.contains("no_padding") || name.contains("zero_padding")) { return new MetricsPaddingRenderer(name); } else { throw new IllegalArgumentException("Invalid renderer name: " + name + " for resource of type: " + m_type); } } BaseResourceDefinition(Resource.Type resourceType);  BaseResourceDefinition(Resource.Type resourceType, Resource.Type ... subTypes);  BaseResourceDefinition(Resource.Type resourceType,
                                Collection<Resource.Type> subTypes,
                                Map<DirectiveType, ? extends Collection<String>> directives); }
BaseResourceDefinition implements ResourceDefinition { @Override public Renderer getRenderer(String name) { if (name == null || name.equals("default")) { return new DefaultRenderer(); } else if (name.equals("minimal")) { return new MinimalRenderer(); } else if (name.contains("null_padding") || name.contains("no_padding") || name.contains("zero_padding")) { return new MetricsPaddingRenderer(name); } else { throw new IllegalArgumentException("Invalid renderer name: " + name + " for resource of type: " + m_type); } } BaseResourceDefinition(Resource.Type resourceType);  BaseResourceDefinition(Resource.Type resourceType, Resource.Type ... subTypes);  BaseResourceDefinition(Resource.Type resourceType,
                                Collection<Resource.Type> subTypes,
                                Map<DirectiveType, ? extends Collection<String>> directives); @Override Resource.Type getType(); @Override Set<SubResourceDefinition> getSubResourceDefinitions(); @Override List<PostProcessor> getPostProcessors(); @Override Renderer getRenderer(String name); @Override Collection<String> getReadDirectives(); @Override Collection<String> getCreateDirectives(); @Override Collection<String> getUpdateDirectives(); @Override Collection<String> getDeleteDirectives(); @Override boolean equals(Object o); @Override int hashCode(); @Override boolean isCreatable(); }
BaseResourceDefinition implements ResourceDefinition { @Override public Renderer getRenderer(String name) { if (name == null || name.equals("default")) { return new DefaultRenderer(); } else if (name.equals("minimal")) { return new MinimalRenderer(); } else if (name.contains("null_padding") || name.contains("no_padding") || name.contains("zero_padding")) { return new MetricsPaddingRenderer(name); } else { throw new IllegalArgumentException("Invalid renderer name: " + name + " for resource of type: " + m_type); } } BaseResourceDefinition(Resource.Type resourceType);  BaseResourceDefinition(Resource.Type resourceType, Resource.Type ... subTypes);  BaseResourceDefinition(Resource.Type resourceType,
                                Collection<Resource.Type> subTypes,
                                Map<DirectiveType, ? extends Collection<String>> directives); @Override Resource.Type getType(); @Override Set<SubResourceDefinition> getSubResourceDefinitions(); @Override List<PostProcessor> getPostProcessors(); @Override Renderer getRenderer(String name); @Override Collection<String> getReadDirectives(); @Override Collection<String> getCreateDirectives(); @Override Collection<String> getUpdateDirectives(); @Override Collection<String> getDeleteDirectives(); @Override boolean equals(Object o); @Override int hashCode(); @Override boolean isCreatable();  }