org.skyscreamer.yoga.configuration
Class SimpleYogaEntityConfiguration<T>

java.lang.Object
  extended by org.skyscreamer.yoga.configuration.YogaEntityConfiguration<T>
      extended by org.skyscreamer.yoga.configuration.SimpleYogaEntityConfiguration<T>

public class SimpleYogaEntityConfiguration<T>
extends YogaEntityConfiguration<T>

A simple implementation of YogaEntityConfiguration. Allows easy creation of Spring XML configurations of existing entities. This is an example of a configuration for a hypothetical Person entity. The configuration states that id and name are core fields (returned by default), and address and favoriteColor can be selected: id name id name This example relies on the entity to specify the core fields (or not) via the @Core annotation. It further controls which getters can be selected as a security or safety measure.

Constructor Summary
SimpleYogaEntityConfiguration()
           
 
Method Summary
 Collection<String> getCoreFields()
          Returns a collection of core fields for an entity.
 Class<T> getEntityClass()
          Identifies the class supported by this configuration.
 Collection<String> getSelectableFields()
          Returns a collection of fields that can be selected on an entity.
 String getURITemplate()
          Specifies the template for the URL represented by this entity.
 void setCoreFields(List<String> coreFields)
          Setter for list of core fields for the entity being configured.
 void setEntityClass(Class<T> entityClass)
          Setter for entity class supported by this configuration.
 void setSelectableFields(List<String> selectableFields)
          Setter for list of selectable fields for the entity being configured.
 void setUriTemplate(String uriTemplate)
          Setter for URI template for the entity being configured
 
Methods inherited from class org.skyscreamer.yoga.configuration.YogaEntityConfiguration
getExtraFieldMethods, getExtraFieldNames, getProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleYogaEntityConfiguration

public SimpleYogaEntityConfiguration()
Method Detail

getEntityClass

public Class<T> getEntityClass()
Identifies the class supported by this configuration.

Overrides:
getEntityClass in class YogaEntityConfiguration<T>
Returns:
A class object for the entity being configured

getCoreFields

public Collection<String> getCoreFields()
Returns a collection of core fields for an entity. Core fields are returned by default, and do not require a selector. If an empty collection is returned no fields are considered core. If a null is returned, this setting will be ignored and the entity will be analyzed for core annotations. Except in the case of a null being returned, this configuration overrides (rather than extends) the entity configuration.

Overrides:
getCoreFields in class YogaEntityConfiguration<T>
Returns:
The collection of core field names

getSelectableFields

public Collection<String> getSelectableFields()
Returns a collection of fields that can be selected on an entity. If an empty collection is return, nothing can be selected. If a null is returned, this setting is ignored, and all getters on an entity and extra fields can be selected.

Overrides:
getSelectableFields in class YogaEntityConfiguration<T>
Returns:

getURITemplate

public String getURITemplate()
Specifies the template for the URL represented by this entity. This overrides any definition of @URITemplate in the entity itself. If this method returns null, it will default back to entity-specified behavior.

Overrides:
getURITemplate in class YogaEntityConfiguration<T>
Returns:
A URITemplate, or null if the entity should be examined for the template value.

setEntityClass

public void setEntityClass(Class<T> entityClass)
Setter for entity class supported by this configuration.

Parameters:
entityClass - A class object representing the entity

setCoreFields

public void setCoreFields(List<String> coreFields)
Setter for list of core fields for the entity being configured.

Parameters:
coreFields - A list of strings identifying the name of each core field

setSelectableFields

public void setSelectableFields(List<String> selectableFields)
Setter for list of selectable fields for the entity being configured.

Parameters:
selectableFields - A list of strings identifying the name of each selectable field

setUriTemplate

public void setUriTemplate(String uriTemplate)
Setter for URI template for the entity being configured

Parameters:
uriTemplate -


Copyright © 2013. All Rights Reserved.