net.sourceforge.combean.graph.prop.statics
Class GraphPropertyInitializer

Package class diagram package GraphPropertyInitializer
java.lang.Object
  extended by net.sourceforge.combean.graph.prop.statics.GraphPropertyInitializer

public final class GraphPropertyInitializer
extends Object

Utility class with mechanism for simultaneously setting all graph properties in an Object


Constructor Summary
GraphPropertyInitializer()
           
 
Method Summary
static Graph getGraphProperty(Graph origG, Class<?> wantedProp)
          Get a given property for a graph if the graph (or one if its nested graphs) has this property.
static Graph requireGraphProperty(Graph origG, Class wantedProp)
          Convert a graph to a given property.
static void setGraphProperties(Object target, Graph g)
          Simultaneously set all graph properties (i.e. all fields implementing interface Graph) of a target object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphPropertyInitializer

public GraphPropertyInitializer()
Method Detail

setGraphProperties

public static void setGraphProperties(Object target,
                                      Graph g)
Simultaneously set all graph properties (i.e. all fields implementing interface Graph) of a target object

Parameters:
target - the object where all graph properties shall be set
g - the graph to set

getGraphProperty

public static Graph getGraphProperty(Graph origG,
                                     Class<?> wantedProp)
Get a given property for a graph if the graph (or one if its nested graphs) has this property. Otherwise null is returned.

Parameters:
origG - the graph for which the property shall be returned
wantedProp - the desired property
Returns:
the graph with the given property or null if the property is not available

requireGraphProperty

public static Graph requireGraphProperty(Graph origG,
                                         Class wantedProp)
Convert a graph to a given property. Throws an exception if this is not possible.

Parameters:
origG - the graph for which the property shall be returned
wantedProp - the desired property
Returns:
the graph with the given property
Throws:
UnsupportedGraphProperty - thrown if the graph does not possess the given property.