org.xanot
Class AnnotationRuleBuilder

java.lang.Object
  extended by org.xanot.AnnotationRuleBuilder
All Implemented Interfaces:
RuleBuilder

public class AnnotationRuleBuilder
extends java.lang.Object
implements RuleBuilder

Generate an object value and creation rule based on the annotation provided within the object model.

It start on a root object. The top most object that will be instantiated first.

The rule builder then will iterates through all public getter methods and member attributes.

Author:
Ferdinand Neman (newm4n_at_gmail.com)

Constructor Summary
AnnotationRuleBuilder(java.lang.Class root)
          Creates a new AnnotationRuleBuilder object.
 
Method Summary
 void dumpRulesInfo()
          Dump all information about rules this builder contains.
 AttributeSetRule getAttributeSetRule(java.lang.String path)
          Get attribute setter with specified path.
 AttributeSetRule[] getAttributeSetRule(java.lang.String[] path)
          Get array of AttributeSetRule that have a path similar to an array of paths.
 CloseCollectionInstanceRule getCloseCollectionInstanceRule(java.lang.String path)
          Get CloseCollectionInstanceRule with specified path.
 CloseCollectionInstanceRule[] getCloseCollectionInstanceRule(java.lang.String[] path)
          Get array of CloseCollectionInstanceRule that have a path similar to an array of paths.
 CloseInstanceRule getCloseInstanceRule(java.lang.String path)
          Get closer instance with specified path.
 CloseInstanceRule[] getCloseInstanceRule(java.lang.String[] path)
          Get array of CloseInstanceRule that have a path similar to an array of paths.
 CreateInstanceRule getCreateInstanceRule(java.lang.String path)
          Get CreateInstanceRule with specified path.
 CreateInstanceRule[] getCreateInstanceRule(java.lang.String[] path)
          Get array of CreateInstanceRule that have a path similar to an array of paths.
 ParentReferenceRule getParentReferenceRule(java.lang.String path)
          Get ParentReferenceRule with specified path.
 ParentReferenceRule[] getParentReferenceRule(java.lang.String[] paths)
          Get array of ParentReferenceRule that have a path similar to an array of paths.
 PropertyCollectionSetRule getPropertyCollectionSetRule(java.lang.String path)
          Get PropertyCollectionSetRule with specified path.
 PropertyCollectionSetRule[] getPropertyCollectionSetRule(java.lang.String[] path)
          Get array of PropertyCollectionSetRule that have a path similar to an array of paths.
 PropertySetRule getPropertySetRule(java.lang.String path)
          Get PropertySetRule with specified path.
 PropertySetRule[] getPropertySetRule(java.lang.String[] path)
          Get array of PropertySetRule that have a path similar to an array of paths.
 java.lang.Class getRoot()
          Get the root class
 java.util.List<XanotRule> getRules(java.lang.String path)
          Get List of XanotRule with specified path.
 java.util.List<XanotRule> getRules(java.lang.String[] paths)
          Get List of XanotRule that have a path similar to an array of paths.
static boolean isNativeWrapper(java.lang.Class klazz)
          To check wether a class is extending or a wrapper class of native tipes.
 boolean isRoot(java.lang.Class klazz)
          Check wether a class is a root class of the object model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationRuleBuilder

public AnnotationRuleBuilder(java.lang.Class root)
                      throws XanotException
Creates a new AnnotationRuleBuilder object.

Parameters:
root - The root class as the starting point.
Throws:
XanotException - Thrown if there's an invalid usage of annotation according to this implementation
Method Detail

getRoot

public java.lang.Class getRoot()
Get the root class

Specified by:
getRoot in interface RuleBuilder
Returns:
Root class, never return null

dumpRulesInfo

public void dumpRulesInfo()
Dump all information about rules this builder contains. All information is dumped to standard output.


isRoot

public boolean isRoot(java.lang.Class klazz)
Check wether a class is a root class of the object model.

Parameters:
klazz - Class to check
Returns:
True if the class is a root class. False if otherwise.

isNativeWrapper

public static boolean isNativeWrapper(java.lang.Class klazz)
To check wether a class is extending or a wrapper class of native tipes.

Parameters:
klazz - The class to check.
Returns:
True if the class is instance of Byte, Short, Integer, Long, Double, Float,Boolean or even an int, byte,short,long,float,double,char or boolean.

getAttributeSetRule

public AttributeSetRule getAttributeSetRule(java.lang.String path)
Get attribute setter with specified path.

Specified by:
getAttributeSetRule in interface RuleBuilder
Parameters:
path - Rule Path
Returns:
AttributeSetRule instance or null no Attribute Set rule with that path.

getAttributeSetRule

public AttributeSetRule[] getAttributeSetRule(java.lang.String[] path)
Get array of AttributeSetRule that have a path similar to an array of paths.

