Create the {@link java.util.Properties} with the provided instance itself.

@param instance the instance itself to be used
@return the properties instance pre-configured with the instance itself
558511
public static Properties propertiesByInstanceItself(HazelcastInstance instance) {
        Properties properties = new Properties();
        properties.put(HAZELCAST_INSTANCE_ITSELF, instance);
        return properties;
    }
891195
@Override
    public Object create(Class<?> extensionClass) {
        log.debug("Create instance for extension '{}'", extensionClass.getName());
        try {
            return extensionClass.newInstance();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }

        return null;
    }
776328
static Properties getProperties(Instance propertiesInstance) {
        ObjectArrayDump entriesObj = (ObjectArrayDump) propertiesInstance.getValueOfField("table"); // NOI18N
        if (entriesObj != null) {
            Instance defaultsObj = (Instance) propertiesInstance.getValueOfField("defaults"); // NOI18N
            Iterator<Instance> enIt = entriesObj.getValues().iterator();
            Properties props;

            if (defaultsObj != null) {
                props = new Properties(getProperties(defaultsObj));
            } else {
                props = new Properties();
            }
            while (enIt.hasNext()) {
                Instance entry = (Instance) enIt.next();

                for (; entry != null; entry = (Instance) entry.getValueOfField("next")) { // NOI18N
                    Instance key = (Instance) entry.getValueOfField("key"); // NOI18N
                    Instance val = (Instance) entry.getValueOfField("value"); // NOI18N

                    if (key != null) {
                        props.setProperty(getString(key), getString(val));
                    }
                }
            }

            return props;
        }

        return null;
    }
