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 Details

    • MPropHandler

      public MPropHandler()
  • Method Details

    • createScalar

      public static MProp createScalar(String type, String sval) throws MolFormatException
      Creates a scalar property.
      Parameters:
      type - property type or class name
      sval - 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 name
      sval - string value to parse
      pmon - 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 name
      sval - 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 type
      sval - 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 type
      sval - 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, use MProp.getPropValue().Object.toString() call on the property.
      Parameters:
      p - property
      fmt - the molecule file format or null
      Returns:
      the string
      Throws:
      IllegalArgumentException - if conversion fails
    • convertToString

      public static String convertToString(MPropertyContainer p, String key)
      Converts the value associated with the given key in the given MPropertyContainer to string.
      Parameters:
      p - property container
      key - property key
      Returns:
      the value of the property converted to string, or null if the key is not found
    • getPropertyObject

      public static Object getPropertyObject(MoleculeGraph mol, String key)
      Returns the property object associated with the given key in the given molecule.
      Parameters:
      mol - molecule
      key - property key
      Returns:
      the value of the property, or null if the key is not found
    • getPropertyString

      public static String getPropertyString(MoleculeGraph mol, String key)
      Converts the property object associated with the given key in the given molecule to string.
      Parameters:
      mol - molecule
      key - property key
      Returns:
      the value of the property converted to string, 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