Constructs a new {@link GwtProperties} from the given source string.

@param source To load from.
@return The {@link GwtProperties} object from the source.
487809
public static GwtProperties load(String source) {
    String[] lines = source.split("\r?\n");
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();

    for (int i = 0; i < lines.length; ++i) {
      String line = lines[i];
      if (line.isEmpty() || line.startsWith("#") || line.startsWith("!")) {
        continue; // skip if empty or starts with # or !
      }

      String data = "";

      int delimeterIndex = findDelimiter(line);
      if (delimeterIndex == -1) {
        continue;
      }
      // Remove whitespace on both sides of key.
      String key = line.substring(0, delimeterIndex).trim();
      // Remove whitespace only on left side of data value. Trailing white space is data.
      line = trimLeft(line.substring(delimeterIndex + 1));
      while (true) {
        if (line.endsWith("\\")) {
          data += line.substring(0, line.length() - 1);
          if (i + 1 == lines.length) {
            break;
          }
          line = trimLeft(lines[++i]);
        } else {
          data += line;
          break;
        }
        }
      builder.put(key, data);
      }

    return new GwtProperties(builder.build());
    }
1080506
public static <SOURCE, TARGET> PropertyCopier<SOURCE, TARGET> getInstance(Typed<SOURCE> sourceType,
        Typed<TARGET> targetType, Mapping mapping, Matching matching) {
        return new FromFactory<>(Validate.notNull(sourceType, "sourceType"), Validate.notNull(targetType, "targetType"),
            mapping, matching);
    }
467011
public StringBuffer process(StringBuffer source) {
        CharSequence result = process((CharSequence) source);
        if (result instanceof StringBuffer) {
            return (StringBuffer) result;
        } else {
            return new StringBuffer(result);
        }
    }
447281
public static QueryBuilderFrom from(final String sourceVarName)
    {
        final Query query = new Query();
        query.setInputVariablesName(sourceVarName);
        return query;
    }
523146
public static ImmutableSet<Symbol> loadSymbolSet(final CharSource source) throws IOException {
    return ImmutableSet.copyOf(loadSymbolList(source));
  }
155196
public static AuthenticationBuilder newInstance(final Authentication source) {
        val builder = new DefaultAuthenticationBuilder(source.getPrincipal());
        builder.setAuthenticationDate(source.getAuthenticationDate());
        builder.setCredentials(source.getCredentials());
        builder.setSuccesses(source.getSuccesses());
        builder.setFailures(source.getFailures());
        builder.setAttributes(source.getAttributes());
        builder.setWarnings(source.getWarnings());
        return builder;
    }
382214
private <T extends DataSource> T applyDataSourceProperties(T dataSource) {
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            String key = entry.getKey().toString();
            String value = entry.getValue().toString();

            String propertyKey = PropertyKey.DATA_SOURCE_PROPERTY.getKey();
            if (key.startsWith(propertyKey)) {
                String dataSourceProperty = key.substring(propertyKey.length());
                ReflectionUtils.invokeSetter(dataSource, dataSourceProperty, value);
            }
        }
        return dataSource;
    }
680647
public StringBuilder process(StringBuilder source) {
        CharSequence result = process((CharSequence) source);
        if (result instanceof StringBuilder) {
            return (StringBuilder) result;
        } else {
            return new StringBuilder(result);
        }
    }
502136
public <T> T convert(Object source, Class<T> toClass) throws Exception {
        Constructor<T> constructor = toClass.getConstructor(java.lang.String.class);
        return constructor.newInstance(source);
    }
344774
protected final DelegateClassLoader createClassLoader(PluginSource source,
            ClassLoader parent) {
        final Stream<URL> urls = Require.nonNullResult(source.getPluginURLs(),
                "pluginSource.getPluginURLs");
        return DelegateClassLoader.forPlugins(urls, parent);
    }
1061460
public static <ID, DATA> DefaultTree<ID, DATA> generate(final TreeSource<ID, DATA> source) {
		ID rootId = source.getRootId();
		DATA rootData = source.getItem(rootId);
		DefaultTree<ID, DATA> tree = new DefaultTree<>(rootId, rootData);
		generateSubNode(source, tree);
		return tree;
	}
1058027
public Object toNeo4JProperty(Object source)
    {
        if (source instanceof BigDecimal || source instanceof BigInteger)
        {
            return source.toString();
        }
        else if ((source instanceof Calendar) || (source instanceof GregorianCalendar))
        {
            return PropertyAccessorHelper.fromSourceToTargetClass(String.class, Date.class,
                    ((Calendar) source).getTime());
        }
        if (source instanceof Date)
        {
            Class<?> sourceClass = source.getClass();
            return PropertyAccessorHelper.fromSourceToTargetClass(String.class, sourceClass, source);
        }
        return source;
    }
985915
protected void copyProperties(Object dest, Object source) {
        try {
            BeanUtils.copyProperties(dest, source);
        } catch (Exception e) {
            String errorMessage = MessageFormat.format("M:{0};;E:{1}",
                    e.getCause().getMessage(), e.toString());
            throw new WebApplicationException(errorMessage, Status.BAD_REQUEST);
        }
    }
78167
public static PropertyBuilder getInstance(Context context,
            TypeElement typeElement,
            PropertyWriter writer) {
        return new PropertyBuilder(context, typeElement, writer);
    }
1305941
public static Properties convert(OBDADataSource source) {

        String id = source.getSourceID().toString();
        String url = source.getParameter(RDBMSourceParameterConstants.DATABASE_URL);
        String username = source.getParameter(RDBMSourceParameterConstants.DATABASE_USERNAME);
        String password = source.getParameter(RDBMSourceParameterConstants.DATABASE_PASSWORD);
        String driver =  source.getParameter(RDBMSourceParameterConstants.DATABASE_DRIVER);

        Properties p = new Properties();
        p.put(OntopSQLCoreSettings.JDBC_NAME, id);
        p.put(OntopSQLCoreSettings.JDBC_URL, url);
        p.put(OntopSQLCredentialSettings.JDBC_USER, username);
        p.put(OntopSQLCredentialSettings.JDBC_PASSWORD, password);
        p.put(OntopSQLCoreSettings.JDBC_DRIVER, driver);

        return p;
    }
920029
static public InputStream replaceProperties(InputStream source, Properties props) throws IOException, SubstitutionException {
	return replaceProperties(source, props, "${", "}");
    }
1325894
protected static Properties loadConfig(String source, InputStream is) {
    try {
      Properties p = new Properties();
      p.load(is);
      // trim the value as it may have trailing white-space
      Set<String> keys = p.stringPropertyNames();
      for(String key: keys) {
        p.setProperty(key, p.getProperty(key).trim());
      }
      return p;
    } catch (IllegalArgumentException iae) {
      throw iae;
    } catch (Exception ex) {
      throw new IllegalArgumentException("Failed to load configuration from [" + source + "]");
    }
  }