695395
protected T createInstance() {
        try {
            Constructor<T> ctor = clazz.getDeclaredConstructor();
            ctor.setAccessible(true);
            return ctor.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (SecurityException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
610700
public static Object getPropertyIfExists(Object instance, String property) {
        return getPropertyIfExists(instance, property, Object.class);
    }
866671
void updateInstance(T instance) {
        T oldInstance = this.instance.getAndSet(Preconditions.checkNotNull(instance, "instance"));
        if (oldInstance != null && oldInstance != instance) {
            oldInstance.close();
        }
    }
827627
@Override
    protected Map createInstance() {
        if (applicationContext.containsBean(UrlMappingFactoryBean.URL_MAP_BEAN)) {
            Object o = applicationContext.getBean(UrlMappingFactoryBean.URL_MAP_BEAN);
            if (o instanceof Map) {
                mappings.putAll((Map)o);
            }
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("[UrlMappingFactoryBean] Creating URL mappings as...");
            for (Object key : mappings.keySet()) {
                LOG.debug("[UrlMappingFactoryBean] " + key + "=" + mappings.get(key));
            }
        }
        return mappings;
    }
1118375
public void createInstance(
      final String my_instance_id, final String my_config_id, final String my_client_project) {
    // [START instance_admin_client_create_instance]
    final String instanceId = my_instance_id;
    final String configId = my_config_id;
    final String clientProject = my_client_project;

    OperationFuture<Instance, CreateInstanceMetadata> op =
        instanceAdminClient.createInstance(
            InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
                .setInstanceConfigId(InstanceConfigId.of(clientProject, configId))
                .setDisplayName(instanceId)
                .setNodeCount(1)
                .build());
    try {
      op.get();
    } catch (ExecutionException e) {
      throw (SpannerException) e.getCause();
    } catch (InterruptedException e) {
      throw SpannerExceptionFactory.propagateInterrupt(e);
    }
    // [END instance_admin_client_create_instance]
  }
513867
public static void put(String instanceName, Driver instance) {
        // Copy current instances
        Map<String, Driver> newInstances = new HashMap<>();
        synchronized (instances) {
            Set<String> keys = instances.getInstances().keySet();

            for (String key : keys) {
                newInstances.put(key, instances.getInstances().get(key));
            }
        }

        // Add new instance
        newInstances.put(instanceName, instance);

        instances = new IndexedInstances(newInstances);
    }
604665
public <T> T createInstance(Class<T> type) {
        try {
            return type.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new IllegalArgumentException("Cannot create instance of class " + type.getName(), e);
        }
    }
477947
public static LdapHelper getInstance(String instance) {
        if (!helpers.containsKey(instance)) {
            helpers.put(instance, new LdapHelper(instance));
        }
        LdapHelper helper = helpers.get(instance);
        if (!helper.online) {
            helper.loadProperties();
        }
        return helper;
    }
248488
@Override
	public T create()
	{
		try
		{
			T obj = ClassPath.newInstance(creationClass);
			
			//Copy prototype properties
			if(this.prototype != null)
				JavaBean.populate(JavaBean.toMap(prototype), obj);
			
			PropertyDescriptor pd = null;
			Class<?> clz = null;
			
			final boolean throwExceptionForMissingProperty = false;
			
			for (String property : randomizeProperties)
			{
				try
				{
					pd = JavaBean.getPropertyDescriptor(obj, property);
					clz = pd.getPropertyType();
					
					if(clz.isAssignableFrom(Class.class) || clz.isEnum())
						continue;
					
					if(clz.isAssignableFrom(String.class))
					{
						try
						{
							JavaBean.setProperty(obj, property, Text.generateId(),throwExceptionForMissingProperty);  
						}
						catch(IllegalArgumentException e)
						{
							throw new IllegalArgumentException("randomizeProperties:"+randomizeProperties+" invalid property:"+property,e);
						}
						
					}
					else if(clz.isAssignableFrom(Integer.class) || clz.isAssignableFrom(int.class) )
					{
						JavaBean.setProperty(obj, property, digits.generateInteger());
					}
					else if (clz.isAssignableFrom(long.class)  || clz.isAssignableFrom(Long.class))
					{
						JavaBean.setProperty(obj, property, digits.generateLong());
					}
					
					else if (clz.isAssignableFrom(short.class)  || clz.isAssignableFrom(Short.class))
					{
						JavaBean.setProperty(obj, property, digits.generateShort());
					}
					else if (clz.isAssignableFrom(double.class)  || clz.isAssignableFrom(Double.class))
					{
						JavaBean.setProperty(obj, property, digits.generateDouble());
					}
					else if (clz.isAssignableFrom(char.class)  || clz.isAssignableFrom(Character.class))
					{
						JavaBean.setProperty(obj, property, Text.generateId().charAt(0));
					}
					else if (clz.isAssignableFrom(float.class)  || clz.isAssignableFrom(Float.class))
					{
						JavaBean.setProperty(obj, property, digits.generateFloat());
					}
					else if (clz.isAssignableFrom(byte.class)  || clz.isAssignableFrom(Byte.class))
					{
						JavaBean.setProperty(obj, property,Byte.valueOf(Text.generateId().getBytes(IO.CHARSET)[0]));
					}
					else if (clz.isAssignableFrom(boolean.class)  || clz.isAssignableFrom(Boolean.class))
					{
						if(Calendar.getInstance().getTime().getTime()%2 ==0)
							JavaBean.setProperty(obj, property, true);
						else
							JavaBean.setProperty(obj, property, false);
					}
					else if (clz.equals(BigDecimal.class))
					{
						JavaBean.setProperty(obj, property,digits.generateBigDecimal());
					}
					else if (clz.equals(java.sql.Time.class))
					{
						JavaBean.setProperty(obj, property, 
						new java.sql.Time(
						Calendar.getInstance().getTime().getTime()));
					}
					else if (clz.equals(java.sql.Date.class))
					{
						JavaBean.setProperty(obj, property, new java.sql.Date(Calendar.getInstance().getTime().getTime()));
					}
					else if (clz.equals(java.util.Date.class))
					{
						JavaBean.setProperty(obj, property, Calendar.getInstance().getTime());
					}
					//Timestamp
					else if (clz.equals(java.sql.Timestamp.class))
					{
						JavaBean.setProperty(obj, property, new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
					}
					else if (clz.equals(java.util.Calendar.class))
					{
						JavaBean.setProperty(obj, property, Calendar.getInstance());
					}
					else if (clz.equals(LocalTime.class))
					{
						JavaBean.setProperty(obj, property, LocalTime.now());
					}
					else if (clz.equals(LocalDate.class))
					{
						JavaBean.setProperty(obj, property, LocalDate.now());
					}
					else if (clz.equals(LocalDateTime.class))
					{
						JavaBean.setProperty(obj, property, LocalDateTime.now());
					}
					else
					{
						JavaBean.setProperty(obj, property, ClassPath.newInstance(clz));
					}
				}
				catch (Exception e)
				{
					throw new SetupException("Cannot create property:"+property+" for object class:"
									+this.creationClass.getName()+"  ERROR:"+e.getMessage(),e); 
				}
			}
			
			return obj;
		}
		catch (RuntimeException e)
		{
			throw e;
			
		}
		catch (Exception e)
		{
			throw new RuntimeException(e.getMessage(),e);
		}
	}
274529
public static InstanceFields declaredFieldsOf(Object instance) {
        List<InstanceField> instanceFields = new ArrayList<InstanceField>();
        instanceFields.addAll(instanceFieldsIn(instance, instance.getClass().getDeclaredFields()));
        return new InstanceFields(instance, instanceFields);
    }
926849
@Override
    public <T> T getProperty(Object key, Class<T> clazz) {
        return clazz.cast(getProperty(key));
    }
848530
function getPrivate(instance) {

	var map = weak_properties.get(instance);

	if (!map) {
		map = {
			// Attribute configurations
			attributes  : {},

			// Attribute values for use in property getters
			prop_values : {},

			// Attribute string values
			values      : {},

			// New values that are beign set
			new_values  : {}
		};

		weak_properties.set(instance, map);
	}

	return map;
}
1102251
public static DB getConnection(String instance) {
        if(Objects.isNullOrEmpty(instance))
            instance = DEFAULT_INSTANCE;
        if(!connections.containsKey(instance)){
            initialize(instance);
        }
        return connections.get(instance);
    }
1176676
Properties readProperties( Instance instance ) throws PluginException {

		Properties result = null;
		File instanceDirectory = InstanceHelpers.findInstanceDirectoryOnAgent( instance );
		File file = new File( instanceDirectory, FILE_NAME );

		try {
			if( file.exists()) {
				result = Utils.readPropertiesFile( file );

			} else {
				this.logger.warning( file + " does not exist or is invalid. There is no instruction for the plugin." );
				result = new Properties();
			}

		} catch( IOException e ) {
			throw new PluginException( e );
		}

		return result;
	}