text:
package org.jboss.resteasy.test.microprofile.config;

import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.test.microprofile.config.resource.MicroProfileConfigFilter;
import org.jboss.resteasy.test.microprofile.config.resource.MicroProfileConfigResource;
import org.jboss.resteasy.utils.PortProviderUtil;
import org.jboss.resteasy.utils.TestUtil;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * @tpSubChapter MicroProfile Config
 * @tpChapter Integration tests
 * @tpTestCaseDetails Regression tests for RESTEASY-2131
 * @tpSince RESTEasy 4.0.0
 */
@RunWith(Arquillian.class)
@RunAsClient
public class MicroProfileConfigFilterTest {

   static ResteasyClient client;

   @Deployment
   public static Archive<?> deploy() {
      WebArchive war = TestUtil.prepareArchive(MicroProfileConfigFilterTest.class.getSimpleName())
            .addClass(MicroProfileConfigFilter.class)
            .setWebXML(MicroProfileConfigFilterTest.class.getPackage(), "web_filter.xml")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
      return TestUtil.finishContainerPrepare(war, null, MicroProfileConfigResource.class);
   }

   @BeforeClass
   public static void before() throws Exception {
      client = (ResteasyClient)ClientBuilder.newClient();
   }

   @AfterClass
   public static void after() throws Exception {
      client.close();
   }

   private String generateURL(String path) {
      return PortProviderUtil.generateURL(path, MicroProfileConfigFilterTest.class.getSimpleName());
   }

   /**
    * @tpTestDetails Verify system variables are accessible and have highest priority; get Config programmatically.
    * @tpSince RESTEasy 4.0.0
    */
   @Test
   public void testSystemProgrammatic() throws Exception {
      Response response = client.target(generateURL("/system/prog")).request().get();
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("system-system", response.readEntity(String.class));
   }

   /**
    * @tpTestDetails Verify system variables are accessible and have highest priority; get Config by injection.
    * @tpSince RESTEasy 4.0.0
    */
   @Test
   public void testSystemInject() throws Exception {
      Response response = client.target(generateURL("/system/inject")).request().get();
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("system-system", response.readEntity(String.class));
   }

   /**
    * @tpTestDetails Verify web.xml filter params are accessible and have higher priority than context params; get Config programmatically.
    * @tpSince RESTEasy 4.0.0
    */
   @Test
   public void testFilterProgrammatic() throws Exception {
      Response response = client.target(generateURL("/filter/prog")).request().get();
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("filter-filter", response.readEntity(String.class));
   }

   /**
    * @tpTestDetails Verify web.xml filter params are accessible and have higher priority than context params; get Config by injection.
    * @tpSince RESTEasy 4.0.0
    */
   @Test
   public void testFilterInject() throws Exception {
      Response response = client.target(generateURL("/filter/inject")).request().get();
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("filter-filter", response.readEntity(String.class));
   }

   /**
    * @tpTestDetails Verify web.xml context params are accessible; get Config programmatically.
    * @tpSince RESTEasy 4.0.0
    */
   @Test
   public void testContextProgrammatic() throws Exception {
      Response response = client.target(generateURL("/context/prog")).request().get();
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("context-context", response.readEntity(String.class));
   }

   /**
    * @tpTestDetails Verify web.xml context params are accessible; get Config by injection.
    * @tpSince RESTEasy 4.0.0
    */
   @Test
   public void testContextInject() throws Exception {
      Response response = client.target(generateURL("/context/inject")).request().get();
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("context-context", response.readEntity(String.class));
   }

   /**
    * @tpTestDetails Verify former context parameter "resteasy.add.charset" is overridden by system property.
    * @tpSince RESTEasy 4.0.0
    */
   @Test
   public void testActualContextParameter() throws Exception {
      Response response = client.target(generateURL("/actual")).request().get();
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("text/plain", response.getHeaderString("Content-Type"));
   }
}


text:
/*
 * (C) Copyright 2020 Boni Garcia (http://bonigarcia.github.io/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License..
 *
 */
package io.github.bonigarcia.wdm.online;

import static io.github.bonigarcia.wdm.config.Config.isNullOrEmpty;
import static java.io.File.separator;
import static java.lang.Integer.signum;
import static java.lang.Integer.valueOf;
import static java.lang.invoke.MethodHandles.lookup;
import static java.util.Arrays.copyOf;
import static java.util.Collections.singletonList;
import static java.util.Locale.ROOT;
import static java.util.stream.Collectors.toList;
import static org.slf4j.LoggerFactory.getLogger;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Stream;

import org.slf4j.Logger;

import io.github.bonigarcia.wdm.config.Architecture;
import io.github.bonigarcia.wdm.config.Config;
import io.github.bonigarcia.wdm.config.OperatingSystem;
import io.github.bonigarcia.wdm.config.WebDriverManagerException;

/**
 * Handler for URLs (filtering, version selection).
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 4.0.0
 */
public class UrlHandler {

    public static final String ALPHA = "alpha";
    public static final String BETA = "beta";

    final Logger log = getLogger(lookup().lookupClass());

    Config config;
    List<URL> candidateUrls;
    String driverVersion;
    String shortDriverName;
    Function<String, Optional<URL>> buildUrlFunction;

    public UrlHandler(Config config, List<URL> candidateUrls,
            String driverVersion, String shortDriverName,
            Function<String, Optional<URL>> buildUrlFunction) {
        this.config = config;
        this.candidateUrls = candidateUrls;
        this.driverVersion = driverVersion;
        this.shortDriverName = shortDriverName;
        this.buildUrlFunction = buildUrlFunction;
    }

    public void filterByDriverName(String driverName) {
        candidateUrls = candidateUrls.stream()
                .filter(url -> url.getFile().contains(driverName)
                        && !url.getFile().contains("-symbols"))
                .collect(toList());
    }

    public void filterByVersion(String driverVersion) {
        this.driverVersion = driverVersion;
        candidateUrls = candidateUrls.stream()
                .filter(url -> url.getFile().contains(driverVersion))
                .collect(toList());
    }

    public void filterByLatestVersion(Function<URL, String> getCurrentVersion) {
        log.trace("Checking the lastest version using URL list {}",
                candidateUrls);
        List<URL> out = new ArrayList<>();
        List<URL> copyOfList = new ArrayList<>(candidateUrls);
        String foundFriverVersion = null;

        for (URL url : copyOfList) {
            try {
                if (isNotStable(url)) {
                    continue;
                }
                String currentVersion = getCurrentVersion.apply(url);
                if (isNullOrEmpty(foundFriverVersion)) {
                    foundFriverVersion = currentVersion;
                }
                if (versionCompare(currentVersion, foundFriverVersion) > 0) {
                    foundFriverVersion = currentVersion;
                    out.clear();
                }
                if (url.getFile().contains(foundFriverVersion)) {
                    out.add(url);
                }
            } catch (Exception e) {
                log.trace("There was a problem with URL {} : {}", url,
                        e.getMessage());
                candidateUrls.remove(url);
            }
        }
        this.driverVersion = foundFriverVersion;
        this.candidateUrls = out;
    }

    public void filterByBeta(boolean useBeta) {
        if (!useBeta) {
            log.trace("URLs before filtering by beta versions: {}",
                    candidateUrls);
            candidateUrls = candidateUrls.stream().filter(url -> {
                String fileLowerCase = url.getFile().toLowerCase(ROOT);
                return !fileLowerCase.contains(BETA)
                        && !fileLowerCase.contains(ALPHA);
            }).collect(toList());
            log.trace("URLs after filtering by beta versions: {}",
                    candidateUrls);
        }
    }

    public void filterByOs(String driverName, String osName) {
        if (!driverName.equalsIgnoreCase("IEDriverServer")
                && !driverName.equalsIgnoreCase("selenium-server-standalone")) {
            log.trace("URLs before filtering by OS ({}): {}", osName,
                    candidateUrls);
            candidateUrls = candidateUrls.stream().filter(url -> OperatingSystem
                    .valueOf(osName).matchOs(url.getFile())).collect(toList());
            log.trace("URLs after filtering by OS ({}): {}", osName,
                    candidateUrls);
        }
    }

    public void filterByArch(Architecture arch, boolean forcedArch) {
        log.trace("URLs before filtering by architecture ({}): {}", arch,
                candidateUrls);
        if ((forcedArch || candidateUrls.size() > 1) && arch != null) {
            candidateUrls = candidateUrls.stream().filter(arch::matchUrl)
                    .collect(toList());
        }
        log.trace("URLs after filtering by architecture ({}): {}", arch,
                candidateUrls);

        if (candidateUrls.isEmpty() && !forcedArch
                && !candidateUrls.isEmpty()) {
            candidateUrls = singletonList(
                    candidateUrls.get(candidateUrls.size() - 1));
            log.trace(
                    "Empty URL list after filtering by architecture ... using last candidate: {}",
                    candidateUrls);
        }
    }

