Builds the {@link ObjectName} given the configuration.

@return The created ObjectName
494981
public ObjectName build() {
    final String name = nameStrBuilder.substring(0, nameStrBuilder.length() - 1);
    try {
      return new ObjectName(name);
    } catch (MalformedObjectNameException e) {
      LOG.warn("Invalid ObjectName provided: " + name);
      throw Throwables.propagate(e);
    }
  }
1035116
public @NotNull String build() {
    SortedMap<String, Object> sortedParameterMap = new TreeMap<>(parameterMap);

    // gather resource paths in a treeset (having them in a defined order helps with caching)
    SortedSet<String> resourcePathsSet = new TreeSet<>();

    // iterate over all parts that should be kept from the current request
    for (String nextPart : initialSuffixParts) {
      // if this is a key-value-part:
      if (nextPart.indexOf(KEY_VALUE_DELIMITER) > 0) {
        String key = decodeKey(nextPart);
        // decode and keep the part if it is not overridden in the given parameter-map
        if (!sortedParameterMap.containsKey(key)) {
          String value = decodeValue(nextPart);
          sortedParameterMap.put(key, value);
        }
      }
      else {
        // decode and keep the resource paths (unless they are specified again in resourcePaths)
        String path = decodeResourcePathPart(nextPart);
        if (!resourcePaths.contains(path)) {
          resourcePathsSet.add(path);
        }
      }
    }

    // copy the resources specified as parameters to the sorted set of paths
    if (resourcePaths != null) {
      resourcePathsSet.addAll(ImmutableList.copyOf(resourcePaths));
    }

    // gather all suffix parts in this list
    List<String> suffixParts = new ArrayList<>();

    // now encode all resource paths
    for (String path : resourcePathsSet) {
      suffixParts.add(encodeResourcePathPart(path));
    }

    // now encode all entries from the parameter map
    for (Entry<String, Object> entry : sortedParameterMap.entrySet()) {
      Object value = entry.getValue();
      if (value == null) {
        // don't add suffix part if value is null
        continue;
      }
      String encodedKey = encodeKeyValuePart(entry.getKey());
      String encodedValue = encodeKeyValuePart(value.toString());
      suffixParts.add(encodedKey + KEY_VALUE_DELIMITER + encodedValue);
    }

    // finally join these parts to a single string
    return StringUtils.join(suffixParts, SUFFIX_PART_DELIMITER);
  }
1082049
public Description build() {
        if (null == name) {
            throw new IllegalStateException("name is not set");
        }
        final String title1 = null != title ? title : name;
        final List<Property> properties1 = buildProperties();
        final Map<String, String> mapping1 = Collections.unmodifiableMap(mapping);
        final Map<String, String> mapping2 = Collections.unmodifiableMap(fwkmapping);
        final Map<String, String> metadata2 = Collections.unmodifiableMap(metadata);
        return new Description() {
            @Override
            public String getName() {
                return name;
            }

            @Override
            public String getTitle() {
                return title1;
            }

            @Override
            public String getDescription() {
                return description;
            }

            @Override
            public List<Property> getProperties() {
                return properties1;
            }

            @Override
            public Map<String, String> getPropertiesMapping() {
                return mapping1;
            }

            @Override
            public Map<String, String> getFwkPropertiesMapping() {
                return mapping2;
            }

            @Override
            public Map<String, String> getMetadata() {
                return metadata2;
            }

            @Override
            public String toString() {
                return "PropertyDescription{" +
                        "name = " + getName() + ", " +
                        "title = " + getTitle() + ", " +
                        "description = " + getDescription() + ", " +
                        "properties = " + getProperties() + ", " +
                        "mapping = " + getPropertiesMapping() +
                        "frameworkMapping = " + getFwkPropertiesMapping() +
                        "metadata = " + metadata2 +
                        "}";
            }
        };
    }
610781
public @Nullable String build() {
    StringBuilder queryString = new StringBuilder();

    for (NameValuePair param : params) {
      if (queryString.length() > 0) {
        queryString.append(PARAM_SEPARATOR);
      }
      queryString.append(Escape.urlEncode(param.getName()));
      queryString.append(VALUE_SEPARATOR);
      queryString.append(Escape.urlEncode(param.getValue()));
    }

    if (queryString.length() > 0) {
      return queryString.toString();
    }
    else {
      return null;
    }
  }
346996
private static ObjectName getObjectName(String name) {

		ObjectName mBeanName = null;
		try {
			mBeanName = new ObjectName(name);
		} catch (MalformedObjectNameException | NullPointerException e) {
			throw new JmxConfigException(e);
		}

		return mBeanName;
	}
590209
static ObjectName getObjectName(String type, String name) {
        try {
            return new ObjectName(JMXUtils.class.getPackage().getName() + ":type=" + type + ",name=" + name);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
1176069
public String build() {
    StringBuilder sb = new StringBuilder(funcName + "(");

    // Join args and kwargs into simple strings.
    String args =
        argList.stream()
            .map(PyExpr::getText)
            .filter(Objects::nonNull)
            .collect(Collectors.joining(", "));
    String kwargs =
        kwargMap.entrySet().stream()
            .map(entry -> entry.getKey() + "=" + entry.getValue().getText())
            .filter(Objects::nonNull)
            .collect(Collectors.joining(", "));

    // Strip empty strings.
    args = Strings.emptyToNull(args);
    kwargs = Strings.emptyToNull(kwargs);

    // Join all pieces together.
    Joiner.on(", ").skipNulls().appendTo(sb, args, kwargs, unpackedKwargs);

    sb.append(")");
    return sb.toString();
  }
363753
public String build(Class<?> clazz) {
		String packageName = clazz.getPackage().getName();
		String formattedPackageName = packageName.replace(".", "/");
		return formattedPackageName + "/" + clazz.getSimpleName()
				+ "-BeanohContext.xml";
	}
691300
public Map<String, Object> build() {
        final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
        //noinspection unchecked
        ofNullable(uploadOptions).map(x -> builder.putAll(x.build()));
        return builder.build();
    }
759754
public Config build() {
    if (this.language == null) {
      this.language = "java";
    }
    if (this.endpoint == null) {
      this.endpoint = SyncSender.DEFAULT_API_ENDPOINT;
    }
    if (this.notifier == null) {
      this.notifier = new NotifierProvider();
    }
    if (this.sender == null) {
      SyncSender.Builder innerSender =
          new SyncSender.Builder(this.endpoint)
          .accessToken(accessToken)
          .proxy(proxy);
      if (this.jsonSerializer != null) {
        innerSender.jsonSerializer(this.jsonSerializer);
      }
      this.sender =
        new BufferedSender.Builder().sender(innerSender.build()).build();
    }
    if (this.timestamp == null) {
      this.timestamp = new TimestampProvider();
    }

    return new ConfigImpl(this);
  }
52895
protected ObjectName newObjectName(MBeanServer server)
    {
        ObjectName oName=super.newObjectName(server);
        String context=_httpContext.getContextPath();
        if (context.length()==0)
            context="/";
        try{oName=new ObjectName(oName+",context="+context);}
        catch(Exception e){log.warn(LogSupport.EXCEPTION,e);}
        return oName;
    }
451797
public Configuration build() {
    Validate.notNull(this.submissionRuntime, "Default Runtime was not defined");

    if(!this.defaultRuntime.isPresent() || this.runtimeNames.size() == 1){
      this.defaultRuntime = Optional.of(this.runtimeNames.toArray(new String[0])[0]);
    }

    Validate.isTrue(this.defaultRuntime.isPresent(),
            "Default runtime was not defined, and multiple runtimes were specified");

    if(!this.runtimeNames.contains(this.defaultRuntime.get())){
      this.runtimeNames.add(this.defaultRuntime.get());
    }

    JavaConfigurationBuilder conf = Tang.Factory.getTang().newConfigurationBuilder();

    for(Map.Entry<Class, Object> entry: this.namedParameters.entrySet()){
      conf = conf.bindNamedParameter(entry.getKey(), entry.getValue().toString());
    }

    conf = conf.bindNamedParameter(DefaultRuntimeName.class, this.defaultRuntime.get());

    for(final String runtimeName : this.runtimeNames){
      conf = conf.bindSetEntry(RuntimeNames.class, runtimeName);
    }

    if(!this.submissionRuntime.equalsIgnoreCase(RuntimeIdentifier.RUNTIME_NAME)){
      throw new RuntimeException("Unsupported submission runtime " + this.submissionRuntime);
    }

    conf = conf.bindImplementation(MultiRuntimeMainConfigurationGenerator.class,
            YarnMultiRuntimeMainConfigurationGeneratorImpl.class);

    // Currently only local runtime is supported as a secondary runtime
    return Configurations.merge(conf.build(),
            ExtensibleYarnClientConfiguration.CONF
                    .set(ExtensibleYarnClientConfiguration.DRIVER_CONFIGURATION_PROVIDER,
                            MultiRuntimeDriverConfigurationProvider.class).build());
  }
601331
public String build() {
    if (cachedBuildResult != null) {
      return cachedBuildResult;
    }

    StringBuilder str = new StringBuilder();
    str.append(type);
    str.append('/');
    str.append(subType);
    if (parameters != null) {
      for (Entry<String, String> entry : parameters.entrySet()) {
        String value = entry.getValue();
        str.append("; ");
        str.append(entry.getKey());
        str.append("=");
        str.append(!matchesToken(value) ? quoteString(value) : value);
      }
    }
    cachedBuildResult = str.toString();
    return cachedBuildResult;
  }
532057
public synchronized ObjectName register(Object obj) throws JMException {
		if (mbeanServer == null) {
			throw new JMException("JmxServer has not be started");
		}
		ObjectName objectName = ObjectNameUtil.makeObjectName(obj);
		ReflectionMbean mbean;
		try {
			mbean = new ReflectionMbean(obj, getObjectDescription(obj));
		} catch (Exception e) {
			throw createJmException("Could not build MBean object for: " + obj, e);
		}
		doRegister(objectName, mbean);
		return objectName;
	}
232890
public static Object getClassForName(String className) {
        Object object = null;
        try {
            Class classDefinition = Class.forName(className);
            object = classDefinition.newInstance();
        } catch (ClassNotFoundException e) {
            if (log.isEnabledFor(Level.ERROR)) {
                log.error("ClassNotFoundException", e);
            }
        } catch (InstantiationException e) {
            if (log.isEnabledFor(Level.ERROR)) {
                log.error("InstantiationException " + e.getMessage(), e);
            }
        } catch (IllegalAccessException e) {
            if (log.isEnabledFor(Level.ERROR)) {
                log.error("IllegalAccessException", e);
            }
        }
        return object;
    }
484705
public final String getName() {
        final String methodName = "getName";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
            trace.entry(this, cclass, methodName);
            trace.exit(this, cclass, methodName, new Object[] { storeName });
        }
        return storeName;
    }
1138293
@VisibleForTesting
	static String createIncompletePartObjectNamePrefix(String objectName) {
		checkNotNull(objectName);

		final int lastSlash = objectName.lastIndexOf('/');
		final String parent;
		final String child;

		if (lastSlash == -1) {
			parent = "";
			child = objectName;
		} else {
			parent = objectName.substring(0, lastSlash + 1);
			child = objectName.substring(lastSlash + 1);
		}
		return parent + (child.isEmpty() ? "" : '_') + child + "_tmp_";
	}