Specified by:
getAttributeSetRule in interface RuleBuilder
Parameters:
path - Array of paths.
Returns:
Array of AttributeSetRule that have a path similar to the array of path.

getCloseInstanceRule

public CloseInstanceRule getCloseInstanceRule(java.lang.String path)
Get closer instance with specified path.

Specified by:
getCloseInstanceRule in interface RuleBuilder
Parameters:
path - The path
Returns:
CloseInstanceRule that it's path is equals to the specified path

getCloseInstanceRule

public CloseInstanceRule[] getCloseInstanceRule(java.lang.String[] path)
Get array of CloseInstanceRule that have a path similar to an array of paths.

Specified by:
getCloseInstanceRule in interface RuleBuilder
Parameters:
path - Array of paths.
Returns:
Array of CloseInstanceRule that have a path similar to the array of path.

getCreateInstanceRule

public CreateInstanceRule getCreateInstanceRule(java.lang.String path)
Get CreateInstanceRule with specified path.

Specified by:
getCreateInstanceRule in interface RuleBuilder
Parameters:
path - The path
Returns:
CreateInstanceRule that it's path is equals to the specified path

getCreateInstanceRule

public CreateInstanceRule[] getCreateInstanceRule(java.lang.String[] path)
Get array of CreateInstanceRule that have a path similar to an array of paths.

Specified by:
getCreateInstanceRule in interface RuleBuilder
Parameters:
path - Array of paths.
Returns:
Array of CreateInstanceRule that have a path similar to the array of path.

getPropertySetRule

public PropertySetRule getPropertySetRule(java.lang.String path)
Get PropertySetRule with specified path.

Specified by:
getPropertySetRule in interface RuleBuilder
Parameters:
path - The path
Returns:
PropertySetRule that it's path is equals to the specified path

getPropertySetRule

public PropertySetRule[] getPropertySetRule(java.lang.String[] path)
Get array of PropertySetRule that have a path similar to an array of paths.

Specified by:
getPropertySetRule in interface RuleBuilder
Parameters:
path - Array of paths.
Returns:
Array of PropertySetRule that have a path similar to the array of path.

getCloseCollectionInstanceRule

public CloseCollectionInstanceRule getCloseCollectionInstanceRule(java.lang.String path)
Get CloseCollectionInstanceRule with specified path.

Specified by:
getCloseCollectionInstanceRule in interface RuleBuilder
Parameters:
path - The path
Returns:
CloseCollectionInstanceRule that it's path is equals to the specified path

getCloseCollectionInstanceRule

public CloseCollectionInstanceRule[] getCloseCollectionInstanceRule(java.lang.String[] path)
Get array of CloseCollectionInstanceRule that have a path similar to an array of paths.

Specified by:
getCloseCollectionInstanceRule in interface RuleBuilder
Parameters:
path - Array of paths.
Returns:
Array of CloseCollectionInstanceRule that have a path similar to the array of path.

getPropertyCollectionSetRule

public PropertyCollectionSetRule getPropertyCollectionSetRule(java.lang.String path)
Get PropertyCollectionSetRule with specified path.

Specified by:
getPropertyCollectionSetRule in interface RuleBuilder
Parameters:
path - The path
Returns:
PropertyCollectionSetRule that it's path is equals to the specified path

getPropertyCollectionSetRule

public PropertyCollectionSetRule[] getPropertyCollectionSetRule(java.lang.String[] path)
Get array of PropertyCollectionSetRule that have a path similar to an array of paths.

Specified by:
getPropertyCollectionSetRule in interface RuleBuilder
Parameters:
path - Array of paths.
Returns:
Array of PropertyCollectionSetRule that have a path similar to the array of path.

getParentReferenceRule

public ParentReferenceRule getParentReferenceRule(java.lang.String path)
Get ParentReferenceRule with specified path.

Specified by:
getParentReferenceRule in interface RuleBuilder
Parameters:
path - The path
Returns:
ParentReferenceRule that it's path is equals to the specified path

getParentReferenceRule

public ParentReferenceRule[] getParentReferenceRule(java.lang.String[] paths)
Get array of ParentReferenceRule that have a path similar to an array of paths.

Specified by:
getParentReferenceRule in interface RuleBuilder
Parameters:
path - Array of paths.
Returns:
Array of ParentReferenceRule that have a path similar to the array of path.

getRules

public java.util.List<XanotRule> getRules(java.lang.String path)
Get List of XanotRule with specified path.

Specified by:
getRules in interface RuleBuilder
Parameters:
path - The path
Returns:
List of XanotRule that it's path is equals to the specified path

getRules

public java.util.List<XanotRule> getRules(java.lang.String[] paths)
Get List of XanotRule that have a path similar to an array of paths.

Specified by:
getRules in interface RuleBuilder
Parameters:
paths - Array of paths.
Returns:
List of XanotRule that have a path similar to the array of path.


Copyright 2006 null. All Rights Reserved.