    public void filterByDistro(String os, String driverName) {
        try {
            if (os.equalsIgnoreCase("linux")
                    && driverName.contains("phantomjs")) {
                String distro = getDistroName();
                String versionToFilter = "2.5.0";
                log.trace(
                        "URLs before filtering by Linux distribution ({}): {}",
                        distro, candidateUrls);
                candidateUrls = candidateUrls.stream()
                        .filter(url -> !url.getFile().contains(versionToFilter)
                                || url.getFile().contains(distro))
                        .collect(toList());
                log.trace("URLs after filtering by Linux distribution ({}): {}",
                        distro, candidateUrls);
            }
        } catch (Exception e) {
            log.warn(
                    "An exception happens when filtering by distro to resolve {}: {}",
                    driverName, e.getMessage());
        }
    }

    public void filterByIgnoredVersions(List<String> ignoredVersions) {
        if (!ignoredVersions.isEmpty() && !candidateUrls.isEmpty()) {
            log.trace("URLs before filtering by ignored versions ({}): {}",
                    ignoredVersions, candidateUrls);
            candidateUrls = candidateUrls.stream()
                    .filter(url -> ignoredVersions.stream().noneMatch(
                            version -> url.getFile().contains(version)))
                    .collect(toList());

            log.trace("URLs after filtering by ignored versions ({}): {}",
                    ignoredVersions, candidateUrls);
        }
    }

    public String getDistroName() throws IOException {
        String out = "";
        final String key = "UBUNTU_CODENAME";
        File dir = new File(separator + "etc");
        File[] fileList = new File[0];
        if (dir.exists()) {
            fileList = dir.listFiles(
                    (path, filename) -> filename.endsWith("-release"));
        }
        File fileVersion = new File(separator + "proc", "version");
        if (fileVersion.exists()) {
            fileList = copyOf(fileList, fileList.length + 1);
            fileList[fileList.length - 1] = fileVersion;
        }
        for (File f : fileList) {
            if (f.isDirectory()) {
                continue;
            }
            try (BufferedReader myReader = new BufferedReader(
                    new FileReader(f))) {
                String strLine = null;
                while ((strLine = myReader.readLine()) != null) {
                    if (strLine.contains(key)) {
                        int beginIndex = key.length();
                        out = strLine.substring(beginIndex + 1);
                    }
                }
            }
        }
        return out;
    }

    public void resetList(List<URL> newCandidateUrls) {
        candidateUrls = newCandidateUrls.stream()
                .filter(url -> !url.getFile().contains(driverVersion))
                .collect(toList());
    }

    public boolean isNotStable(URL url) {
        String fileLowerCase = url.getFile().toLowerCase(ROOT);
        return !config.isUseMirror() && (fileLowerCase.contains(BETA)
                || fileLowerCase.contains(ALPHA));
    }

    public Integer versionCompare(String str1, String str2) {
        String[] vals1 = str1.replace("v", "").replace("-" + BETA, "")
                .split("\\.");
        String[] vals2 = str2.replace("v", "").replace("-" + BETA, "")
                .split("\\.");

        if (vals1[0].equals("")) {
            vals1[0] = "0";
        }
        if (vals2[0].equals("")) {
            vals2[0] = "0";
        }

        int i = 0;
        while (i < vals1.length && i < vals2.length
                && vals1[i].equals(vals2[i])) {
            i++;
        }

        if (i < vals1.length && i < vals2.length) {
            return signum(valueOf(vals1[i]).compareTo(valueOf(vals2[i])));
        } else {
            return signum(vals1.length - vals2.length);
        }
    }

    public List<URL> getCandidateUrls() {
        return candidateUrls;
    }

    public String getDriverVersion() {
        return driverVersion;
    }

    public boolean hasNoCandidateUrl() {
        return candidateUrls.isEmpty();
    }

    public URL getCandidateUrl() {
        if (hasNoCandidateUrl()) {
            Optional<URL> buildUrl = buildUrlFunction.apply(driverVersion);

            if (buildUrl.isPresent()) {
                URL url = buildUrl.get();

                // Check ignored versions
                Stream<String> ignoredVersionsStream = config
                        .getIgnoreVersions().stream();
                if (ignoredVersionsStream.noneMatch(url.getFile()::contains)) {
                    return url;
                }
            }

            String driverVersionLabel = isNullOrEmpty(driverVersion) ? ""
                    : " " + driverVersion;
            String errorMessage = String.format(
                    "No proper candidate URL to download %s%s", shortDriverName,
                    driverVersionLabel);
            throw new WebDriverManagerException(errorMessage);
        }
        return candidateUrls.iterator().next();
    }

}

domain: java


text:
/**
 *    Copyright 2011 Pedro Ribeiro
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.jalphanode.jmx.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates that an attribute with public getter/setter should be exposed as a MBean attribute. The field is not
 * accessed directly, but through the getter/setter. This annotation can be applied to either a field, or getter/setter
 * of a public class that is itself is optionally annotated with an @MBean annotation, or inherits such an annotation
 * from a superclass.
 *
 * @author  pribeiro
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.FIELD })
public @interface ManagedAttribute {
    String description() default "";

    String name() default "";
}


text:
/*
 * Copyright (c) 2020 Richard Hauswald - https://quantummaid.de/.
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package de.quantummaid.httpmaid.usecases.mapmaid;

import de.quantummaid.httpmaid.serialization.Serializer;
import de.quantummaid.mapmaid.MapMaid;
import de.quantummaid.mapmaid.mapper.marshalling.MarshallingType;
import de.quantummaid.reflectmaid.resolvedtype.ResolvedType;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

import static de.quantummaid.reflectmaid.GenericType.fromResolvedType;

@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public final class ReturnValueSerializer implements Serializer {
    private final MapMaid mapMaid;

    public static ReturnValueSerializer returnValueSerializer(final MapMaid mapMaid) {
        return new ReturnValueSerializer(mapMaid);
    }

    @Override
    public Object serialize(final Object object, final ResolvedType type) {
        final MarshallingType<Object> marshallingType = MarshallingType.UNIVERSAL_OBJECT;
        return mapMaid.serializeTo(object, marshallingType, fromResolvedType(type));
    }
}


text:
/*
 * Copyright 2002-2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.web.method.annotation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.servlet.ServletException;

import org.springframework.beans.ConversionNotSupportedException;
import org.springframework.beans.TypeMismatchException;
import org.springframework.beans.factory.config.BeanExpressionContext;
import org.springframework.beans.factory.config.BeanExpressionResolver;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.core.MethodParameter;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ValueConstants;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;

/**
 * Abstract base class for resolving method arguments from a named value.
 * Request parameters, request headers, and path variables are examples of named
 * values. Each may have a name, a required flag, and a default value.
 *
 *
Subclasses define how to do the following:
 *

 *
Obtain named value information for a method parameter
 *
Resolve names into argument values
 *
Handle missing argument values when argument values are required
 *
Optionally handle a resolved value
 *

 *
 *
A default value string can contain ${...} placeholders and Spring Expression
 * Language #{...} expressions. For this to work a
 * {@link ConfigurableBeanFactory} must be supplied to the class constructor.
 *
 *
A {@link WebDataBinder} is created to apply type conversion to the resolved
 * argument value if it doesn't match the method parameter type.
 *
 * @author Arjen Poutsma
 * @author Rossen Stoyanchev
 * @author Juergen Hoeller
 * @since 3.1
 */
public abstract class AbstractNamedValueMethodArgumentResolver implements HandlerMethodArgumentResolver {

	@Nullable
	private final ConfigurableBeanFactory configurableBeanFactory;

	@Nullable
	private final BeanExpressionContext expressionContext;

	private final Map<MethodParameter, NamedValueInfo> namedValueInfoCache = new ConcurrentHashMap<>(256);

	public AbstractNamedValueMethodArgumentResolver() {
		this.configurableBeanFactory = null;
		this.expressionContext = null;
	}

	/**
	 * Create a new {@link AbstractNamedValueMethodArgumentResolver} instance.
	 * @param beanFactory a bean factory to use for resolving ${...} placeholder
	 * and #{...} SpEL expressions in default values, or {@code null} if default
	 * values are not expected to contain expressions
	 */
	public AbstractNamedValueMethodArgumentResolver(@Nullable ConfigurableBeanFactory beanFactory) {
		this.configurableBeanFactory = beanFactory;
		this.expressionContext =
				(beanFactory != null ? new BeanExpressionContext(beanFactory, new RequestScope()) : null);
	}

