SMall cleanup
This commit is contained in:
parent
e4930e5edb
commit
b79284009d
2 changed files with 29 additions and 13 deletions
|
|
@ -51,7 +51,7 @@ public class Configurator<T> {
|
|||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME) // Make this annotation accessible at runtime via reflection.
|
||||
@Target({ElementType.FIELD}) // This annotation can only be applied to class fields.
|
||||
public static @interface Configurable{
|
||||
public @interface Configurable{
|
||||
/** Nice name of this parameter **/
|
||||
String value();
|
||||
/** Defines the order the parameters, in ascending order **/
|
||||
|
|
@ -59,7 +59,7 @@ public class Configurator<T> {
|
|||
}
|
||||
|
||||
|
||||
public static enum ConfigType{
|
||||
public enum ConfigType{
|
||||
STRING, INT, BOOLEAN
|
||||
}
|
||||
|
||||
|
|
@ -71,11 +71,13 @@ public class Configurator<T> {
|
|||
private PreConfigurationActionListener<T> preListener;
|
||||
private PostConfigurationActionListener<T> postListener;
|
||||
|
||||
|
||||
public Configurator(T obj){
|
||||
this.obj = obj;
|
||||
this.params = getConfiguration(obj.getClass(), obj);
|
||||
}
|
||||
|
||||
|
||||
public T getObject(){
|
||||
return obj;
|
||||
}
|
||||
|
|
@ -111,6 +113,8 @@ public class Configurator<T> {
|
|||
|
||||
/**
|
||||
* Uses a Map to assign all parameters of the Object
|
||||
*
|
||||
* @return a reference to itself so that metodcalls can be chained.
|
||||
*/
|
||||
public Configurator<T> setValues(Map<String,String> parameters){
|
||||
for(ConfigurationParam param : this.params){
|
||||
|
|
@ -123,6 +127,8 @@ public class Configurator<T> {
|
|||
/**
|
||||
* Uses a Map to assign all parameters of the Object.
|
||||
* NOTE: the DataNode must be of type Map
|
||||
*
|
||||
* @return a reference to itself so that metodcalls can be chained.
|
||||
*/
|
||||
public Configurator<T> setValues(DataNode node){
|
||||
if(!node.isMap())
|
||||
|
|
@ -165,8 +171,10 @@ public class Configurator<T> {
|
|||
* been configured if it implements the PreConfigurationActionListener interface.
|
||||
* The postConfigurationAction() method will be called after the target object is
|
||||
* configured if it implements the PostConfigurationActionListener interface.
|
||||
*
|
||||
* @return a reference to itself so that metodcalls can be chained.
|
||||
*/
|
||||
public void applyConfiguration(){
|
||||
public Configurator<T> applyConfiguration(){
|
||||
if(preListener != null)
|
||||
preListener.preConfigurationAction(this, obj);
|
||||
if(obj instanceof PreConfigurationActionListener)
|
||||
|
|
@ -195,6 +203,8 @@ public class Configurator<T> {
|
|||
((PostConfigurationActionListener<T>) obj).postConfigurationAction(this, obj);
|
||||
if(postListener != null)
|
||||
postListener.postConfigurationAction(this, obj);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,21 @@ public class Navigation implements Iterable{
|
|||
(o != null && this.id == (((Navigation)o).id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static Navigation createRootNav(){
|
||||
return new Navigation(null, null);
|
||||
}
|
||||
public static Navigation getRootNav(Map<String, String> request) {
|
||||
List<Navigation> breadcrumb = getBreadcrumb(getParameterizedNavigation(request));
|
||||
if (!breadcrumb.isEmpty())
|
||||
return breadcrumb.get(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Will create a clone of the navigation tree with some request instance specific information
|
||||
*/
|
||||
|
|
@ -176,6 +191,7 @@ public class Navigation implements Iterable{
|
|||
}
|
||||
|
||||
|
||||
|
||||
public NavInstance createPagedNavInstance(HttpHeader header){
|
||||
Navigation nav = getPagedNavigation(header);
|
||||
if (nav != null)
|
||||
|
|
@ -198,16 +214,6 @@ public class Navigation implements Iterable{
|
|||
|
||||
|
||||
|
||||
public static Navigation createRootNav(){
|
||||
return new Navigation(null, null);
|
||||
}
|
||||
public static Navigation getRootNav(Map<String, String> request) {
|
||||
List<Navigation> breadcrumb = getBreadcrumb(getParameterizedNavigation(request));
|
||||
if (!breadcrumb.isEmpty())
|
||||
return breadcrumb.get(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param nav the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue