public static function factory($value)
    {
        
        if ($value instanceof self) {
            $value = $value->getValue();
        }
        
        $value = static::filter($value);
        
        if (!is_scalar($value)) {
            throw new ErrorException("A value object must be created from a scalar value!");
        }
        
        $classname = get_called_class();
        
        if (!isset(self::$instances[$classname])) {
            self::$instances[$classname] = array();
        }
    
        // lazy load the value-object
        if (!isset(self::$instances[$classname][$value])) {
            if (func_num_args()>1) {
                // construct value-object with more then the pure scalar value
                // (not really correct in terms of value-objects, but sometimes needed)
                $arguments = func_get_args();
                $reflection = new \ReflectionClass($classname);
                self::$instances[$classname][$value] = $reflection->newInstanceArgs($arguments);
                
            } else {
                self::$instances[$classname][$value] = new static($value);
            }
        }
    
        return self::$instances[$classname][$value];
    }