	@Override
	@Nullable
	public final Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
			NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception {

		// 获取@RequireParam注解等注解的name,default等信息，封装成NamedValueInfo
		// 如果注解中没有定义，直接获取参数的名称
		NamedValueInfo namedValueInfo = getNamedValueInfo(parameter);

		// 可以简单理解为参数本身
		MethodParameter nestedParameter = parameter.nestedIfOptional();

		// 解析name，这边是解析el表达式
		Object resolvedName = resolveStringValue(namedValueInfo.name);
		if (resolvedName == null) {
			throw new IllegalArgumentException(
					"Specified name must not resolve to null: [" + namedValueInfo.name + "]");
		}

		// 获取参数值
		// request.getParameterValues(name);
		// 这边是Object类型的，没有见过类型转换
		Object arg = resolveName(resolvedName.toString(), nestedParameter, webRequest);
		if (arg == null) {
			// 默认值
			if (namedValueInfo.defaultValue != null) {
				arg = resolveStringValue(namedValueInfo.defaultValue);
			}
			else if (namedValueInfo.required && !nestedParameter.isOptional()) {
				handleMissingValue(namedValueInfo.name, nestedParameter, webRequest);
			}
			arg = handleNullValue(namedValueInfo.name, arg, nestedParameter.getNestedParameterType());
		}
		else if ("".equals(arg) && namedValueInfo.defaultValue != null) {
			arg = resolveStringValue(namedValueInfo.defaultValue);
		}

		if (binderFactory != null) {
			// DataBinder
			WebDataBinder binder = binderFactory.createBinder(webRequest, null, namedValueInfo.name);
			try {
				// 使用DataBinder转换类型，内部是使用的spring TypeConverter
				arg = binder.convertIfNecessary(arg, parameter.getParameterType(), parameter);
			}
			catch (ConversionNotSupportedException ex) {
				throw new MethodArgumentConversionNotSupportedException(arg, ex.getRequiredType(),
						namedValueInfo.name, parameter, ex.getCause());
			}
			catch (TypeMismatchException ex) {
				throw new MethodArgumentTypeMismatchException(arg, ex.getRequiredType(),
						namedValueInfo.name, parameter, ex.getCause());
			}
		}

		handleResolvedValue(arg, namedValueInfo.name, parameter, mavContainer, webRequest);

		return arg;
	}

	/**
	 * Obtain the named value for the given method parameter.
	 */
	private NamedValueInfo getNamedValueInfo(MethodParameter parameter) {
		NamedValueInfo namedValueInfo = this.namedValueInfoCache.get(parameter);
		if (namedValueInfo == null) {
			namedValueInfo = createNamedValueInfo(parameter);
			namedValueInfo = updateNamedValueInfo(parameter, namedValueInfo);
			this.namedValueInfoCache.put(parameter, namedValueInfo);
		}
		return namedValueInfo;
	}

	/**
	 * Create the {@link NamedValueInfo} object for the given method parameter. Implementations typically
	 * retrieve the method annotation by means of {@link MethodParameter#getParameterAnnotation(Class)}.
	 * @param parameter the method parameter
	 * @return the named value information
	 */
	protected abstract NamedValueInfo createNamedValueInfo(MethodParameter parameter);

	/**
	 * Create a new NamedValueInfo based on the given NamedValueInfo with sanitized values.
	 */
	private NamedValueInfo updateNamedValueInfo(MethodParameter parameter, NamedValueInfo info) {
		String name = info.name;
		if (info.name.isEmpty()) {
			name = parameter.getParameterName();
			if (name == null) {
				throw new IllegalArgumentException(
						"Name for argument type [" + parameter.getNestedParameterType().getName() +
						"] not available, and parameter name information not found in class file either.");
			}
		}
		String defaultValue = (ValueConstants.DEFAULT_NONE.equals(info.defaultValue) ? null : info.defaultValue);
		return new NamedValueInfo(name, info.required, defaultValue);
	}

	/**
	 * Resolve the given annotation-specified value,
	 * potentially containing placeholders and expressions.
	 */
	@Nullable
	private Object resolveStringValue(String value) {
		if (this.configurableBeanFactory == null) {
			return value;
		}
		String placeholdersResolved = this.configurableBeanFactory.resolveEmbeddedValue(value);
		BeanExpressionResolver exprResolver = this.configurableBeanFactory.getBeanExpressionResolver();
		if (exprResolver == null || this.expressionContext == null) {
			return value;
		}
		return exprResolver.evaluate(placeholdersResolved, this.expressionContext);
	}

	/**
	 * Resolve the given parameter type and value name into an argument value.
	 * @param name the name of the value being resolved
	 * @param parameter the method parameter to resolve to an argument value
	 * (pre-nested in case of a {@link java.util.Optional} declaration)
	 * @param request the current request
	 * @return the resolved argument (may be {@code null})
	 * @throws Exception in case of errors
	 */
	@Nullable
	protected abstract Object resolveName(String name, MethodParameter parameter, NativeWebRequest request)
			throws Exception;

	/**
	 * Invoked when a named value is required, but {@link #resolveName(String, MethodParameter, NativeWebRequest)}
	 * returned {@code null} and there is no default value. Subclasses typically throw an exception in this case.
	 * @param name the name for the value
	 * @param parameter the method parameter
	 * @param request the current request
	 * @since 4.3
	 */
	protected void handleMissingValue(String name, MethodParameter parameter, NativeWebRequest request)
			throws Exception {

		handleMissingValue(name, parameter);
	}

	/**
	 * Invoked when a named value is required, but {@link #resolveName(String, MethodParameter, NativeWebRequest)}
	 * returned {@code null} and there is no default value. Subclasses typically throw an exception in this case.
	 * @param name the name for the value
	 * @param parameter the method parameter
	 */
	protected void handleMissingValue(String name, MethodParameter parameter) throws ServletException {
		throw new ServletRequestBindingException("Missing argument '" + name +
				"' for method parameter of type " + parameter.getNestedParameterType().getSimpleName());
	}

	/**
	 * A {@code null} results in a {@code false} value for {@code boolean}s or an exception for other primitives.
	 */
	@Nullable
	private Object handleNullValue(String name, @Nullable Object value, Class<?> paramType) {
		if (value == null) {
			if (Boolean.TYPE.equals(paramType)) {
				return Boolean.FALSE;
			}
			else if (paramType.isPrimitive()) {
				throw new IllegalStateException("Optional " + paramType.getSimpleName() + " parameter '" + name +
						"' is present but cannot be translated into a null value due to being declared as a " +
						"primitive type. Consider declaring it as object wrapper for the corresponding primitive type.");
			}
		}
		return value;
	}

	/**
	 * Invoked after a value is resolved.
	 * @param arg the resolved argument value
	 * @param name the argument name
	 * @param parameter the argument parameter type
	 * @param mavContainer the {@link ModelAndViewContainer} (may be {@code null})
	 * @param webRequest the current request
	 */
	protected void handleResolvedValue(@Nullable Object arg, String name, MethodParameter parameter,
			@Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest) {
	}

	/**
	 * Represents the information about a named value, including name, whether it's required and a default value.
	 */
	protected static class NamedValueInfo {

		private final String name;

		private final boolean required;

		@Nullable
		private final String defaultValue;

		public NamedValueInfo(String name, boolean required, @Nullable String defaultValue) {
			this.name = name;
			this.required = required;
			this.defaultValue = defaultValue;
		}
	}

}


text:
package controllers;

import java.io.File;
import java.util.Map;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import models.Document;
import models.DocumentRepository;
import play.Logger;
import play.mvc.Controller;
import play.mvc.Http.MultipartFormData;
import play.mvc.Http.MultipartFormData.FilePart;
import play.mvc.Result;
import util.Importer;

/**
 * The main set of web services.
 */
@Named
@Singleton
public class ImportController extends Controller {

    private final DocumentRepository documentRepository;

    // We are using constructor injection to receive a repository to support our desire for immutability.
    @Inject
    public ImportController(final DocumentRepository documentRepository) {
        this.documentRepository = documentRepository;
    }

    public Result form() {
        return ok(views.html.importer.render(""));
    }

    public Result upload() {

        MultipartFormData body = request().body().asMultipartFormData();
        FilePart filePart = body.getFile("file");
        if (filePart != null) {
            String fileName = filePart.getFilename();
//            String contentType = filePart.getContentType();
            File file = filePart.getFile();

            try {
                Map<String, String[]> postData = body.asFormUrlEncoded();
                String encoding = getEncoding(postData.get("encoding"));
                Document doc = Importer.importFromTextfile(file, encoding);
                doc.title = fileName;
                doc.givenname = "Vorname";
                doc.surname = "Nachname";
                documentRepository.save(doc);
                return redirect(routes.Application.findById(doc.id));
            } catch (Exception e) {
                Logger.warn("Datei liegt nicht im richtigen Format vor.", e);
                flash("error", "Datei liegt nicht im richtigen Format vor.");
                return redirect(routes.ImportController.form());
            }

        } else {
            flash("error", "Missing file");
            return redirect(routes.ImportController.form());
        }

    }

    private static String getEncoding(String[] encoding) {
        if (encoding.length == 1) {
            if ("UTF-8".equals(encoding[0])) {
                return "UTF-8";
            } else {
                return "ISO-8859-15";
            }
        } else {
            return "ISO-8859-15";
        }
    }

}


text:
package com.zj.wheelview.activity;

