Re-Create any object if the class has a public constructor that accepts a String as unique parameter.
177048
public Object fromStream(final byte[] iStream) throws IOException {
		if (iStream == null || iStream.length == 0)
			// NULL VALUE
			return null;

		final ORecordInternal<?> obj = Orient.instance().getRecordFactoryManager().newInstance();

		final ORID rid = new ORecordId().fromStream(iStream);

		obj.setIdentity(rid.getClusterId(), rid.getClusterPosition());
		return obj;
	}
556315
public static Object buildObjectInstance(String classname, Object[] params) {
		Object rets = null;

		Class<?>[] paramTypes = new Class[params.length];
		for (int x = 0; x < params.length; x++) {
			paramTypes[x] = params[x].getClass();
		}

		try {
			Class<?> clazz = getClass(classname);
			rets = clazz.getConstructor(paramTypes).newInstance(params);

		} catch (Exception e) {
			throw new BundlingProcessException(e.getMessage() + " [The custom class " + classname
					+ " could not be instantiated, check wether it is available on the classpath and"
					+ " verify that it has a zero-arg constructor].\n" + " The specific error message is: "
					+ e.getClass().getName() + ":" + e.getMessage(), e);
		}
		return rets;
	}
161316
def singleton(cls):
    '''
    
    '''

    cls.__new_original__ = cls.__new__

    @wraps(cls.__new__)
    def singleton_new(cls, *args, **kw):
        it = cls.__dict__.get('__it__')
        if it is not None:
            return it

        cls.__it__ = it = cls.__new_original__(cls, *args, **kw)
        it.__init_original__(*args, **kw)
        return it

    cls.__new__ = singleton_new
    cls.__init_original__ = cls.__init__
    cls.__init__ = object.__init__

    return cls
108297
def create(cls, object_version, key, value):
        """"""
        assert len(key) < 256
        assert len(value) < 256
        with db.session.begin_nested():
            obj = cls(version_id=as_object_version_id(object_version),
                      key=key,
                      value=value)
            db.session.add(obj)
        return obj
676548
def create_new(cls, oldvalue, *args):
    ""
    if oldvalue is not None:
        raise AlreadyExistsException('%r already exists' % (oldvalue,))
    return cls.create_instance(*args)
286810
public Object newInstance( String name, Object... params ) throws ClassLoaderException {
        return newInstance( name, params, null );
    }
238712
def _create_from_java_class(cls, java_class, *args):
        
        java_obj = JavaWrapper._new_java_obj(java_class, *args)
        return cls(java_obj)
1161662
private Optional tryCreate(Constructor<?> constructor) {
    Object[] args = new Object[constructor.getParameterCount()];
    Object arg;
    Optional<Object> resolved;
    int i = 0;
    for (Parameter parameter : constructor.getParameters()) {
      resolved = context.resolve(parameter);
      if (!resolved.isPresent()) {
        return Optional.empty();
      }
      arg = resolved.value();
      args[i++] = arg;
    }
    return Optional.of(createFunction.apply(constructor, args));
  }
341343
function stringToObject( classStr, Class ) {
			Class = Class || window;
			var classStrArr = classStr.split(".");
			for ( var n = 0; Class && n < classStrArr.length; n++) {
				Class = Class[classStrArr[n]];
			}
			return Class;
		}
79703
@SafeVarargs
    public static <T> Constructor<T> getDeclaredConstructor(final Class<T> cls, final Class<?>... parameterTypes) {
        Map<Class<?>[], Constructor<?>> constructorPool = classDeclaredConstructorPool.get(cls);
        Constructor<T> constructor = null;

        if (constructorPool != null) {
            constructor = (Constructor<T>) constructorPool.get(parameterTypes);
        }

        if (constructor == null) {
            try {
                constructor = cls.getDeclaredConstructor(parameterTypes);

                // SHOULD NOT set it true here.
                // constructor.setAccessible(true);
            } catch (NoSuchMethodException e) {
                // ignore.
            }

            if (constructor != null) {
                if (constructorPool == null) {
                    constructorPool = new ArrayHashMap<>(ConcurrentHashMap.class);
                    classDeclaredConstructorPool.put(cls, constructorPool);
                }

                constructorPool.put(parameterTypes.clone(), constructor);
            }
        }

        return constructor;
    }
89712
@SuppressWarnings("unchecked")
   private Handler createHandler() throws Throwable
   {
      Class clz = handler;

      while (clz != Object.class)
      {
         try
         {
            Constructor c = clz.getDeclaredConstructor((Class[])null);
            c.setAccessible(true);

            return (Handler)c.newInstance((Object[])null);
         }
         catch (Throwable t)
         {
            t.printStackTrace(System.err);
         }

         clz = clz.getSuperclass();
      }

      throw new IllegalStateException("Unable to find default constructor");
   }
320665
protected Object createInstance(String classname) {

        // get the classloader to use
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader == null) {
            classLoader = this.getClass().getClassLoader();
        }

        // create an instance of the class using the default constructor
        try {

            return classLoader.loadClass(classname).newInstance();

        } catch (InstantiationException e) {
            throw new IllegalStateException(e);
        } catch (IllegalAccessException e) {
            throw new IllegalStateException(e);
        } catch (ClassNotFoundException e) {
            throw new IllegalStateException(e);
        }

    }
862992
public static Object newInstance(Class clazz, ArgumentResolver resolver){
        Validate.argumentIsNotNull(clazz);
        for (Constructor constructor : clazz.getDeclaredConstructors()) {
            if (isPrivate(constructor) || isProtected(constructor)) {
                continue;
            }

            Class [] types = constructor.getParameterTypes();
            Object[] params = new Object[types.length];
            for (int i=0; i<types.length; i++){
                try {
                    params[i] = resolver.resolve(types[i]);
                } catch (JaversException e){
                    logger.error("failed to create new instance of "+clazz.getName()+", argument resolver for arg["+i+"] " +
                                 types[i].getName() + " thrown exception: "+e.getMessage());
                    throw e;
                }
            }
            try {
                constructor.setAccessible(true);
                return constructor.newInstance(params);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
        throw new JaversException(JaversExceptionCode.NO_PUBLIC_CONSTRUCTOR,clazz.getName());
    }
888609
function clone(object) {
  if (object === null || typeof object != "object") {
    return object;
  }
  const copy = object.constructor();
  for (const attr in object) {
    if (Object.prototype.hasOwnProperty.call(object, attr)) {
      copy[attr] = object[attr];
    }
  }

  return copy;
}
676133
static AttrPause createFromString(final String str)
    throws BOSHException {
        if (str == null) {
            return null;
        } else {
            return new AttrPause(str);
        }
    }
615875
def _no_duplicates_constructor(loader, node, deep=False):
    """"""

    mapping = {}
    for key_node, value_node in node.value:
        key = loader.construct_object(key_node, deep=deep)
        value = loader.construct_object(value_node, deep=deep)
        if key in mapping:
            raise ConstructorError("while constructing a mapping",
                                   node.start_mark,
                                   "found duplicate key (%s)" % key,
                                   key_node.start_mark)
        mapping[key] = value

    return loader.construct_mapping(node, deep)
230304
function make_singleton( Constructor, singleton_config ) {
		process_after( Constructor );

		var instance = Constructor.create.apply( null, singleton_config === true ? [] : [].concat( singleton_config ) );

		util.def( Constructor, __singleton__, util.describe( { value : instance }, 'r' ) );

		return instance;
	}