Package org.gephi.utils
Class Serialization
- java.lang.Object
-
- org.gephi.utils.Serialization
-
public class Serialization extends Object
Class for serialization utils such as writing any object value to a String and retrieving it by String + class name.- Author:
- Eduardo Ramos
-
-
Field Summary
Fields Modifier and Type Field Description private PatterncolorPatternprivate org.gephi.graph.api.GraphModelgraphModelprivate static SerializationINSTANCE_WITHOUT_GRAPH_MODEL
-
Constructor Summary
Constructors Constructor Description Serialization()Serialization(org.gephi.graph.api.GraphModel graphModel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectfromText(String valueStr, Class valueClass)static StringgetValueAsText(Object value)Converts any value to a serialized String.static StringgetValueAsText(Object value, Class valueClass)Converts any value to a serialized String.static booleanisPrimitiveOrPrimitiveWrapper(Class<?> type)static ObjectparsePrimitiveOrWrapper(Class valueClass, String value)static ObjectreadValueFromText(String valueStr, Class valueClass)Deserializes a serialized String of the given class.static ObjectreadValueFromText(String valueStr, String valueClassStr)Deserializes a serialized String of the given class name.StringtoText(Object value)StringtoText(Object value, Class valueClass)
-
-
-
Field Detail
-
INSTANCE_WITHOUT_GRAPH_MODEL
private static final Serialization INSTANCE_WITHOUT_GRAPH_MODEL
-
graphModel
private final org.gephi.graph.api.GraphModel graphModel
-
colorPattern
private final Pattern colorPattern
-
-
Method Detail
-
getValueAsText
public static String getValueAsText(Object value)
Converts any value to a serialized String. UsesPropertyEditorfor serialization except for values ofFontclass.- Parameters:
value- Value to serialize as String- Returns:
- Result String or null if the value can't be serialized with a
PropertyEditor
-
getValueAsText
public static String getValueAsText(Object value, Class valueClass)
Converts any value to a serialized String. UsesPropertyEditorfor serialization except for values ofFontclass.- Parameters:
value- Value to serialize as StringvalueClass- Class to use for the value- Returns:
- Result String or null if the value can't be serialized with a
PropertyEditor
-
readValueFromText
public static Object readValueFromText(String valueStr, Class valueClass)
Deserializes a serialized String of the given class. UsesPropertyEditorfor serialization except for values ofFontclass.- Parameters:
valueStr- String to deserializevalueClass- Class of the serialized value- Returns:
- Deserialized value or null if it can't be deserialized with a
PropertyEditor
-
readValueFromText
public static Object readValueFromText(String valueStr, String valueClassStr)
Deserializes a serialized String of the given class name. Returns null if the class can't be found. UsesPropertyEditorfor serialization except for values ofFontclass.- Parameters:
valueStr- String to deserializevalueClassStr- Class name of the serialized value- Returns:
- Deserialized value or null if it can't be deserialized with a
PropertyEditor
-
isPrimitiveOrPrimitiveWrapper
public static boolean isPrimitiveOrPrimitiveWrapper(Class<?> type)
-
parsePrimitiveOrWrapper
public static Object parsePrimitiveOrWrapper(Class valueClass, String value)
-
-