import android.content.Intent;
import android.webkit.WebView;

import com.loopj.android.http.AsyncHttpResponseHandler;
import com.xx.wheelview.activity.BaseActivity;
import com.zj.wheelview.NetApi;
import com.zj.wheelview.R;
import com.zj.wheelview.utils.CommonUtil;

import org.json.JSONException;
import org.json.JSONObject;

import butterknife.InjectView;
import butterknife.OnClick;
import cz.msebera.android.httpclient.Header;

public class StoreInfoActivity extends BaseActivity {

    @InjectView(R.id.webview)
    WebView webview;
    String contents;

    @Override
    protected boolean hasBackButton() {
        return true;
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_store_info;
    }

    @Override
    protected int getTitleResId() {
        return R.string.store_info;
    }

    @Override
    protected void initViews() {
        getContentsList();
    }

    @OnClick(R.id.tvEditStore)
    public void editStore() {
        startActivityForResult(new Intent(StoreInfoActivity.this, com.zj.wheelview.activity.EditStoreActivity.class), 10);
    }

    public void getContentsList() {
        showWaitDialog();
        NetApi.getContentsList(StoreInfoActivity.this, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
                hideWaitDialog();
                try {
                    if (responseBody != null) {
                        String result = new String(responseBody);
                        LogUtil.log("result----" + result);
                        JSONObject obj = new JSONObject(result);
                        String resultCode = obj.getString("resultCode");
                        String msg = obj.getString("msg");
                        if ("00".equals(resultCode)) {
                            contents = obj.getString("contents");
                            webview.loadDataWithBaseURL(null, contents, "text/html", "utf-8", null);
                        } else {
                            CommonUtil.showToastMessage(StoreInfoActivity.this, msg);
                        }
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
                hideWaitDialog();
                if (responseBody != null) {
                    LogUtil.log("responseBody----" + new String(responseBody));
                }
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 10 && resultCode == RESULT_OK) {
            getContentsList();
        }
    }

    @Override
    public void onBackPressed() {
        setResult(RESULT_OK, new Intent().putExtra("contents", contents));
        super.onBackPressed();
    }
}


text:
/*
 * @(#)DuplicateCommand.java 5.1
 *
 */

package CH.ifa.draw.standard;

import java.util.*;
import CH.ifa.draw.util.*;
import CH.ifa.draw.framework.*;

/**
 * Duplicate the selection and select the duplicates.
 */
public class DuplicateCommand extends FigureTransferCommand {

   /**
    * Constructs a duplicate command.
    * @param name the command name
    * @param view the target view
    */
    public DuplicateCommand(String name, DrawingView view) {
        super(name, view);
    }

    public void execute() {
        FigureSelection selection = fView.getFigureSelection();

        fView.clearSelection();

        Vector figures = (Vector)selection.getData(FigureSelection.TYPE);
        insertFigures(figures, 10, 10);
        fView.checkDamage();
    }

    public boolean isExecutable() {
        return fView.selectionCount() > 0;
    }

}


text:
package com.kuma.startandroid.process.task;

import com.kuma.startandroid.error.BuildProjectException;
import com.kuma.startandroid.file.ProjectFiles;
import com.kuma.startandroid.process.AndroidProjectConfiguration;

import java.nio.file.Paths;

public class CreateResultFolders implements CreateProjectTask {

    @Override
    public void execute(AndroidProjectConfiguration configuration)
            throws BuildProjectException {

        // Create Result Folder
        String _resultPath = getResultPath(configuration);
        ProjectFiles.createDirectories(Paths.get(_resultPath));
        configuration.setResultPath(_resultPath);

        // Create Package Folder
        String packagePath = getPackagePath(configuration);
        configuration.getResourcesProperties().getPackagesFolders()
                .forEach((k, v) -> {
                    String path = _resultPath + v + packagePath;
                    ProjectFiles.createDirectories(Paths.get(path));
                    configuration.addPackageFolder(k, path);
                });

    }

    private String getPackagePath(AndroidProjectConfiguration configuration) {
        return configuration.getProjectPackage().replace(ProjectFiles.DOT, ProjectFiles.SLASH);
    }

    private String getResultPath(AndroidProjectConfiguration configuration) {
        String _resultPath = configuration.getResourcesProperties()
                .getResultFolderPath()
                + ProjectFiles.SLASH
                + configuration.getProjectPackage().replace(ProjectFiles.DOT, ProjectFiles.DASH)
                + ProjectFiles.DASH
                + System.currentTimeMillis();
        return _resultPath;
    }

}


text:
/**
 * Copyright (C) 2015-2018 HandcraftedBits
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.handcraftedbits.bamboo.plugin.go.task.common;

import java.util.Map;

import com.atlassian.bamboo.collections.ActionParametersMap;
import com.atlassian.bamboo.process.EnvironmentVariableAccessor;
import com.atlassian.bamboo.task.TaskDefinition;
import com.atlassian.bamboo.v2.build.agent.capability.CapabilityContext;
import com.atlassian.struts.TextProvider;
import com.handcraftedbits.bamboo.plugin.go.capability.GoCapabilityTypeModule;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public abstract class AbstractPackageAwareTaskConfigurator extends AbstractGoExecutableTaskConfigurator {
     protected AbstractPackageAwareTaskConfigurator (@NotNull final CapabilityContext capabilityContext,
          @NotNull final EnvironmentVariableAccessor environmentVariableAccessor,
          @NotNull final TextProvider textProvider, final boolean allowCustomEnvironment) {
          super(capabilityContext, environmentVariableAccessor, textProvider, allowCustomEnvironment);

          // Add requirements.

          addRequirement(GoCapabilityTypeModule.CAPABILITY_KEY_GO);
     }

     @Override
     @NotNull
     public Map<String, String> generateTaskConfigMap (@NotNull final ActionParametersMap params,
          @Nullable final TaskDefinition previousTaskDefinition) {
          final Map<String, String> config = super.generateTaskConfigMap(params, previousTaskDefinition);

          new GoPackagesDefinition(params).addToConfig(config);

          return config;
     }

     @Override
     public void populateContextForCreate (@NotNull final Map<String, Object> context) {
          final GoPackagesDefinition packages = new GoPackagesDefinition();

          super.populateContextForCreate(context);

          packages.addPackageDefinition(0, "", "");

          packages.addToContext(context);
     }

     @Override
     public void populateContextForEdit (@NotNull final Map<String, Object> context,
          @NotNull final TaskDefinition taskDefinition) {
          super.populateContextForEdit(context, taskDefinition);

          new GoPackagesDefinition(taskDefinition.getConfiguration()).addToContext(context);
     }
}


text:
package org.apereo.cas.support.oauth.web;

import org.apereo.cas.support.oauth.OAuth20GrantTypes;
import org.apereo.cas.support.oauth.services.OAuthRegisteredService;
import org.apereo.cas.support.oauth.web.endpoints.OAuth20AccessTokenEndpointController;

import lombok.val;

import java.util.HashSet;
import java.util.Set;

/**
 * This class tests the {@link OAuth20AccessTokenEndpointController} class.
 * <p>
 * It does almost the same as {@link OAuth20AccessTokenControllerTests}, but the registered
 * services always contain empty allowed grant types. These tests are run to ensure that
 * the change that adds proper support for supportedGrantTypes does not break existing CAS
 * setups that does not specify allowedGrantTypes. Briefly, it checks that empty supportedGrantTypes
 * is equivalent to supportedGrantTypes with all valid values.
 *
 * @author Kirill Gagarski
 * @since 5.3.3
 */
public class OAuth20AccessTokenControllerNoGrantTypeTests extends OAuth20AccessTokenControllerTests {
    @Override
    protected OAuthRegisteredService getRegisteredService(final String serviceId, final String secret,
                                                          final Set<OAuth20GrantTypes> grantTypes) {
        val service = super.getRegisteredService(serviceId, secret, grantTypes);
        service.setSupportedGrantTypes(new HashSet<>());
        return service;
    }

    /**
     * This test should never fail in this suite, so just doing nothing.
     */
    @Override
    public void verifyClientDisallowedGrantType() {
    }
}


text:
package com.mrbysco.ageingspawners.util;

import com.mrbysco.ageingspawners.config.SpawnerConfig;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.lang3.math.NumberUtils;

import java.util.ArrayList;
import java.util.List;

public class AgeingHelper {
	public static boolean blacklistContains(ResourceLocation registryName) {
		List<? extends String> blacklist = SpawnerConfig.COMMON.blacklist.get();
		List<ResourceLocation> blacklistList = new ArrayList<>();
		for (String s : blacklist) {
			if(!s.isEmpty()) {
				blacklistList.add(new ResourceLocation(s));
			}
		}
		return blacklistList.contains(registryName);
	}

	public static boolean whitelistContains(ResourceLocation registryName) {
		List<? extends String> whitelist = SpawnerConfig.COMMON.whitelist.get();
		List<ResourceLocation> whitelistList = new ArrayList<>();
		for (String info : whitelist) {
			if(!info.isEmpty()) {
				if (info.contains(";")) {
					String[] infoArray = info.split(";");
					if (infoArray.length > 1) {
						whitelistList.add(new ResourceLocation(infoArray[0]));
					}
				} else {
					whitelistList.add(new ResourceLocation(info));
				}
			}
		}
		return whitelistList.contains(registryName);
	}

	public static int getMaxSpawnCount(ResourceLocation registryName) {
		List<? extends String> whitelist = SpawnerConfig.COMMON.whitelist.get();
		for (String info : whitelist) {
			if(!info.isEmpty()) {
				if (info.contains(";")) {
					String[] infoArray = info.split(";");
					if (infoArray.length > 1 && new ResourceLocation(infoArray[0]).equals(registryName)) {
						return NumberUtils.toInt(infoArray[1]);
					}
				}
			}
		}
		return SpawnerConfig.COMMON.whitelistMaxSpawnCount.get();
	}
}


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

package org.apache.doris.analysis;

import org.apache.doris.catalog.Type;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.UserException;
import org.apache.doris.qe.OriginStatement;
import org.apache.doris.rewrite.ExprRewriter;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;

import java.util.Collections;
import java.util.List;

public abstract class StatementBase implements ParseNode {

    private String clusterName;

    // Set this variable if this QueryStmt is the top level query from an EXPLAIN <query>
    protected ExplainOptions explainOptions = null;

    /////////////////////////////////////////
    // BEGIN: Members that need to be reset()

    // Analyzer that was used to analyze this statement.
    protected Analyzer analyzer;

    // END: Members that need to be reset()
    /////////////////////////////////////////

    private OriginStatement origStmt;

    private UserIdentity userInfo;

    protected StatementBase() { }

    /**
     * C'tor for cloning.
     */
    protected StatementBase(StatementBase other) {
        analyzer = other.analyzer;
        explainOptions = other.explainOptions;
    }

    /**
     * Analyzes the statement and throws an AnalysisException if analysis fails. A failure
     * could be due to a problem with the statement or because one or more tables/views
     * were missing from the catalog.
     * It is up to the analysis() implementation to ensure the maximum number of missing
     * tables/views get collected in the Analyzer before failing analyze().
     */
    public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
        if (isAnalyzed()) return;
        this.analyzer = analyzer;
        if (Strings.isNullOrEmpty(analyzer.getClusterName())) {
            ErrorReport.reportAnalysisException(ErrorCode.ERR_CLUSTER_NO_SELECT_CLUSTER);
        }
        this.clusterName = analyzer.getClusterName();
    }

    public Analyzer getAnalyzer() {
        return analyzer;
    }

    public boolean isAnalyzed() {
        return analyzer != null;
    }

    public void setIsExplain(ExplainOptions options) {
        this.explainOptions = options;
    }

    public boolean isExplain() {
        return this.explainOptions != null;
    }

    public boolean isVerbose() {
        return explainOptions != null && explainOptions.isVerbose();
    }

    public ExplainOptions getExplainOptions() {
        return explainOptions;
    }

    /*
     * Print SQL syntax corresponding to this node.
     *
     * @see org.apache.doris.parser.ParseNode#toSql()
     */
    @Override
    public String toSql() {
        return "";
    }

    public abstract RedirectStatus getRedirectStatus();

    /**
     * Returns the output column labels of this statement, if applicable, or an empty list
     * if not applicable (not all statements produce an output result set).
     * Subclasses must override this as necessary.
     */
    public List<String> getColLabels() { return Collections.<String>emptyList();  }

    /**
     * Sets the column labels of this statement, if applicable. No-op of the statement does
     * not produce an output result set.
     */
    public void setColLabels(List<String> colLabels) {
        List<String> oldLabels = getColLabels();
        if (oldLabels == colLabels) return;
        oldLabels.clear();
        oldLabels.addAll(colLabels);
    }

    /**
     * Returns the unresolved result expressions of this statement, if applicable, or an
     * empty list if not applicable (not all statements produce an output result set).
     * Subclasses must override this as necessary.
     */
    public List<Expr> getResultExprs() { return Collections.<Expr>emptyList(); }

    /**
     * Casts the result expressions and derived members (e.g., destination column types for
     * CTAS) to the given types. No-op if this statement does not have result expressions.
     * Throws when casting fails. Subclasses may override this as necessary.
     */
    public void castResultExprs(List<Type> types) throws AnalysisException {
        List<Expr> resultExprs = getResultExprs();
        Preconditions.checkNotNull(resultExprs);
        Preconditions.checkState(resultExprs.size() == types.size());
        for (int i = 0; i < types.size(); ++i) {
            //The specific type of the date type is determined by the
            //actual type of the return value, not by the function return value type in FE Function
            //such as the result of str_to_date may be either DATE or DATETIME
            if (resultExprs.get(i).getType().isDateType() && types.get(i).isDateType()) {
                continue;
            }
            if (!resultExprs.get(i).getType().equals(types.get(i))) {
                resultExprs.set(i, resultExprs.get(i).castTo(types.get(i)));
            }
        }
    }

    /**
     * Uses the given 'rewriter' to transform all Exprs in this statement according
     * to the rules specified in the 'rewriter'. Replaces the original Exprs with the
     * transformed ones in-place. Subclasses that have Exprs to be rewritten must
     * override this method. Valid to call after analyze().
     */
    public void rewriteExprs(ExprRewriter rewriter) throws AnalysisException {
        throw new IllegalStateException(
                "rewriteExprs() not implemented for this stmt: " + getClass().getSimpleName());
    }

    public String getClusterName() {
        return clusterName;
    }

    public void setClusterName(String clusterName) {
        this.clusterName = clusterName;
    }

    public void setOrigStmt(OriginStatement origStmt) {
        Preconditions.checkState(origStmt != null);
        this.origStmt = origStmt;
    }

    public OriginStatement getOrigStmt() {
        return origStmt;
    }

    public UserIdentity getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserIdentity userInfo) {
        this.userInfo = userInfo;
    }

    /**
     * Resets the internal analysis state of this node.
     * For easier maintenance, class members that need to be reset are grouped into
     * a 'section' clearly indicated by comments as follows:
     *
     * class SomeStmt extends StatementBase {
     *   ...
     *   /////////////////////////////////////////
     *   // BEGIN: Members that need to be reset()
     *
     *   <member declarations>
     *
     *   // END: Members that need to be reset()
     *   /////////////////////////////////////////
     *   ...
     * }
     *
     * In general, members that are set or modified during analyze() must be reset().
     * TODO: Introduce this same convention for Exprs, possibly by moving clone()/reset()
     * into the ParseNode interface for clarity.
     */
    public void reset() {
        analyzer = null;
    }

    // Override this method and return true
    // if the stmt contains some information which need to be encrypted in audit log
    public boolean needAuditEncryption() {
        return false;
    }

}


text:
public class Main {

    // main driver method
    public static void main(String[] args) {
        System.out.println("\n");

        // creating threads
        Counter incrementThread = new Counter("incrementThread");
        Counter decrementThread = new Counter("decrementThread");

        // incrementing and decrementing
        incrementThread.increment();
        incrementThread.increment();
        incrementThread.increment();
        incrementThread.increment();
        decrementThread.decrement();
    }

}


text:
/*
 * Copyright 2016 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.kie.workbench.common.stunner.core.client.shape;

import org.kie.workbench.common.stunner.core.client.shape.view.*;
import org.kie.workbench.common.stunner.core.client.util.ShapeUtils;
import org.kie.workbench.common.stunner.core.graph.Edge;
import org.kie.workbench.common.stunner.core.graph.Node;
import org.kie.workbench.common.stunner.core.graph.content.view.View;
import org.kie.workbench.common.stunner.core.graph.util.GraphUtils;

import java.util.logging.Logger;

/**
 * A base shape impl for handling contents of node graph elements.
 */
