Package chemaxon.marvin.io
Class MPropHandler
- java.lang.Object
-
- chemaxon.marvin.io.MPropHandler
-
@PublicAPI public final class MPropHandler extends Object
Property factory.- Since:
- Marvin 4.1, 11/20/2005
-
-
Constructor Summary
Constructors Constructor Description MPropHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
convertToString(MPropertyContainer p, String key)
Convert key of MPropertyContainer to string.static String
convertToString(MProp p, String fmt)
Converts the property to text format.static MProp
createArray(String type, String sval, int arrsize, int delim)
Creates an array property.static MProp
createArrayXSD(String xsdtype, String sval, int size, int delim)
Creates an array property from the XSD type.static MMoleculeProp
createMMoleculeProp(String sval)
static MProp
createScalar(String type, String sval)
Creates a scalar property.static MProp
createScalar(String type, String sval, MProgressMonitor pmon)
Creates a scalar property.static MProp
createScalarXSD(String xsdtype, String sval)
Creates a scalar property from the XSD type.static Molecule
parseMolecule(String sval)
static MProp
stringToArray(String xsdtype, String sval, int size, int delim)
static MProp
stringToScalar(String xsdtype, String sval)
-
-
-
Method Detail
-
createScalar
public static MProp createScalar(String type, String sval) throws MolFormatException
Creates a scalar property.- Parameters:
type
- property type or class namesval
- string value to parse- Throws:
MolFormatException
-
createScalar
public static MProp createScalar(String type, String sval, MProgressMonitor pmon) throws MolFormatException
Creates a scalar property.- Parameters:
type
- property type or class namesval
- string value to parsepmon
- progress monitor- Throws:
MolFormatException
- Since:
- Marvin 5.0
-
createArray
public static MProp createArray(String type, String sval, int arrsize, int delim) throws MolFormatException, IllegalArgumentException
Creates an array property.- Parameters:
type
- property type or class namesval
- string value to parse- Throws:
IllegalArgumentException
MolFormatException
-
createScalarXSD
public static MProp createScalarXSD(String xsdtype, String sval) throws MolFormatException
Creates a scalar property from the XSD type.- Parameters:
xsdtype
- the XSD typesval
- string value to parse- Throws:
MolFormatException
-
createArrayXSD
public static MProp createArrayXSD(String xsdtype, String sval, int size, int delim) throws MolFormatException
Creates an array property from the XSD type.- Parameters:
xsdtype
- the XSD typesval
- string value to parse- Throws:
MolFormatException
-
convertToString
public static String convertToString(MProp p, String fmt) throws IllegalArgumentException
Converts the property to text format. If the property contains not primitive type but an object, the method returns Base64 encoded string representation of the object. If you want to get some human readable string representation of the object, useMProp.getPropValue()
.Object.toString()
call on the property.- Parameters:
p
- propertyfmt
- the molecule file format ornull
- Returns:
- the string
- Throws:
IllegalArgumentException
- if conversion fails
-
convertToString
public static String convertToString(MPropertyContainer p, String key)
Convert key of MPropertyContainer to string.- Parameters:
p
- containerkey
- property object- Returns:
- the value of the property, or null if the key is not found
-
stringToScalar
public static MProp stringToScalar(String xsdtype, String sval) throws IOException
- Throws:
IOException
-
stringToArray
public static MProp stringToArray(String xsdtype, String sval, int size, int delim) throws IOException
- Throws:
IOException
-
parseMolecule
public static Molecule parseMolecule(String sval) throws IOException
- Throws:
IOException
-
createMMoleculeProp
public static MMoleculeProp createMMoleculeProp(String sval) throws IOException
- Throws:
IOException
-
-