Package chemaxon.marvin.io
Class MPropHandler
java.lang.Object
chemaxon.marvin.io.MPropHandler
Property factory.
- Since:
- Marvin 4.1, 11/20/2005
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
convertToString
(MPropertyContainer p, String key) Converts the value associated with the given key in the given 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 Object
getPropertyObject
(MoleculeGraph mol, String key) Returns the property object associated with the given key in the given molecule.static String
getPropertyString
(MoleculeGraph mol, String key) Converts the property object associated with the given key in the given molecule to string.static Molecule
parseMolecule
(String sval) static MProp
stringToArray
(String xsdtype, String sval, int size, int delim) static MProp
stringToScalar
(String xsdtype, String sval)
-
Constructor Details
-
MPropHandler
public MPropHandler()
-
-
Method Details
-
createScalar
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
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
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
Converts the value associated with the given key in the given MPropertyContainer to string.- Parameters:
p
- property containerkey
- property key- Returns:
- the value of the property converted to string, or null if the key is not found
-
getPropertyObject
Returns the property object associated with the given key in the given molecule.- Parameters:
mol
- moleculekey
- property key- Returns:
- the value of the property, or null if the key is not found
-
getPropertyString
Converts the property object associated with the given key in the given molecule to string.- Parameters:
mol
- moleculekey
- property key- Returns:
- the value of the property converted to string, or null if the key is not found
-
stringToScalar
- Throws:
IOException
-
stringToArray
public static MProp stringToArray(String xsdtype, String sval, int size, int delim) throws IOException - Throws:
IOException
-
parseMolecule
- Throws:
IOException
-
createMMoleculeProp
- Throws:
IOException
-