public abstract class AbstractShape<W, E extends Node<View<W>, Edge>, V extends ShapeView>
        implements
        NodeShape<W, View<W>, E, V>,
        Lifecycle {

    private static Logger LOGGER = Logger.getLogger( AbstractShape.class.getName() );

    private String uuid;
    private V view;

    public AbstractShape( final V view ) {
        this.view = view;
    }

    public void setUUID( final String uuid ) {
        this.uuid = uuid;
    }

    @Override
    public String getUUID() {
        return uuid;
    }

    @Override
    public V getShapeView() {
        return view;
    }

    /*
        ****************************************************************************************
        *                       CONTEXTUAL SHAPE DRAWING & UPDATES
        ****************************************************************************************
     */

    @Override
    public void beforeDraw() {
    }

    @Override
    public void afterDraw() {
        if ( view instanceof HasTitle ) {
            ( ( HasTitle ) view ).moveTitleToTop();
        }
    }

    @Override
    public void applyPosition( final E element, final MutationContext mutationContext ) {
        final Double[] position = GraphUtils.getPosition( element.getContent() );
        final double x = position[ 0 ];
        final double y = position[ 1 ];
        view.setShapeX( x );
        view.setShapeY( y );

    }

    @Override
    public void applyProperties( final E element, final MutationContext mutationContext ) {
        // The graph element's name.
        _applyElementName( element, mutationContext );

    }

    @Override
    public void applyProperty( final E element,
                               final String propertyId,
                               final Object value,
                               final MutationContext mutationContext ) {
        // TODO
    }

    protected void applyFillColor( final String color, final MutationContext mutationContext ) {
        if ( color != null && color.trim().length() > 0 ) {
            final boolean hasGradient = view instanceof HasFillGradient;
            if ( !hasGradient ) {
                view.setFillColor( color );

            } else {
                ( ( HasFillGradient ) view ).setFillGradient( HasFillGradient.Type.LINEAR, color, "#FFFFFF" );

            }

        }
    }

    protected void applyFillAlpha( final Double alpha, final MutationContext mutationContext ) {
        if ( null != alpha ) {
            view.setFillAlpha( alpha );
        }
    }

    protected void applyBorders( final String color, final Double width, final MutationContext mutationContext ) {
        if ( color != null && color.trim().length() > 0 ) {
            view.setStrokeColor( color );
        }
        if ( width != null ) {
            view.setStrokeWidth( width );
        }
    }

    protected void applyBorderAlpha( final Double alpha, final MutationContext mutationContext ) {
        if ( null != alpha ) {
            view.setStrokeAlpha( alpha );
        }
    }

    protected void applyFont( final String family,
                              final String color,
                              final Double size,
                              final Double borderSize,
                              final Double alpha,
                              final MutationContext mutationContext ) {
        if ( view instanceof HasTitle ) {
            final HasTitle hasTitle = ( HasTitle ) view;
            if ( family != null && family.trim().length() > 0 ) {
                hasTitle.setTitleFontFamily( family );
            }
            if ( color != null && color.trim().length() > 0 ) {
                hasTitle.setTitleStrokeColor( color );
            }
            if ( size != null && size > 0 ) {
                hasTitle.setTitleFontSize( size );

            }
            applyFontAlpha( hasTitle, alpha, mutationContext );
            if ( borderSize != null && borderSize > 0 ) {
                hasTitle.setTitleStrokeWidth( borderSize );
            }
            // Refresh to update size changes etc.
            hasTitle.refreshTitle();

        }
    }

    protected void applyFontAlpha( final HasTitle hasTitle,
                                   final Double alpha,
                                   final MutationContext mutationContext ) {
        if ( null != alpha ) {
            hasTitle.setTitleAlpha( alpha );
        }

    }

    protected void applySize( final HasSize hasSize, final double width, final double height, final MutationContext mutationContext ) {
        hasSize.setSize( width, height );

    }

    protected void applyRadius( final HasRadius hasRadius, final double radius, final MutationContext mutationContext ) {
        if ( radius > 0 ) {
            hasRadius.setRadius( radius );

        }

    }

    protected String getNamePropertyValue( final E element ) {
        return null;
    }

    protected void _applyElementName( final E element, final MutationContext mutationContext ) {
        if ( view instanceof HasTitle ) {
            final HasTitle hasTitle = ( HasTitle ) view;
            final String name = getNamePropertyValue( element );
            hasTitle.setTitle( name );
            hasTitle.refreshTitle();

        }

    }

    protected abstract void doDestroy();

    @Override
    public void destroy() {
        doDestroy();
        view.destroy();
    }

    protected boolean isStaticMutation( final MutationContext mutationContext ) {
        return ShapeUtils.isStaticMutation( mutationContext );
    }

    protected boolean isAnimationMutation( final MutationContext mutationContext ) {
        return ShapeUtils.isAnimationMutation( view, mutationContext );
    }

    @Override
    public boolean equals( final Object o ) {
        if ( this == o ) {
            return true;
        }
        if ( !( o instanceof AbstractShape ) ) {
            return false;
        }
        AbstractShape that = ( AbstractShape ) o;
        return uuid.equals( that.uuid );
    }
}


text:
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.stanbol.enhancer.engines.tika;

import java.io.File;
import java.io.InputStream;
import java.util.Dictionary;
import java.util.Hashtable;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.BundleListener;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.ComponentInstance;

public class MockComponentContext implements ComponentContext {

    protected final Dictionary<String, Object> properties;

    public MockComponentContext() {
        properties = new Hashtable<String, Object>();
    }

    public MockComponentContext(Dictionary<String, Object> properties) {
        this.properties = properties;
    }

    public void disableComponent(String name) {
    }

    public void enableComponent(String name) {
    }

    public BundleContext getBundleContext() {
        return new BundleContext() {

            @Override
            public boolean ungetService(ServiceReference reference) {
                return false;
            }

            @Override
            public void removeServiceListener(ServiceListener listener) {
            }

            @Override
            public void removeFrameworkListener(FrameworkListener listener) {
            }

            @Override
            public void removeBundleListener(BundleListener listener) {
            }

            @Override
            public ServiceRegistration registerService(String clazz,
                    Object service, Dictionary properties) {
                return null;
            }

            @Override
            public ServiceRegistration registerService(String[] clazzes,
                    Object service, Dictionary properties) {
                return null;
            }

            @Override
            public Bundle installBundle(String location, InputStream input)
                    throws BundleException {
                return null;
            }

            @Override
            public Bundle installBundle(String location) throws BundleException {
                return null;
            }

            @Override
            public ServiceReference[] getServiceReferences(String clazz,
                    String filter) throws InvalidSyntaxException {
                return null;
            }

            @Override
            public ServiceReference getServiceReference(String clazz) {
                return null;
            }

            @Override
            public Object getService(ServiceReference reference) {
                return null;
            }

            @Override
            public String getProperty(String key) {
                return null;
            }

            @Override
            public File getDataFile(String filename) {
                return new File(System.getProperty("java.io.tmpdir"));
            }

            @Override
            public Bundle[] getBundles() {
                return null;
            }

            @Override
            public Bundle getBundle(long id) {
                return null;
            }

            @Override
            public Bundle getBundle() {
                return null;
            }

            @Override
            public ServiceReference[] getAllServiceReferences(String clazz,
                    String filter) throws InvalidSyntaxException {
                return null;
            }

            @Override
            public Filter createFilter(String filter)
                    throws InvalidSyntaxException {
                return null;
            }

            @Override
            public void addServiceListener(ServiceListener listener,
                    String filter) throws InvalidSyntaxException {

            }

            @Override
            public void addServiceListener(ServiceListener listener) {
            }

            @Override
            public void addFrameworkListener(FrameworkListener listener) {
            }

            @Override
            public void addBundleListener(BundleListener listener) {
            }
        };
    }

    public ComponentInstance getComponentInstance() {
        return null;
    }

    public Dictionary<String, Object> getProperties() {
        return properties;
    }

    public ServiceReference getServiceReference() {
        return null;
    }

    public Bundle getUsingBundle() {
        return null;
    }

    public Object locateService(String name) {
        return null;
    }

    public Object locateService(String name, ServiceReference reference) {
        return null;
    }

    public Object[] locateServices(String name) {
        return null;
    }

}


text:
/*
 * Copyright (C) 2017-2019 Dremio Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.dremio.exec.planner.logical;

import java.util.List;

import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.plan.RelTraitSet;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.type.RelDataType;

import com.dremio.exec.planner.common.WriterRelBase;

public class WriterRel extends WriterRelBase implements Rel {

  private final RelDataType expectedInboundRowType;

  public WriterRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, CreateTableEntry createTableEntry, RelDataType expectedInboundRowType) {
    super(LOGICAL, cluster, traitSet, input, createTableEntry);
    this.expectedInboundRowType = expectedInboundRowType;
  }

  @Override
  public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
    return new WriterRel(getCluster(), traitSet, sole(inputs), getCreateTableEntry(), expectedInboundRowType);
  }

  public RelDataType getExpectedInboundRowType() {
    return expectedInboundRowType;
  }

}


text:
/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.sazani.collect.android.provider;

import android.net.Uri;
import android.provider.BaseColumns;

/**
 * Contract between the forms provider and applications. Contains definitions for the supported URIs
 * and data columns.
 *
 * This defines the data model for blank forms. Blank forms are unique by
 * {@link FormsColumns#JR_FORM_ID} unless multiple {@link FormsColumns#JR_VERSION}s are defined.
 */
public final class FormsProviderAPI {
    static final String AUTHORITY = "org.sazani.collect.android.provider.odk.forms";

    private FormsProviderAPI() {
    }

    /**
     * Columns for the Forms table.
     */
    public static final class FormsColumns implements BaseColumns {
        private FormsColumns() {
        }

        /**
         * The content:// style URL for accessing Forms.
         */
        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/forms");

