org.gcube.data.tml.utils
Class Utils

java.lang.Object
  extended by org.gcube.data.tml.utils.Utils

public class Utils
extends Object

Data type conversion utilities

Author:
Fabio Simeoni

Constructor Summary
Utils()
           
 
Method Summary
static org.gcube.data.trees.patterns.Pattern getPattern(org.gcube.data.tm.stubs.AnyHolder h)
          Converts a AnyHolder returned by the service into a Pattern.
static
<E extends org.gcube.common.core.faults.GCUBEFault>
E
newFault(E fault, Throwable cause)
          Returns a given fault after serialising into it an original cause.
static Element toElement(org.gcube.data.tm.stubs.AnyHolder d)
          Converts an AnyHolder into an Element.
static org.gcube.data.tm.stubs.AnyHolder toHolder(Element e)
          Converts an Element into a AnyHolder accepted by the service.
static org.gcube.data.tm.stubs.AnyHolder toHolder(org.gcube.data.trees.data.Node n)
          Transforms a Node into a AnyHolder accepted by the service.
static org.gcube.data.tm.stubs.AnyHolder toHolder(org.gcube.data.trees.patterns.Pattern p)
          Converts a Pattern into an AnyHolder accepted by the service.
static org.gcube.data.tm.stubs.AnyHolder toHolder(org.gcube.data.trees.data.Tree t)
          Transforms a Tree into a AnyHolder accepted by the service.
static org.gcube.data.trees.data.Tree toTree(org.gcube.data.tm.stubs.AnyHolder h)
          Converts an AnyHolder into an Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

toHolder

public static org.gcube.data.tm.stubs.AnyHolder toHolder(org.gcube.data.trees.patterns.Pattern p)
                                                  throws Exception
Converts a Pattern into an AnyHolder accepted by the service.

Parameters:
p - the pattern
Returns:
the holder
Throws:
Exception - if the conversion fails

getPattern

public static org.gcube.data.trees.patterns.Pattern getPattern(org.gcube.data.tm.stubs.AnyHolder h)
                                                        throws Exception
Converts a AnyHolder returned by the service into a Pattern.

Parameters:
h - the holder
Returns:
the pattern
Throws:
Exception - if the conversion fails

toHolder

public static org.gcube.data.tm.stubs.AnyHolder toHolder(org.gcube.data.trees.data.Tree t)
                                                  throws Exception
Transforms a Tree into a AnyHolder accepted by the service.

Parameters:
t - the tree
Returns:
the holder
Throws:
Exception - if the conversion fails

toHolder

public static org.gcube.data.tm.stubs.AnyHolder toHolder(Element e)
Converts an Element into a AnyHolder accepted by the service.

Parameters:
e - the element
Returns:
the holder

toHolder

public static org.gcube.data.tm.stubs.AnyHolder toHolder(org.gcube.data.trees.data.Node n)
                                                  throws Exception
Transforms a Node into a AnyHolder accepted by the service.

Parameters:
n - the node
Returns:
the holder
Throws:
Exception - if the conversion fails

toElement

public static Element toElement(org.gcube.data.tm.stubs.AnyHolder d)
Converts an AnyHolder into an Element.

Parameters:
d - the holder
Returns:
the element

toTree

public static org.gcube.data.trees.data.Tree toTree(org.gcube.data.tm.stubs.AnyHolder h)
                                             throws Exception
Converts an AnyHolder into an Element.

Parameters:
h - the holder
Returns:
the element
Throws:
Exception - if the conversion fails

newFault

public static <E extends org.gcube.common.core.faults.GCUBEFault> E newFault(E fault,
                                                                             Throwable cause)
Returns a given fault after serialising into it an original cause.

Type Parameters:
E - the type of the fault
Parameters:
fault - the fault
cause - the cause
Returns:
the fault


Copyright © 2012. All Rights Reserved.