code: public Value createValue(String value, int type) throws ValueFormatException
     {
        if (value == null)
           return null;
  
        try
        {
           switch (type)
           {
              case PropertyType.STRING :
                 return createValue(new String(value));
              case PropertyType.BINARY :
                 try
                 {
                    return createValue(new ByteArrayInputStream(value.getBytes(Constants.DEFAULT_ENCODING)));
                 }
                 catch (UnsupportedEncodingException e)
                 {
                    throw new RuntimeException(
                       "FATAL ERROR Charset " + Constants.DEFAULT_ENCODING + " is not supported!", e);
                 }
              case PropertyType.BOOLEAN :
                 return createValue(Boolean.parseBoolean(value));
              case PropertyType.LONG :
                 return createValue(Long.parseLong(value));
              case PropertyType.DOUBLE :
                 return createValue(Double.parseDouble(value));
              case PropertyType.DATE :
                 Calendar cal = JCRDateFormat.parse(value);
                 return createValue(cal);
              case PropertyType.PATH :
                 try
                 {
                    JCRPath path;
                    if (value.startsWith("/"))
                       path = locationFactory.parseAbsPath(value);
                    else
                       path = locationFactory.parseRelPath(value);
                    return createValue(path);
                 }
                 catch (RepositoryException e)
                 {
                    throw new ValueFormatException("Path '" + value + "' is invalid");
                 }
              case PropertyType.NAME :
                 try
                 {
                    JCRName name = locationFactory.parseJCRName(value);
                    return createValue(name);
                 }
                 catch (RepositoryException e)
                 {
                    throw new ValueFormatException("Name '" + value + "' is invalid", e);
                 }
              case PropertyType.REFERENCE :
                 return createValue(new Identifier(value));
              case ExtendedPropertyType.PERMISSION :
                 AccessControlEntry accessEntry = AccessControlEntry.parse(value);
                 return new PermissionValue(new TransientValueData(accessEntry));
              default :
                 throw new ValueFormatException("unknown type " + type);
           }
        }
        catch (IllegalArgumentException e)
        { // NumberFormatException
           throw new ValueFormatException("Cant create value from string '" + value + "' for type "
              + PropertyType.nameFromValue(type));
        }
     }
docs: {@inheritDoc}