        /**
         * The content:// style URL for accessing the newest versions of Forms. For each
         * {@link FormsColumns#JR_FORM_ID}, only the version with the most recent
         * {@link FormsColumns#DATE} is included.
         */
        public static final Uri CONTENT_NEWEST_FORMS_BY_FORMID_URI = Uri.parse("content://" + AUTHORITY + "/newest_forms_by_form_id");

        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.odk.form";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.odk.form";

        // These are the only things needed for an insert
        public static final String DISPLAY_NAME = "displayName";
        public static final String DESCRIPTION = "description";  // can be null
        public static final String JR_FORM_ID = "jrFormId";
        public static final String JR_VERSION = "jrVersion"; // can be null
        public static final String FORM_FILE_PATH = "formFilePath";
        public static final String SUBMISSION_URI = "submissionUri"; // can be null
        public static final String BASE64_RSA_PUBLIC_KEY = "base64RsaPublicKey"; // can be null
        public static final String AUTO_DELETE = "autoDelete"; // can be null
        public static final String LAST_DETECTED_FORM_VERSION_HASH = "lastDetectedFormVersionHash"; // can be null
        // Column is called autoSubmit for legacy support but the attribute is auto-send
        public static final String AUTO_SEND = "autoSubmit"; // can be null
        public static final String GEOMETRY_XPATH = "geometryXpath"; // can be null

        // these are generated for you (but you can insert something else if you want)
        public static final String DISPLAY_SUBTEXT = "displaySubtext"; // not used in the newest database version
        public static final String MD5_HASH = "md5Hash";
        public static final String DATE = "date";
        public static final String MAX_DATE = "MAX(date)"; // used only to get latest forms for each form_id
        public static final String JRCACHE_FILE_PATH = "jrcacheFilePath";
        public static final String FORM_MEDIA_PATH = "formMediaPath";

        // this is null on create, and can only be set on an update.
        public static final String LANGUAGE = "language";
    }
}


text:
/**
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.mifosplatform.accounting.closure.data;

/**
 * Immutable data object represent loan status enumerations.
 */
@SuppressWarnings("unused")
public class LoanStatusEnumData {

    private final Long id;
    private final String code;
    private final String value;
    private final boolean pendingApproval;
    private final boolean waitingForDisbursal;
    private final boolean active;
    private final boolean closedObligationsMet;
    private final boolean closedWrittenOff;
    private final boolean closedRescheduled;
    private final boolean closed;
    private final boolean overpaid;

    public LoanStatusEnumData(final Long id, final String code, final String value) {
        this.id = id;
        this.code = code;
        this.value = value;
        this.pendingApproval = Long.valueOf(100).equals(this.id);
        this.waitingForDisbursal = Long.valueOf(200).equals(this.id);
        this.active = Long.valueOf(300).equals(this.id);
        this.closedObligationsMet = Long.valueOf(600).equals(this.id);
        this.closedWrittenOff = Long.valueOf(601).equals(this.id);
        this.closedRescheduled = Long.valueOf(602).equals(this.id);
        this.closed = this.closedObligationsMet || this.closedWrittenOff || this.closedRescheduled;
        this.overpaid = Long.valueOf(700).equals(this.id);
    }

    public Long id() {
        return this.id;
    }
}


text:
package no.hvl.dat104.controller.deltager;

import static no.hvl.dat104.controller.UrlMappings.DELTAGERLISTE_URL;
import static no.hvl.dat104.controller.UrlMappings.PAAMELDINGSBEKREFTELSE_URL;
import static no.hvl.dat104.controller.UrlMappings.PAAMELDING_URL;

import java.io.IOException;
import java.util.List;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import no.hvl.dat104.dataaccess.IDeltagerEAO;
import no.hvl.dat104.model.DeltagerEntity;
import no.hvl.dat104.util.DeltagerUtil;
import no.hvl.dat104.util.InnlogginUtil;
import no.hvl.dat104.util.RegistrerUtil;

/**
 * Servlet implementation class PaameldingServlet
 */
public class PaameldingServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@EJB
	private IDeltagerEAO deltagerEAO;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		if (InnlogginUtil.erInnlogget(request)) {
			response.sendRedirect(DELTAGERLISTE_URL);
		} else {
			RegistrerUtil.setUpCookiesTilRequest(request);
			RegistrerUtil.setUpfeilMeldinger(request);
			request.getRequestDispatcher("WEB-INF/jsp/deltager/paameldingsskjema.jsp").forward(request, response);
		}
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		if (!InnlogginUtil.erInnlogget(request)) {
			DeltagerEntity d = DeltagerUtil.leggTilDeltager(request, deltagerEAO);
			if (d != null) {
				request.getSession().setAttribute("registrert", true);
				request.getSession().setAttribute("regDeltager", d);
				response.sendRedirect(PAAMELDINGSBEKREFTELSE_URL);
			} else {
				List<Cookie> cookies = RegistrerUtil.hentPersonOpplysninger(request, response);
				RegistrerUtil.sjekkCookies(cookies, request);
				request.getSession().setAttribute("registrert", false);
				response.sendRedirect(PAAMELDING_URL);
			}
		} else {
			response.sendRedirect(DELTAGERLISTE_URL);
		}
	}

}


text:
package com.corkay.knote.activity;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import com.corkay.knote.R;

public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton addNote = (FloatingActionButton) findViewById(R.id.add_note);
        addNote.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.addDrawerListener(toggle);
        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
    }

    @Override
    public void onBackPressed() {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    @SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        // Handle navigation view item clicks here.
        int id = item.getItemId();

        if (id == R.id.all_note) {
            // Handle the camera action
        } else if (id == R.id.recycle_note) {

        } else if (id == R.id.about) {

        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }
}


text:
/**
 * Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.sesame.graph;

import java.util.Objects;

/**
 * ID for a function instance in the engine.
 * <p>
 * Function IDs are used in the engine cache to create the cache key used for storing calculated values. If
 * two functions are identical it is safe to assume they will return the same value when invoked
 * with the same set of arguments. Therefore identical functions are allocated the same function ID so
 * they can use each other's values in the cache.
 */
public final class FunctionId {

  private final int _id;

  private FunctionId(int id) {
    _id = id;
  }

  /**
   * Creates a new ID with the given underlying integer ID.
   *
   * @param id the underlying ID
   * @return a {@code FunctionId} wrapping the specified integer ID
   */
  public static FunctionId of(int id) {
    return new FunctionId(id);
  }

  @Override
  public int hashCode() {
    return _id;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null || getClass() != obj.getClass()) {
      return false;
    }
    final FunctionId other = (FunctionId) obj;
    return Objects.equals(this._id, other._id);
  }

  @Override
  public String toString() {
    return "FunctionId [_id=" + _id + "]";
  }
}


text:
/*
 * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 *
 * http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.secretsmanager.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class StopReplicationToReplicaRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * Response to StopReplicationToReplica of a secret, based on the SecretId.
     *

     */
    private String secretId;

    /**
     *

     * Response to StopReplicationToReplica of a secret, based on the SecretId.
     *

     *
     * @param secretId
     *        Response to StopReplicationToReplica of a secret, based on the SecretId.
     */

    public void setSecretId(String secretId) {
        this.secretId = secretId;
    }

    /**
     *

     * Response to StopReplicationToReplica of a secret, based on the SecretId.
     *

     *
     * @return Response to StopReplicationToReplica of a secret, based on the SecretId.
     */

    public String getSecretId() {
        return this.secretId;
    }

    /**
     *

     * Response to StopReplicationToReplica of a secret, based on the SecretId.
     *

     *
     * @param secretId
     *        Response to StopReplicationToReplica of a secret, based on the SecretId.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StopReplicationToReplicaRequest withSecretId(String secretId) {
        setSecretId(secretId);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getSecretId() != null)
            sb.append("SecretId: ").append(getSecretId());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof StopReplicationToReplicaRequest == false)
            return false;
        StopReplicationToReplicaRequest other = (StopReplicationToReplicaRequest) obj;
        if (other.getSecretId() == null ^ this.getSecretId() == null)
            return false;
        if (other.getSecretId() != null && other.getSecretId().equals(this.getSecretId()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getSecretId() == null) ? 0 : getSecretId().hashCode());
        return hashCode;
    }

    @Override
    public StopReplicationToReplicaRequest clone() {
        return (StopReplicationToReplicaRequest) super.clone();
    }

}


text:
package place.circuit.architecture;

import java.io.Serializable;

public class PortType implements Serializable, Comparable<PortType> {

    private static final long serialVersionUID = 8336333602345751378L;

    private int typeIndex;

    public PortType(BlockType blockType, String portName) {
        this(blockType.getTypeIndex(), portName);
    }
    PortType(int blockTypeIndex, String portName) {
        this.typeIndex = PortTypeData.getInstance().getTypeIndex(blockTypeIndex, portName);
    }

    int getBlockTypeIndex() {
        return PortTypeData.getInstance().getBlockTypeIndex(this.typeIndex);
    }
    int getPortTypeIndex() {
        return this.typeIndex;
    }

    void setSetupTime(double delay) {
        PortTypeData.getInstance().setSetupTime(this.typeIndex, delay);
    }
    public double getSetupTime() {
        return PortTypeData.getInstance().getSetupTime(this.typeIndex);
    }

    void setDelay(PortType sinkType, double delay) {
        PortTypeData.getInstance().setDelay(this.typeIndex, sinkType.typeIndex, delay);
    }
    public double getDelay(PortType sinkType) {
        return PortTypeData.getInstance().getDelay(this.typeIndex, sinkType.typeIndex);
    }

    public String getName() {
        return PortTypeData.getInstance().getName(this.typeIndex);
    }

    public int[] getRange() {
        return PortTypeData.getInstance().getRange(this.typeIndex);
    }

    public boolean isInput() {
        return PortTypeData.getInstance().isInput(this.typeIndex);
    }
    public boolean isOutput() {
        return PortTypeData.getInstance().isOutput(this.typeIndex);
    }
    public boolean isClock() {
        return PortTypeData.getInstance().isClock(this.typeIndex);
    }

    @Override
    public int compareTo(PortType otherPortType) {
        return Integer.compare(this.typeIndex, otherPortType.typeIndex);
    }

    @Override
    public String toString() {
        return String.format("%s.%s", new BlockType(this.getBlockTypeIndex()).toString(), this.getName());
    }
}


text:
package ru.hw.service;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

@DisplayName("Класс Банкомат")
class ATMImlTest {

    public static final int FIVE_THOUSAND = 5000;
    public static final int ONE_THOUSAND = 1000;
    public static final int FINE_HUNDRED = 500;
    public static final int ONE_HUNDRED = 100;
    public static final int ONE_BANKNOTE = 1;
    public static final int TWO_BANKNOTE = 2;
    public static final int THREE_BANKNOTE = 3;
    public static final int FOUR_BANKNOTE = 4;

    @Test
    @DisplayName("должен создать банкомат с купюрами и вернуть запрошенную сумму")
    void shouldAdd6600BanknoteToATM() {
        ATM atm = new ATMIml();

        int exceptedAmount = ONE_BANKNOTE * FIVE_THOUSAND
                + ONE_BANKNOTE * ONE_THOUSAND
                + ONE_BANKNOTE * FINE_HUNDRED
                + ONE_BANKNOTE * ONE_HUNDRED;

        atm.addAmount(exceptedAmount);

        int actualAmount = atm.getAmountMinBanknote(exceptedAmount);

        assertThat(actualAmount).isEqualTo(exceptedAmount);
    }

    @Test
    @DisplayName("должен вернуть исклчение если сумму нельзя выдать")
    void shouldReturnExceptionThenAmountCannotIssued() {
        ATM atm = new ATMIml();

        assertThatThrownBy(() -> atm.getAmountMinBanknote(ONE_HUNDRED)).isInstanceOf(RuntimeException.class);
    }

    @Test
    @DisplayName("должен создать пустой банкомат, принять банкноты разных номиналов и вернуть сумму остатка")
    void shouldReturnBalanceAmount() {
        ATM atm = new ATMIml();
        int exceptedBalanceAmount = ONE_BANKNOTE * FIVE_THOUSAND
                + TWO_BANKNOTE * ONE_THOUSAND
                + THREE_BANKNOTE * FINE_HUNDRED
                + FOUR_BANKNOTE * ONE_HUNDRED;

        atm.addAmount(exceptedBalanceAmount);

        int actualBalanceAmount = atm.getBalance();

        assertThat(actualBalanceAmount).isEqualTo(exceptedBalanceAmount);
    }
}


text:
/*
 * Copyright 2013-2014 must-be.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package consulo.dotnet.run;

import javax.annotation.Nonnull;

import com.intellij.execution.configuration.ConfigurationFactoryEx;
import com.intellij.execution.configurations.ConfigurationTypeBase;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.execution.configurations.RunConfigurationModule;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import consulo.ui.annotation.RequiredUIAccess;
import consulo.dotnet.module.extension.DotNetRunModuleExtension;
import consulo.module.extension.ModuleExtensionHelper;

/**
 * @author VISTALL
 * @since 26.11.13.
 */
public class DotNetConfigurationType extends ConfigurationTypeBase
{
	@Nonnull
	public static DotNetConfigurationType getInstance()
	{
		return EP_NAME.findExtensionOrFail(DotNetConfigurationType.class);
	}

	public DotNetConfigurationType()
	{
		super("#DotNetConfigurationType", ".NET Application", "", AllIcons.RunConfigurations.Application);

		addFactory(new ConfigurationFactoryEx(this)
		{
			@Override
			public RunConfiguration createTemplateConfiguration(Project project)
			{
				return new DotNetConfiguration("Unnamed", new RunConfigurationModule(project), this);
			}

			@Override
			@RequiredUIAccess
			public void onNewConfigurationCreated(@Nonnull RunConfiguration configuration)
			{
				DotNetConfiguration dotNetConfiguration = (DotNetConfiguration) configuration;

				for(Module module : ModuleManager.getInstance(configuration.getProject()).getModules())
				{
					DotNetRunModuleExtension extension = ModuleUtilCore.getExtension(module, DotNetRunModuleExtension.class);
					if(extension != null)
					{
						dotNetConfiguration.setName(module.getName());
						dotNetConfiguration.setModule(module);
						break;
					}
				}
			}

			@Override
			public boolean isApplicable(@Nonnull Project project)
			{
				return ModuleExtensionHelper.getInstance(project).hasModuleExtension(DotNetRunModuleExtension.class);
			}
		});
	}
}


text:
package com.wiser.hw.dms.restful;

import java.util.List;
import java.util.Map;

public class SendMessageBody {

    private String body;

    private Map<String,String> attributes;

    private List<String> tags;

    private Long delayTime;

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public Map<String, String> getAttributes() {
        return attributes;
    }

    public void setAttributes(Map<String, String> attributes) {
        this.attributes = attributes;
    }

    public List<String> getTags() {
        return tags;
    }

    public void setTags(List<String> tags) {
        this.tags = tags;
    }

    public Long getDelayTime() {
        return delayTime;
    }

    public void setDelayTime(Long delayTime) {
        this.delayTime = delayTime;
    }
}


text:
/*
 *  CPAchecker is a tool for configurable software verification.
 *  This file is part of CPAchecker.
 *
 *  Copyright (C) 2007-2014  Dirk Beyer
 *  All rights reserved.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *
 *  CPAchecker web page:
 *    http://cpachecker.sosy-lab.org
 */
/**
 * All implemented configurable program analyses (CPAs).
 */
package org.sosy_lab.cpachecker.cpa;


text:
/*
 *  Copyright (C) 2012-2015 Jason Fang ( ifangyucun@gmail.com )
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package com.hellofyc.base.app.fragment;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;

import com.hellofyc.base.app.AppSupportDelegate;

public class BaseDialogFragment extends DialogFragment implements OnClickListener {

	protected static final int THEME = android.R.style.Theme;
	protected static final int THEME_LIGHT = android.R.style.Theme_Light;
	protected static final int THEME_LIGHT_PANEL = android.R.style.Theme_Light_Panel;
	protected static final int THEME_PANEL = android.R.style.Theme_Panel;
	protected static final int THEME_DIALOG = android.R.style.Theme_Dialog;

    private AppSupportDelegate mDelegate;

    private AppSupportDelegate getAppSupportDelegate() {
        if (mDelegate == null) {
            mDelegate = AppSupportDelegate.create();
        }
        return mDelegate;
    }

    public static DialogFragment newInstance(@NonNull Context context, Class<?> fclass) {
        return (DialogFragment) Fragment.instantiate(context, fclass.getName());
    }

	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
	}

    @Override
    public void onClick(View v) {

    }

    public <D> void startLoader(int id, Bundle args, LoaderManager.LoaderCallbacks<D> callbacks) {
        getLoaderManager().restartLoader(id, args, callbacks);
    }

    @Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

    public View findViewById(int resId) {
        View v = getView();
        if (v == null) return null;
        return v.findViewById(resId);
    }

	public void setViewsClickListener(View... views) {
        getAppSupportDelegate().setViewsOnClickListener(this, views);
	}

	protected int getColor(int resId) {
		return ContextCompat.getColor(getActivity(), resId);
	}

    public int getScreenWidth() {
        return getAppSupportDelegate().getScreenWidth();
    }

    public void setWidth(float ratio) {
        setWidth((int) (getScreenWidth() * ratio));
    }

	protected void setWidth(int width) {
		WindowManager.LayoutParams params = getDialog().getWindow().getAttributes();
		params.width = width;
		getDialog().getWindow().setAttributes(params);
	}

	protected void setHeight(int height) {
		WindowManager.LayoutParams params = getDialog().getWindow().getAttributes();
		params.height = height;
		getDialog().getWindow().setAttributes(params);
	}

}