repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
spring-projects/spring-mobile | spring-mobile-device/src/main/java/org/springframework/mobile/device/LiteDeviceResolver.java | LiteDeviceResolver.resolveWithPlatform | protected Device resolveWithPlatform(DeviceType deviceType, DevicePlatform devicePlatform) {
return LiteDevice.from(deviceType, devicePlatform);
} | java | protected Device resolveWithPlatform(DeviceType deviceType, DevicePlatform devicePlatform) {
return LiteDevice.from(deviceType, devicePlatform);
} | [
"protected",
"Device",
"resolveWithPlatform",
"(",
"DeviceType",
"deviceType",
",",
"DevicePlatform",
"devicePlatform",
")",
"{",
"return",
"LiteDevice",
".",
"from",
"(",
"deviceType",
",",
"devicePlatform",
")",
";",
"}"
] | Wrapper method for allow subclassing platform based resolution | [
"Wrapper",
"method",
"for",
"allow",
"subclassing",
"platform",
"based",
"resolution"
] | a402cbcaf208e24288b957f44c9984bd6e8bf064 | https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/LiteDeviceResolver.java#L158-L160 | train |
spring-projects/spring-mobile | spring-mobile-device/src/main/java/org/springframework/mobile/device/LiteDeviceResolver.java | LiteDeviceResolver.init | protected void init() {
getMobileUserAgentPrefixes().addAll(
Arrays.asList(KNOWN_MOBILE_USER_AGENT_PREFIXES));
getMobileUserAgentKeywords().addAll(
Arrays.asList(KNOWN_MOBILE_USER_AGENT_KEYWORDS));
getTabletUserAgentKeywords().addAll(
Arrays.asList(KNOWN_TABLET_USER_AGENT_KEYWORDS));
} | java | protected void init() {
getMobileUserAgentPrefixes().addAll(
Arrays.asList(KNOWN_MOBILE_USER_AGENT_PREFIXES));
getMobileUserAgentKeywords().addAll(
Arrays.asList(KNOWN_MOBILE_USER_AGENT_KEYWORDS));
getTabletUserAgentKeywords().addAll(
Arrays.asList(KNOWN_TABLET_USER_AGENT_KEYWORDS));
} | [
"protected",
"void",
"init",
"(",
")",
"{",
"getMobileUserAgentPrefixes",
"(",
")",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"KNOWN_MOBILE_USER_AGENT_PREFIXES",
")",
")",
";",
"getMobileUserAgentKeywords",
"(",
")",
".",
"addAll",
"(",
"Arrays",
".",
... | Initialize this device resolver implementation. Registers the known set of device
signature strings. Subclasses may override to register additional strings. | [
"Initialize",
"this",
"device",
"resolver",
"implementation",
".",
"Registers",
"the",
"known",
"set",
"of",
"device",
"signature",
"strings",
".",
"Subclasses",
"may",
"override",
"to",
"register",
"additional",
"strings",
"."
] | a402cbcaf208e24288b957f44c9984bd6e8bf064 | https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/LiteDeviceResolver.java#L199-L206 | train |
spring-projects/spring-mobile | spring-mobile-device/src/main/java/org/springframework/mobile/device/site/SitePreferenceUtils.java | SitePreferenceUtils.getCurrentSitePreference | public static SitePreference getCurrentSitePreference(RequestAttributes attributes) {
return (SitePreference) attributes.getAttribute(CURRENT_SITE_PREFERENCE_ATTRIBUTE,
RequestAttributes.SCOPE_REQUEST);
} | java | public static SitePreference getCurrentSitePreference(RequestAttributes attributes) {
return (SitePreference) attributes.getAttribute(CURRENT_SITE_PREFERENCE_ATTRIBUTE,
RequestAttributes.SCOPE_REQUEST);
} | [
"public",
"static",
"SitePreference",
"getCurrentSitePreference",
"(",
"RequestAttributes",
"attributes",
")",
"{",
"return",
"(",
"SitePreference",
")",
"attributes",
".",
"getAttribute",
"(",
"CURRENT_SITE_PREFERENCE_ATTRIBUTE",
",",
"RequestAttributes",
".",
"SCOPE_REQUE... | Get the current site preference for the user from the request attributes map.
@return the site preference, or null if none has been set | [
"Get",
"the",
"current",
"site",
"preference",
"for",
"the",
"user",
"from",
"the",
"request",
"attributes",
"map",
"."
] | a402cbcaf208e24288b957f44c9984bd6e8bf064 | https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/site/SitePreferenceUtils.java#L43-L46 | train |
spring-projects/spring-mobile | spring-mobile-device/src/main/java/org/springframework/mobile/device/switcher/AbstractSiteUrlFactory.java | AbstractSiteUrlFactory.optionalPort | protected String optionalPort(HttpServletRequest request) {
if ("http".equals(request.getScheme()) && request.getServerPort() != 80 || "https".equals(request.getScheme())
&& request.getServerPort() != 443) {
return ":" + request.getServerPort();
} else {
return null;
}
} | java | protected String optionalPort(HttpServletRequest request) {
if ("http".equals(request.getScheme()) && request.getServerPort() != 80 || "https".equals(request.getScheme())
&& request.getServerPort() != 443) {
return ":" + request.getServerPort();
} else {
return null;
}
} | [
"protected",
"String",
"optionalPort",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"\"http\"",
".",
"equals",
"(",
"request",
".",
"getScheme",
"(",
")",
")",
"&&",
"request",
".",
"getServerPort",
"(",
")",
"!=",
"80",
"||",
"\"https\"",
".... | Returns the HTTP port specified on the given request if it's a non-standard port.
The port is considered non-standard if it's not port 80 for insecure request and not
port 443 of secure requests.
@param request the <code>HttpServletRequest</code> to check for a non-standard port.
@return the HTTP port specified on the ... | [
"Returns",
"the",
"HTTP",
"port",
"specified",
"on",
"the",
"given",
"request",
"if",
"it",
"s",
"a",
"non",
"-",
"standard",
"port",
".",
"The",
"port",
"is",
"considered",
"non",
"-",
"standard",
"if",
"it",
"s",
"not",
"port",
"80",
"for",
"insecure... | a402cbcaf208e24288b957f44c9984bd6e8bf064 | https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/switcher/AbstractSiteUrlFactory.java#L38-L45 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/legacy/queryParams/JsonApiQueryParamsParser.java | JsonApiQueryParamsParser.filterQueryParamsByKey | @Override
protected Map<String, Set<String>> filterQueryParamsByKey(QueryParamsParserContext context, String queryKey) {
Map<String, Set<String>> filteredQueryParams = new HashMap<>();
for (String paramName : context.getParameterNames()) {
if (paramName.startsWith(queryKey)) {
filteredQueryParams.put(param... | java | @Override
protected Map<String, Set<String>> filterQueryParamsByKey(QueryParamsParserContext context, String queryKey) {
Map<String, Set<String>> filteredQueryParams = new HashMap<>();
for (String paramName : context.getParameterNames()) {
if (paramName.startsWith(queryKey)) {
filteredQueryParams.put(param... | [
"@",
"Override",
"protected",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"filterQueryParamsByKey",
"(",
"QueryParamsParserContext",
"context",
",",
"String",
"queryKey",
")",
"{",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"... | Filters provided query params to one starting with provided string key.
This override also splits param values if they are contained in a
comma-delimited list.
@param context
used to inspect the parameters of the current request
@param queryKey
Filtering key
@return Filtered query params | [
"Filters",
"provided",
"query",
"params",
"to",
"one",
"starting",
"with",
"provided",
"string",
"key",
".",
"This",
"override",
"also",
"splits",
"param",
"values",
"if",
"they",
"are",
"contained",
"in",
"a",
"comma",
"-",
"delimited",
"list",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/legacy/queryParams/JsonApiQueryParamsParser.java#L91-L101 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/utils/BeanUtils.java | BeanUtils.getProperty | public static String getProperty(Object bean, String field) {
Object property = PropertyUtils.getProperty(bean, field);
if (property == null) {
return "null";
}
return property.toString();
} | java | public static String getProperty(Object bean, String field) {
Object property = PropertyUtils.getProperty(bean, field);
if (property == null) {
return "null";
}
return property.toString();
} | [
"public",
"static",
"String",
"getProperty",
"(",
"Object",
"bean",
",",
"String",
"field",
")",
"{",
"Object",
"property",
"=",
"PropertyUtils",
".",
"getProperty",
"(",
"bean",
",",
"field",
")",
";",
"if",
"(",
"property",
"==",
"null",
")",
"{",
"ret... | Get bean's property value and maps to String
@see io.katharsis.core.internal.utils.PropertyUtils#getProperty(Object, String)
@param bean bean to be accessed
@param field bean's field
@return bean's property value | [
"Get",
"bean",
"s",
"property",
"value",
"and",
"maps",
"to",
"String"
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/BeanUtils.java#L17-L24 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/queryspec/FilterSpec.java | FilterSpec.addExpression | public FilterSpec addExpression(FilterSpec expr) {
if (expressions == null) {
expressions = new ArrayList<>();
}
expressions.add((FilterSpec) expr);
return this;
} | java | public FilterSpec addExpression(FilterSpec expr) {
if (expressions == null) {
expressions = new ArrayList<>();
}
expressions.add((FilterSpec) expr);
return this;
} | [
"public",
"FilterSpec",
"addExpression",
"(",
"FilterSpec",
"expr",
")",
"{",
"if",
"(",
"expressions",
"==",
"null",
")",
"{",
"expressions",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"expressions",
".",
"add",
"(",
"(",
"FilterSpec",
")",
"exp... | Adds the given expression to the expression list and returns itself.
@param expr expression
@return this | [
"Adds",
"the",
"given",
"expression",
"to",
"the",
"expression",
"list",
"and",
"returns",
"itself",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/queryspec/FilterSpec.java#L86-L92 | train |
katharsis-project/katharsis-framework | katharsis-jpa/src/main/java/io/katharsis/jpa/internal/JpaRepositoryUtils.java | JpaRepositoryUtils.addMergeInclusions | private static void addMergeInclusions(JpaQueryExecutor<?> executor, QuerySpec querySpec) {
ArrayDeque<String> attributePath = new ArrayDeque<>();
Class<?> resourceClass = querySpec.getResourceClass();
addMergeInclusions(attributePath, executor, resourceClass);
} | java | private static void addMergeInclusions(JpaQueryExecutor<?> executor, QuerySpec querySpec) {
ArrayDeque<String> attributePath = new ArrayDeque<>();
Class<?> resourceClass = querySpec.getResourceClass();
addMergeInclusions(attributePath, executor, resourceClass);
} | [
"private",
"static",
"void",
"addMergeInclusions",
"(",
"JpaQueryExecutor",
"<",
"?",
">",
"executor",
",",
"QuerySpec",
"querySpec",
")",
"{",
"ArrayDeque",
"<",
"String",
">",
"attributePath",
"=",
"new",
"ArrayDeque",
"<>",
"(",
")",
";",
"Class",
"<",
"?... | related attribute that are merged into a resource should be loaded by
graph control to avoid lazy-loading or potential lack of session in
serialization. | [
"related",
"attribute",
"that",
"are",
"merged",
"into",
"a",
"resource",
"should",
"be",
"loaded",
"by",
"graph",
"control",
"to",
"avoid",
"lazy",
"-",
"loading",
"or",
"potential",
"lack",
"of",
"session",
"in",
"serialization",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-jpa/src/main/java/io/katharsis/jpa/internal/JpaRepositoryUtils.java#L88-L93 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/legacy/queryParams/QueryParamsBuilder.java | QueryParamsBuilder.buildQueryParams | public QueryParams buildQueryParams(QueryParamsParserContext context) {
try {
return queryParamsParser.parse(context);
} catch (KatharsisException e) {
throw e;
} catch (RuntimeException e) {
throw new ParametersDeserializationException(e.getMessage(), e);
... | java | public QueryParams buildQueryParams(QueryParamsParserContext context) {
try {
return queryParamsParser.parse(context);
} catch (KatharsisException e) {
throw e;
} catch (RuntimeException e) {
throw new ParametersDeserializationException(e.getMessage(), e);
... | [
"public",
"QueryParams",
"buildQueryParams",
"(",
"QueryParamsParserContext",
"context",
")",
"{",
"try",
"{",
"return",
"queryParamsParser",
".",
"parse",
"(",
"context",
")",
";",
"}",
"catch",
"(",
"KatharsisException",
"e",
")",
"{",
"throw",
"e",
";",
"}"... | Parses the query parameters of the current request using this builder's QueryParamsParser and the
given context.
@param context - Contains raw information about the query parameters of the current request
@return - QueryParams object which contains the parsed query parameters of the current request
@throws ParametersDe... | [
"Parses",
"the",
"query",
"parameters",
"of",
"the",
"current",
"request",
"using",
"this",
"builder",
"s",
"QueryParamsParser",
"and",
"the",
"given",
"context",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/legacy/queryParams/QueryParamsBuilder.java#L55-L63 | train |
katharsis-project/katharsis-framework | katharsis-rs/src/main/java/io/katharsis/rs/JsonApiResponseFilter.java | JsonApiResponseFilter.filter | @Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
Object response = responseContext.getEntity();
if (response == null) {
return;
}
// only modify responses which contain a single or a list of Katharsis resources
if (isRes... | java | @Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
Object response = responseContext.getEntity();
if (response == null) {
return;
}
// only modify responses which contain a single or a list of Katharsis resources
if (isRes... | [
"@",
"Override",
"public",
"void",
"filter",
"(",
"ContainerRequestContext",
"requestContext",
",",
"ContainerResponseContext",
"responseContext",
")",
"throws",
"IOException",
"{",
"Object",
"response",
"=",
"responseContext",
".",
"getEntity",
"(",
")",
";",
"if",
... | Creates JSON API responses for custom JAX-RS actions returning Katharsis resources. | [
"Creates",
"JSON",
"API",
"responses",
"for",
"custom",
"JAX",
"-",
"RS",
"actions",
"returning",
"Katharsis",
"resources",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-rs/src/main/java/io/katharsis/rs/JsonApiResponseFilter.java#L37-L70 | train |
katharsis-project/katharsis-framework | katharsis-rs/src/main/java/io/katharsis/rs/JsonApiResponseFilter.java | JsonApiResponseFilter.isResourceResponse | private boolean isResourceResponse(Object response) {
boolean singleResource = response.getClass().getAnnotation(JsonApiResource.class) != null;
boolean resourceList = ResourceListBase.class.isAssignableFrom(response.getClass());
return singleResource || resourceList;
} | java | private boolean isResourceResponse(Object response) {
boolean singleResource = response.getClass().getAnnotation(JsonApiResource.class) != null;
boolean resourceList = ResourceListBase.class.isAssignableFrom(response.getClass());
return singleResource || resourceList;
} | [
"private",
"boolean",
"isResourceResponse",
"(",
"Object",
"response",
")",
"{",
"boolean",
"singleResource",
"=",
"response",
".",
"getClass",
"(",
")",
".",
"getAnnotation",
"(",
"JsonApiResource",
".",
"class",
")",
"!=",
"null",
";",
"boolean",
"resourceList... | Determines whether the given response entity is either a Katharsis
resource or a list of Katharsis resources.
@param response the response entity
@return <code>true</code>, if <code>response</code> is a (list of)
Katharsis resource(s),<br />
<code>false</code>, otherwise | [
"Determines",
"whether",
"the",
"given",
"response",
"entity",
"is",
"either",
"a",
"Katharsis",
"resource",
"or",
"a",
"list",
"of",
"Katharsis",
"resources",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-rs/src/main/java/io/katharsis/rs/JsonApiResponseFilter.java#L81-L85 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/jackson/JsonApiModuleBuilder.java | JsonApiModuleBuilder.build | public SimpleModule build(ResourceRegistry resourceRegistry, boolean isClient) {
SimpleModule simpleModule = new SimpleModule(JSON_API_MODULE_NAME,
new Version(1, 0, 0, null, null, null));
simpleModule.addSerializer(new ErrorDataSerializer());
simpleModule.addDeserializer(ErrorD... | java | public SimpleModule build(ResourceRegistry resourceRegistry, boolean isClient) {
SimpleModule simpleModule = new SimpleModule(JSON_API_MODULE_NAME,
new Version(1, 0, 0, null, null, null));
simpleModule.addSerializer(new ErrorDataSerializer());
simpleModule.addDeserializer(ErrorD... | [
"public",
"SimpleModule",
"build",
"(",
"ResourceRegistry",
"resourceRegistry",
",",
"boolean",
"isClient",
")",
"{",
"SimpleModule",
"simpleModule",
"=",
"new",
"SimpleModule",
"(",
"JSON_API_MODULE_NAME",
",",
"new",
"Version",
"(",
"1",
",",
"0",
",",
"0",
",... | Creates Katharsis Jackson module with all required serializers
@param resourceRegistry initialized registry with all of the required resources
@param isClient is katharsis client
@return {@link com.fasterxml.jackson.databind.Module} with custom serializers | [
"Creates",
"Katharsis",
"Jackson",
"module",
"with",
"all",
"required",
"serializers"
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/jackson/JsonApiModuleBuilder.java#L23-L31 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/resource/IncludeLookupSetter.java | IncludeLookupSetter.lookupRelationshipField | @SuppressWarnings("unchecked")
private Set<Resource> lookupRelationshipField(Collection<Resource> sourceResources, ResourceField relationshipField, QueryAdapter queryAdapter, RepositoryMethodParameterProvider parameterProvider,
Map<ResourceIdentifier, Resource> resourceMap, Map<ResourceIdentifier, Object> entityMap... | java | @SuppressWarnings("unchecked")
private Set<Resource> lookupRelationshipField(Collection<Resource> sourceResources, ResourceField relationshipField, QueryAdapter queryAdapter, RepositoryMethodParameterProvider parameterProvider,
Map<ResourceIdentifier, Resource> resourceMap, Map<ResourceIdentifier, Object> entityMap... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Set",
"<",
"Resource",
">",
"lookupRelationshipField",
"(",
"Collection",
"<",
"Resource",
">",
"sourceResources",
",",
"ResourceField",
"relationshipField",
",",
"QueryAdapter",
"queryAdapter",
",",
"Rep... | Loads all related resources for the given resources and relationship
field. It updates the relationship data of the source resources
accordingly and returns the loaded resources for potential inclusion in
the result document. | [
"Loads",
"all",
"related",
"resources",
"for",
"the",
"given",
"resources",
"and",
"relationship",
"field",
".",
"It",
"updates",
"the",
"relationship",
"data",
"of",
"the",
"source",
"resources",
"accordingly",
"and",
"returns",
"the",
"loaded",
"resources",
"f... | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/resource/IncludeLookupSetter.java#L216-L260 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/legacy/internal/ParametersFactory.java | ParametersFactory.buildParameters | public Object[] buildParameters(Object[] firstParameters, Method method, QueryAdapter queryAdapter,
Class<? extends Annotation> annotationType) {
int parametersLength = method.getParameterTypes().length;
if (firstParameters.length > 0 && parametersLength < 1) {
... | java | public Object[] buildParameters(Object[] firstParameters, Method method, QueryAdapter queryAdapter,
Class<? extends Annotation> annotationType) {
int parametersLength = method.getParameterTypes().length;
if (firstParameters.length > 0 && parametersLength < 1) {
... | [
"public",
"Object",
"[",
"]",
"buildParameters",
"(",
"Object",
"[",
"]",
"firstParameters",
",",
"Method",
"method",
",",
"QueryAdapter",
"queryAdapter",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"int",
"parametersLength"... | Build a list of parameters that can be provided to a method.
@param firstParameters parameters to be returned as the firsts element in the return array
@param method repository method
@param annotationType method annotation
@param queryAdapter Ask remmo
@return array of resolved parameters | [
"Build",
"a",
"list",
"of",
"parameters",
"that",
"can",
"be",
"provided",
"to",
"a",
"method",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/legacy/internal/ParametersFactory.java#L31-L49 | train |
katharsis-project/katharsis-framework | katharsis-client/src/main/java/io/katharsis/client/response/JsonMetaInformation.java | JsonMetaInformation.as | @Override
public <M extends MetaInformation> M as(Class<M> metaClass) {
try {
return mapper.readerFor(metaClass).readValue(data);
}
catch (IOException e) {
throw new IllegalStateException(e);
}
} | java | @Override
public <M extends MetaInformation> M as(Class<M> metaClass) {
try {
return mapper.readerFor(metaClass).readValue(data);
}
catch (IOException e) {
throw new IllegalStateException(e);
}
} | [
"@",
"Override",
"public",
"<",
"M",
"extends",
"MetaInformation",
">",
"M",
"as",
"(",
"Class",
"<",
"M",
">",
"metaClass",
")",
"{",
"try",
"{",
"return",
"mapper",
".",
"readerFor",
"(",
"metaClass",
")",
".",
"readValue",
"(",
"data",
")",
";",
"... | Converts this generic meta information to the provided type.
@param metaClass to return
@return meta information based on the provided type. | [
"Converts",
"this",
"generic",
"meta",
"information",
"to",
"the",
"provided",
"type",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-client/src/main/java/io/katharsis/client/response/JsonMetaInformation.java#L32-L40 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/resource/information/ResourceInformation.java | ResourceInformation.parseIdString | @SuppressWarnings({ "unchecked", "rawtypes" })
public Serializable parseIdString(String id) {
Class idType = getIdField().getType();
return parser.parse(id, idType);
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public Serializable parseIdString(String id) {
Class idType = getIdField().getType();
return parser.parse(id, idType);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"Serializable",
"parseIdString",
"(",
"String",
"id",
")",
"{",
"Class",
"idType",
"=",
"getIdField",
"(",
")",
".",
"getType",
"(",
")",
";",
"return",
"parser",
... | Converts the given id string into its object representation.
@param id
stringified id
@return id | [
"Converts",
"the",
"given",
"id",
"string",
"into",
"its",
"object",
"representation",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/resource/information/ResourceInformation.java#L265-L269 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/dispatcher/RequestDispatcher.java | RequestDispatcher.dispatchRequest | public Response dispatchRequest(JsonPath jsonPath, String method, Map<String, Set<String>> parameters,
RepositoryMethodParameterProvider parameterProvider,
Document requestBody) {
try {
BaseController controller = controllerRegistry.getController(jsonPath, method);
ResourceInformation resourceInformatio... | java | public Response dispatchRequest(JsonPath jsonPath, String method, Map<String, Set<String>> parameters,
RepositoryMethodParameterProvider parameterProvider,
Document requestBody) {
try {
BaseController controller = controllerRegistry.getController(jsonPath, method);
ResourceInformation resourceInformatio... | [
"public",
"Response",
"dispatchRequest",
"(",
"JsonPath",
"jsonPath",
",",
"String",
"method",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"parameters",
",",
"RepositoryMethodParameterProvider",
"parameterProvider",
",",
"Document",
"requestBody"... | Dispatch the request from a client
@param jsonPath built {@link JsonPath} instance which represents the URI sent in the request
@param method type of the request e.g. POST, GET, PATCH
@param parameterProvider repository method parameter provider
@param requestBody deserialized body of the client r... | [
"Dispatch",
"the",
"request",
"from",
"a",
"client"
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/dispatcher/RequestDispatcher.java#L67-L91 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/dispatcher/path/PathBuilder.java | PathBuilder.buildPath | public static String buildPath(JsonPath jsonPath) {
List<String> urlParts = new LinkedList<>();
JsonPath currentJsonPath = jsonPath;
String pathPart;
do {
if (currentJsonPath instanceof RelationshipsPath) {
pathPart = RELATIONSHIP_MARK + SEPARATOR + currentJs... | java | public static String buildPath(JsonPath jsonPath) {
List<String> urlParts = new LinkedList<>();
JsonPath currentJsonPath = jsonPath;
String pathPart;
do {
if (currentJsonPath instanceof RelationshipsPath) {
pathPart = RELATIONSHIP_MARK + SEPARATOR + currentJs... | [
"public",
"static",
"String",
"buildPath",
"(",
"JsonPath",
"jsonPath",
")",
"{",
"List",
"<",
"String",
">",
"urlParts",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"JsonPath",
"currentJsonPath",
"=",
"jsonPath",
";",
"String",
"pathPart",
";",
"do",
"... | Creates a path using the provided JsonPath structure.
@param jsonPath JsonPath structure to be parsed
@return String representing structure provided in the input | [
"Creates",
"a",
"path",
"using",
"the",
"provided",
"JsonPath",
"structure",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/dispatcher/path/PathBuilder.java#L187-L210 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/registry/ResourceRegistryImpl.java | ResourceRegistryImpl.addEntry | public RegistryEntry addEntry(Class<?> resource, RegistryEntry registryEntry) {
resources.put(resource, registryEntry);
registryEntry.initialize(moduleRegistry);
logger.debug("Added resource {} to ResourceRegistry", resource.getName());
return registryEntry;
} | java | public RegistryEntry addEntry(Class<?> resource, RegistryEntry registryEntry) {
resources.put(resource, registryEntry);
registryEntry.initialize(moduleRegistry);
logger.debug("Added resource {} to ResourceRegistry", resource.getName());
return registryEntry;
} | [
"public",
"RegistryEntry",
"addEntry",
"(",
"Class",
"<",
"?",
">",
"resource",
",",
"RegistryEntry",
"registryEntry",
")",
"{",
"resources",
".",
"put",
"(",
"resource",
",",
"registryEntry",
")",
";",
"registryEntry",
".",
"initialize",
"(",
"moduleRegistry",
... | Adds a new resource definition to a registry.
@param resource
class of a resource
@param registryEntry
resource information
@param <T>
type of a resource | [
"Adds",
"a",
"new",
"resource",
"definition",
"to",
"a",
"registry",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/registry/ResourceRegistryImpl.java#L45-L50 | train |
katharsis-project/katharsis-framework | katharsis-examples/spring-boot-simple-example/src/main/java/io/katharsis/example/springboot/simple/ModuleConfig.java | ModuleConfig.braveModule | @Bean
public BraveModule braveModule() {
String serviceName = "exampleApp";
Endpoint localEndpoint = Endpoint.builder().serviceName(serviceName).build();
InheritableServerClientAndLocalSpanState spanState = new InheritableServerClientAndLocalSpanState(localEndpoint);
Brave.Builder builder = new Brave.Builder(s... | java | @Bean
public BraveModule braveModule() {
String serviceName = "exampleApp";
Endpoint localEndpoint = Endpoint.builder().serviceName(serviceName).build();
InheritableServerClientAndLocalSpanState spanState = new InheritableServerClientAndLocalSpanState(localEndpoint);
Brave.Builder builder = new Brave.Builder(s... | [
"@",
"Bean",
"public",
"BraveModule",
"braveModule",
"(",
")",
"{",
"String",
"serviceName",
"=",
"\"exampleApp\"",
";",
"Endpoint",
"localEndpoint",
"=",
"Endpoint",
".",
"builder",
"(",
")",
".",
"serviceName",
"(",
"serviceName",
")",
".",
"build",
"(",
"... | Basic monitoring setup with Brave
@return module | [
"Basic",
"monitoring",
"setup",
"with",
"Brave"
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-examples/spring-boot-simple-example/src/main/java/io/katharsis/example/springboot/simple/ModuleConfig.java#L46-L55 | train |
katharsis-project/katharsis-framework | katharsis-examples/spring-boot-simple-example/src/main/java/io/katharsis/example/springboot/simple/ModuleConfig.java | ModuleConfig.jpaModule | @Bean
public JpaModule jpaModule() {
JpaModule module = JpaModule.newServerModule(em, transactionRunner);
// directly expose entity
module.addRepository(JpaRepositoryConfig.builder(ScheduleEntity.class).build());
// additionally expose entity as a mapped dto
module.addRepository(JpaRepositoryConfig.builder... | java | @Bean
public JpaModule jpaModule() {
JpaModule module = JpaModule.newServerModule(em, transactionRunner);
// directly expose entity
module.addRepository(JpaRepositoryConfig.builder(ScheduleEntity.class).build());
// additionally expose entity as a mapped dto
module.addRepository(JpaRepositoryConfig.builder... | [
"@",
"Bean",
"public",
"JpaModule",
"jpaModule",
"(",
")",
"{",
"JpaModule",
"module",
"=",
"JpaModule",
".",
"newServerModule",
"(",
"em",
",",
"transactionRunner",
")",
";",
"// directly expose entity",
"module",
".",
"addRepository",
"(",
"JpaRepositoryConfig",
... | Expose JPA entities as repositories.
@return module | [
"Expose",
"JPA",
"entities",
"as",
"repositories",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-examples/spring-boot-simple-example/src/main/java/io/katharsis/example/springboot/simple/ModuleConfig.java#L71-L95 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/resource/information/ResourceFieldNameTransformer.java | ResourceFieldNameTransformer.getMethodName | public String getMethodName(Method method) {
String name;
if (ClassUtils.isBooleanGetter(method)) {
name = extractMethodName(method, 2);
} else {
name = extractMethodName(method, 3);
}
return name;
} | java | public String getMethodName(Method method) {
String name;
if (ClassUtils.isBooleanGetter(method)) {
name = extractMethodName(method, 2);
} else {
name = extractMethodName(method, 3);
}
return name;
} | [
"public",
"String",
"getMethodName",
"(",
"Method",
"method",
")",
"{",
"String",
"name",
";",
"if",
"(",
"ClassUtils",
".",
"isBooleanGetter",
"(",
"method",
")",
")",
"{",
"name",
"=",
"extractMethodName",
"(",
"method",
",",
"2",
")",
";",
"}",
"else"... | Extract Java bean name from getter's name
@param method method to extract name
@return extracted method name | [
"Extract",
"Java",
"bean",
"name",
"from",
"getter",
"s",
"name"
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/resource/information/ResourceFieldNameTransformer.java#L97-L105 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java | ClassUtils.findMethodWith | public static Method findMethodWith(Class<?> searchClass, Class<? extends Annotation> annotationClass) {
Method foundMethod = null;
methodFinder: while (searchClass != null && searchClass != Object.class) {
for (Method method : searchClass.getDeclaredMethods()) {
if (method.isAnnotationPresent(annotationClas... | java | public static Method findMethodWith(Class<?> searchClass, Class<? extends Annotation> annotationClass) {
Method foundMethod = null;
methodFinder: while (searchClass != null && searchClass != Object.class) {
for (Method method : searchClass.getDeclaredMethods()) {
if (method.isAnnotationPresent(annotationClas... | [
"public",
"static",
"Method",
"findMethodWith",
"(",
"Class",
"<",
"?",
">",
"searchClass",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"Method",
"foundMethod",
"=",
"null",
";",
"methodFinder",
":",
"while",
"(",
"sear... | Return a first occurrence of a method annotated with specified annotation
@param searchClass class to be searched
@param annotationClass annotation class
@return annotated method or null | [
"Return",
"a",
"first",
"occurrence",
"of",
"a",
"method",
"annotated",
"with",
"specified",
"annotation"
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java#L194-L207 | train |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java | ClassUtils.newInstance | public static <T> T newInstance(Class<T> clazz) {
try {
return clazz.newInstance();
}
catch (InstantiationException | IllegalAccessException e) {
throw new ResourceException(String.format("couldn't create a new instance of %s", clazz));
}
} | java | public static <T> T newInstance(Class<T> clazz) {
try {
return clazz.newInstance();
}
catch (InstantiationException | IllegalAccessException e) {
throw new ResourceException(String.format("couldn't create a new instance of %s", clazz));
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"try",
"{",
"return",
"clazz",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"|",
"IllegalAccessException",
"e",
")",... | Create a new instance of a resource using a default constructor
@param clazz new instance class
@param <T> new instance class
@return new instance | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"resource",
"using",
"a",
"default",
"constructor"
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java#L216-L223 | train |
katharsis-project/katharsis-framework | katharsis-jpa/src/main/java/io/katharsis/jpa/JpaModule.java | JpaModule.newServerModule | public static JpaModule newServerModule(EntityManagerFactory emFactory, EntityManager em, TransactionRunner transactionRunner) {
return new JpaModule(emFactory, em, transactionRunner);
} | java | public static JpaModule newServerModule(EntityManagerFactory emFactory, EntityManager em, TransactionRunner transactionRunner) {
return new JpaModule(emFactory, em, transactionRunner);
} | [
"public",
"static",
"JpaModule",
"newServerModule",
"(",
"EntityManagerFactory",
"emFactory",
",",
"EntityManager",
"em",
",",
"TransactionRunner",
"transactionRunner",
")",
"{",
"return",
"new",
"JpaModule",
"(",
"emFactory",
",",
"em",
",",
"transactionRunner",
")",... | Creates a new JpaModule for a Katharsis server. All entities managed by
the provided EntityManagerFactory are registered to the module and
exposed as JSON API resources if not later configured otherwise.
@param emFactory
to retrieve the managed entities.
@param em
to use
@param transactionRunner
to use
@return created... | [
"Creates",
"a",
"new",
"JpaModule",
"for",
"a",
"Katharsis",
"server",
".",
"All",
"entities",
"managed",
"by",
"the",
"provided",
"EntityManagerFactory",
"are",
"registered",
"to",
"the",
"module",
"and",
"exposed",
"as",
"JSON",
"API",
"resources",
"if",
"no... | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-jpa/src/main/java/io/katharsis/jpa/JpaModule.java#L203-L205 | train |
katharsis-project/katharsis-framework | katharsis-jpa/src/main/java/io/katharsis/jpa/JpaModule.java | JpaModule.addRepository | public <T> void addRepository(JpaRepositoryConfig<T> config) {
checkNotInitialized();
Class<?> resourceClass = config.getResourceClass();
if (repositoryConfigurationMap.containsKey(resourceClass)) {
throw new IllegalArgumentException(resourceClass.getName() + " is already registered");
}
repositoryConfigur... | java | public <T> void addRepository(JpaRepositoryConfig<T> config) {
checkNotInitialized();
Class<?> resourceClass = config.getResourceClass();
if (repositoryConfigurationMap.containsKey(resourceClass)) {
throw new IllegalArgumentException(resourceClass.getName() + " is already registered");
}
repositoryConfigur... | [
"public",
"<",
"T",
">",
"void",
"addRepository",
"(",
"JpaRepositoryConfig",
"<",
"T",
">",
"config",
")",
"{",
"checkNotInitialized",
"(",
")",
";",
"Class",
"<",
"?",
">",
"resourceClass",
"=",
"config",
".",
"getResourceClass",
"(",
")",
";",
"if",
"... | Adds the repository to this module.
@param configuration
to use | [
"Adds",
"the",
"repository",
"to",
"this",
"module",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-jpa/src/main/java/io/katharsis/jpa/JpaModule.java#L255-L262 | train |
katharsis-project/katharsis-framework | katharsis-jpa/src/main/java/io/katharsis/jpa/JpaModule.java | JpaModule.setupRelationshipRepositories | private void setupRelationshipRepositories(Class<?> resourceClass, boolean mapped) {
MetaLookup metaLookup = mapped ? resourceMetaLookup : jpaMetaLookup;
Class<? extends MetaDataObject> metaClass = mapped ? MetaJsonObject.class : MetaJpaDataObject.class;
MetaDataObject meta = metaLookup.getMeta(resourceClass, me... | java | private void setupRelationshipRepositories(Class<?> resourceClass, boolean mapped) {
MetaLookup metaLookup = mapped ? resourceMetaLookup : jpaMetaLookup;
Class<? extends MetaDataObject> metaClass = mapped ? MetaJsonObject.class : MetaJpaDataObject.class;
MetaDataObject meta = metaLookup.getMeta(resourceClass, me... | [
"private",
"void",
"setupRelationshipRepositories",
"(",
"Class",
"<",
"?",
">",
"resourceClass",
",",
"boolean",
"mapped",
")",
"{",
"MetaLookup",
"metaLookup",
"=",
"mapped",
"?",
"resourceMetaLookup",
":",
"jpaMetaLookup",
";",
"Class",
"<",
"?",
"extends",
"... | Sets up relationship repositories for the given resource class. In case
of a mapper the resource class might not correspond to the entity class. | [
"Sets",
"up",
"relationship",
"repositories",
"for",
"the",
"given",
"resource",
"class",
".",
"In",
"case",
"of",
"a",
"mapper",
"the",
"resource",
"class",
"might",
"not",
"correspond",
"to",
"the",
"entity",
"class",
"."
] | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-jpa/src/main/java/io/katharsis/jpa/JpaModule.java#L416-L453 | train |
katharsis-project/katharsis-framework | katharsis-examples/dropwizard-mongo-example/src/main/java/io/katharsis/example/dropwizard/domain/repository/TaskToProjectRepository.java | TaskToProjectRepository.addRelations | @Override
public void addRelations(Task task, Iterable<ObjectId> projectIds, String fieldName) {
List<Project> newProjectList = new LinkedList<>();
Iterable<Project> projectsToAdd = projectRepository.findAll(projectIds, null);
for (Project project: projectsToAdd) {
newProjectList... | java | @Override
public void addRelations(Task task, Iterable<ObjectId> projectIds, String fieldName) {
List<Project> newProjectList = new LinkedList<>();
Iterable<Project> projectsToAdd = projectRepository.findAll(projectIds, null);
for (Project project: projectsToAdd) {
newProjectList... | [
"@",
"Override",
"public",
"void",
"addRelations",
"(",
"Task",
"task",
",",
"Iterable",
"<",
"ObjectId",
">",
"projectIds",
",",
"String",
"fieldName",
")",
"{",
"List",
"<",
"Project",
">",
"newProjectList",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",... | A simple implementation of the addRelations method which presents the general concept of the method.
It SHOULD NOT be used in production because of possible race condition - production ready code should perform an
atomic operation.
@param task
@param projectIds
@param fieldName | [
"A",
"simple",
"implementation",
"of",
"the",
"addRelations",
"method",
"which",
"presents",
"the",
"general",
"concept",
"of",
"the",
"method",
".",
"It",
"SHOULD",
"NOT",
"be",
"used",
"in",
"production",
"because",
"of",
"possible",
"race",
"condition",
"-"... | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-examples/dropwizard-mongo-example/src/main/java/io/katharsis/example/dropwizard/domain/repository/TaskToProjectRepository.java#L59-L82 | train |
katharsis-project/katharsis-framework | katharsis-examples/dropwizard-mongo-example/src/main/java/io/katharsis/example/dropwizard/domain/repository/TaskToProjectRepository.java | TaskToProjectRepository.removeRelations | @Override
public void removeRelations(Task task, Iterable<ObjectId> projectIds, String fieldName) {
try {
if (PropertyUtils.getProperty(task, fieldName) != null) {
Iterable<Project> projects = (Iterable<Project>) PropertyUtils.getProperty(task, fieldName);
Iterato... | java | @Override
public void removeRelations(Task task, Iterable<ObjectId> projectIds, String fieldName) {
try {
if (PropertyUtils.getProperty(task, fieldName) != null) {
Iterable<Project> projects = (Iterable<Project>) PropertyUtils.getProperty(task, fieldName);
Iterato... | [
"@",
"Override",
"public",
"void",
"removeRelations",
"(",
"Task",
"task",
",",
"Iterable",
"<",
"ObjectId",
">",
"projectIds",
",",
"String",
"fieldName",
")",
"{",
"try",
"{",
"if",
"(",
"PropertyUtils",
".",
"getProperty",
"(",
"task",
",",
"fieldName",
... | A simple implementation of the removeRelations method which presents the general concept of the method.
It SHOULD NOT be used in production because of possible race condition - production ready code should perform an
atomic operation.
@param task
@param projectIds
@param fieldName | [
"A",
"simple",
"implementation",
"of",
"the",
"removeRelations",
"method",
"which",
"presents",
"the",
"general",
"concept",
"of",
"the",
"method",
".",
"It",
"SHOULD",
"NOT",
"be",
"used",
"in",
"production",
"because",
"of",
"possible",
"race",
"condition",
... | 73d1a8763c49c5cf4643d43e2dbfedb647630c46 | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-examples/dropwizard-mongo-example/src/main/java/io/katharsis/example/dropwizard/domain/repository/TaskToProjectRepository.java#L93-L119 | train |
SeleniumHQ/fluent-selenium | java/src/main/java/org/seleniumhq/selenium/fluent/FluentBy.java | FluentBy.attribute | public static ByAttribute attribute(final String name, final String value) {
if (name == null)
throw new IllegalArgumentException(
"Cannot find elements when the attribute name is null");
return new ByAttribute(name, value);
} | java | public static ByAttribute attribute(final String name, final String value) {
if (name == null)
throw new IllegalArgumentException(
"Cannot find elements when the attribute name is null");
return new ByAttribute(name, value);
} | [
"public",
"static",
"ByAttribute",
"attribute",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot find elements when the attribute name is null\""... | Finds elements by an named attribute matching a given value,
irrespective of element name. Currently implemented via XPath. | [
"Finds",
"elements",
"by",
"an",
"named",
"attribute",
"matching",
"a",
"given",
"value",
"irrespective",
"of",
"element",
"name",
".",
"Currently",
"implemented",
"via",
"XPath",
"."
] | fcb171471a7d1abb2800bcbca21b3ae3e6c12472 | https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentBy.java#L89-L95 | train |
SeleniumHQ/fluent-selenium | java/src/main/java/org/seleniumhq/selenium/fluent/FluentBy.java | FluentBy.composite | public static ByComposite composite(By.ByTagName b0, By.ByClassName b1) {
return new ByComposite(b0, b1);
} | java | public static ByComposite composite(By.ByTagName b0, By.ByClassName b1) {
return new ByComposite(b0, b1);
} | [
"public",
"static",
"ByComposite",
"composite",
"(",
"By",
".",
"ByTagName",
"b0",
",",
"By",
".",
"ByClassName",
"b1",
")",
"{",
"return",
"new",
"ByComposite",
"(",
"b0",
",",
"b1",
")",
";",
"}"
] | Finds elements a composite of other By strategies | [
"Finds",
"elements",
"a",
"composite",
"of",
"other",
"By",
"strategies"
] | fcb171471a7d1abb2800bcbca21b3ae3e6c12472 | https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentBy.java#L112-L114 | train |
SeleniumHQ/fluent-selenium | java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java | FluentSelect.deselectByIndex | public FluentSelect deselectByIndex(final int index) {
executeAndWrapReThrowIfNeeded(new DeselectByIndex(index), Context.singular(context, "deselectByIndex", null, index), true);
return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException);... | java | public FluentSelect deselectByIndex(final int index) {
executeAndWrapReThrowIfNeeded(new DeselectByIndex(index), Context.singular(context, "deselectByIndex", null, index), true);
return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException);... | [
"public",
"FluentSelect",
"deselectByIndex",
"(",
"final",
"int",
"index",
")",
"{",
"executeAndWrapReThrowIfNeeded",
"(",
"new",
"DeselectByIndex",
"(",
"index",
")",
",",
"Context",
".",
"singular",
"(",
"context",
",",
"\"deselectByIndex\"",
",",
"null",
",",
... | Deselect the option at the given index. This is done by examining the "index" attribute of an
element, and not merely by counting.
@param index The option at this index will be deselected | [
"Deselect",
"the",
"option",
"at",
"the",
"given",
"index",
".",
"This",
"is",
"done",
"by",
"examining",
"the",
"index",
"attribute",
"of",
"an",
"element",
"and",
"not",
"merely",
"by",
"counting",
"."
] | fcb171471a7d1abb2800bcbca21b3ae3e6c12472 | https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java#L152-L155 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/methods/MethodIdentifier.java | MethodIdentifier.of | public static MethodIdentifier of(final String containingClass, final String methodName, final String signature, final boolean staticMethod) {
final String returnType = JavaUtils.getReturnType(signature);
final List<String> parameters = JavaUtils.getParameters(signature);
return new MethodIdenti... | java | public static MethodIdentifier of(final String containingClass, final String methodName, final String signature, final boolean staticMethod) {
final String returnType = JavaUtils.getReturnType(signature);
final List<String> parameters = JavaUtils.getParameters(signature);
return new MethodIdenti... | [
"public",
"static",
"MethodIdentifier",
"of",
"(",
"final",
"String",
"containingClass",
",",
"final",
"String",
"methodName",
",",
"final",
"String",
"signature",
",",
"final",
"boolean",
"staticMethod",
")",
"{",
"final",
"String",
"returnType",
"=",
"JavaUtils"... | Creates an identifier of the given parameters.
@param containingClass The class name
@param methodName The method name
@param signature The method signature
@param staticMethod If the method is static
@return The method identifier | [
"Creates",
"an",
"identifier",
"of",
"the",
"given",
"parameters",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/methods/MethodIdentifier.java#L145-L149 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/methods/MethodIdentifier.java | MethodIdentifier.ofNonStatic | public static MethodIdentifier ofNonStatic(final String containingClass, final String methodName, final String returnType, final String... parameterTypes) {
return of(containingClass, methodName, returnType, false, parameterTypes);
} | java | public static MethodIdentifier ofNonStatic(final String containingClass, final String methodName, final String returnType, final String... parameterTypes) {
return of(containingClass, methodName, returnType, false, parameterTypes);
} | [
"public",
"static",
"MethodIdentifier",
"ofNonStatic",
"(",
"final",
"String",
"containingClass",
",",
"final",
"String",
"methodName",
",",
"final",
"String",
"returnType",
",",
"final",
"String",
"...",
"parameterTypes",
")",
"{",
"return",
"of",
"(",
"containin... | Creates an identifier of a non-static method.
@param containingClass The class name
@param methodName The method name
@param returnType The return type
@param parameterTypes The parameter types
@return The method identifier | [
"Creates",
"an",
"identifier",
"of",
"a",
"non",
"-",
"static",
"method",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/methods/MethodIdentifier.java#L160-L162 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/methods/MethodIdentifier.java | MethodIdentifier.ofStatic | public static MethodIdentifier ofStatic(final String containingClass, final String methodName, final String returnType, final String... parameterTypes) {
return of(containingClass, methodName, returnType, true, parameterTypes);
} | java | public static MethodIdentifier ofStatic(final String containingClass, final String methodName, final String returnType, final String... parameterTypes) {
return of(containingClass, methodName, returnType, true, parameterTypes);
} | [
"public",
"static",
"MethodIdentifier",
"ofStatic",
"(",
"final",
"String",
"containingClass",
",",
"final",
"String",
"methodName",
",",
"final",
"String",
"returnType",
",",
"final",
"String",
"...",
"parameterTypes",
")",
"{",
"return",
"of",
"(",
"containingCl... | Creates an identifier of a static method.
@param containingClass The class name
@param methodName The method name
@param returnType The return type
@param parameterTypes The parameter types
@return The method identifier | [
"Creates",
"an",
"identifier",
"of",
"a",
"static",
"method",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/methods/MethodIdentifier.java#L173-L175 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java | JavaUtils.isAssignableTo | public static boolean isAssignableTo(final String leftType, final String rightType) {
if (leftType.equals(rightType))
return true;
final boolean firstTypeArray = leftType.charAt(0) == '[';
if (firstTypeArray ^ rightType.charAt(0) == '[') {
return false;
}
... | java | public static boolean isAssignableTo(final String leftType, final String rightType) {
if (leftType.equals(rightType))
return true;
final boolean firstTypeArray = leftType.charAt(0) == '[';
if (firstTypeArray ^ rightType.charAt(0) == '[') {
return false;
}
... | [
"public",
"static",
"boolean",
"isAssignableTo",
"(",
"final",
"String",
"leftType",
",",
"final",
"String",
"rightType",
")",
"{",
"if",
"(",
"leftType",
".",
"equals",
"(",
"rightType",
")",
")",
"return",
"true",
";",
"final",
"boolean",
"firstTypeArray",
... | Checks if the left type is assignable to the right type, i.e. the right type is of the same or a sub-type. | [
"Checks",
"if",
"the",
"left",
"type",
"is",
"assignable",
"to",
"the",
"right",
"type",
"i",
".",
"e",
".",
"the",
"right",
"type",
"is",
"of",
"the",
"same",
"or",
"a",
"sub",
"-",
"type",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java#L201-L217 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java | JavaUtils.getTypeParameters | public static List<String> getTypeParameters(final String type) {
if (type.charAt(0) != 'L')
return emptyList();
int lastStart = type.indexOf('<') + 1;
final List<String> parameters = new ArrayList<>();
if (lastStart > 0) {
int depth = 0;
for (int i ... | java | public static List<String> getTypeParameters(final String type) {
if (type.charAt(0) != 'L')
return emptyList();
int lastStart = type.indexOf('<') + 1;
final List<String> parameters = new ArrayList<>();
if (lastStart > 0) {
int depth = 0;
for (int i ... | [
"public",
"static",
"List",
"<",
"String",
">",
"getTypeParameters",
"(",
"final",
"String",
"type",
")",
"{",
"if",
"(",
"type",
".",
"charAt",
"(",
"0",
")",
"!=",
"'",
"'",
")",
"return",
"emptyList",
"(",
")",
";",
"int",
"lastStart",
"=",
"type"... | Returns the type parameters of the given type. Will be an empty list if the type is not parametrized. | [
"Returns",
"the",
"type",
"parameters",
"of",
"the",
"given",
"type",
".",
"Will",
"be",
"an",
"empty",
"list",
"if",
"the",
"type",
"is",
"not",
"parametrized",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java#L297-L319 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java | JavaUtils.getParameters | public static List<String> getParameters(final String methodDesc) {
// final String[] types = resolveMethodSignature(methodDesc);
// return IntStream.range(0, types.length).mapToObj(i -> types[i]).collect(Collectors.toList());
if (methodDesc == null)
return emptyList();
final ... | java | public static List<String> getParameters(final String methodDesc) {
// final String[] types = resolveMethodSignature(methodDesc);
// return IntStream.range(0, types.length).mapToObj(i -> types[i]).collect(Collectors.toList());
if (methodDesc == null)
return emptyList();
final ... | [
"public",
"static",
"List",
"<",
"String",
">",
"getParameters",
"(",
"final",
"String",
"methodDesc",
")",
"{",
"// final String[] types = resolveMethodSignature(methodDesc);",
"// return IntStream.range(0, types.length).mapToObj(i -> types[i]).collect(Collectors.toList())... | Returns the parameter types of the given method signature. Parametrized types are supported. | [
"Returns",
"the",
"parameter",
"types",
"of",
"the",
"given",
"method",
"signature",
".",
"Parametrized",
"types",
"are",
"supported",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java#L470-L497 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/LogProvider.java | LogProvider.debug | public static void debug(final Throwable throwable) {
final StringWriter errors = new StringWriter();
throwable.printStackTrace(new PrintWriter(errors));
debugLogger.accept(errors.toString());
} | java | public static void debug(final Throwable throwable) {
final StringWriter errors = new StringWriter();
throwable.printStackTrace(new PrintWriter(errors));
debugLogger.accept(errors.toString());
} | [
"public",
"static",
"void",
"debug",
"(",
"final",
"Throwable",
"throwable",
")",
"{",
"final",
"StringWriter",
"errors",
"=",
"new",
"StringWriter",
"(",
")",
";",
"throwable",
".",
"printStackTrace",
"(",
"new",
"PrintWriter",
"(",
"errors",
")",
")",
";",... | Logs the stacktrace of the throwable to the debug logger.
@param throwable The throwable to log | [
"Logs",
"the",
"stacktrace",
"of",
"the",
"throwable",
"to",
"the",
"debug",
"logger",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/LogProvider.java#L90-L94 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/JAXRSAnalyzer.java | JAXRSAnalyzer.analyze | public void analyze() {
final Resources resources = new ProjectAnalyzer(analysis.classPaths)
.analyze(analysis.projectClassPaths, analysis.projectSourcePaths, analysis.ignoredResources);
if (resources.isEmpty()) {
LogProvider.info("Empty JAX-RS analysis result, omitting outp... | java | public void analyze() {
final Resources resources = new ProjectAnalyzer(analysis.classPaths)
.analyze(analysis.projectClassPaths, analysis.projectSourcePaths, analysis.ignoredResources);
if (resources.isEmpty()) {
LogProvider.info("Empty JAX-RS analysis result, omitting outp... | [
"public",
"void",
"analyze",
"(",
")",
"{",
"final",
"Resources",
"resources",
"=",
"new",
"ProjectAnalyzer",
"(",
"analysis",
".",
"classPaths",
")",
".",
"analyze",
"(",
"analysis",
".",
"projectClassPaths",
",",
"analysis",
".",
"projectSourcePaths",
",",
"... | Analyzes the JAX-RS project at the class path and produces the output as configured. | [
"Analyzes",
"the",
"JAX",
"-",
"RS",
"project",
"at",
"the",
"class",
"path",
"and",
"produces",
"the",
"output",
"as",
"configured",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/JAXRSAnalyzer.java#L45-L62 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/TypeRepresentation.java | TypeRepresentation.ofEnum | public static TypeRepresentation ofEnum(final TypeIdentifier identifier, final String... enumValues) {
return new EnumTypeRepresentation(identifier, new HashSet<>(Arrays.asList(enumValues)));
} | java | public static TypeRepresentation ofEnum(final TypeIdentifier identifier, final String... enumValues) {
return new EnumTypeRepresentation(identifier, new HashSet<>(Arrays.asList(enumValues)));
} | [
"public",
"static",
"TypeRepresentation",
"ofEnum",
"(",
"final",
"TypeIdentifier",
"identifier",
",",
"final",
"String",
"...",
"enumValues",
")",
"{",
"return",
"new",
"EnumTypeRepresentation",
"(",
"identifier",
",",
"new",
"HashSet",
"<>",
"(",
"Arrays",
".",
... | Creates a type representation of an enum type plus the available enumeration values.
@param identifier The type identifier
@param enumValues The enum values
@return The type representation | [
"Creates",
"a",
"type",
"representation",
"of",
"an",
"enum",
"type",
"plus",
"the",
"available",
"enumeration",
"values",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/TypeRepresentation.java#L106-L108 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/utils/Pair.java | Pair.of | public static <V, W> Pair<V, W> of(final V left, final W right) {
return new Pair<>(left, right);
} | java | public static <V, W> Pair<V, W> of(final V left, final W right) {
return new Pair<>(left, right);
} | [
"public",
"static",
"<",
"V",
",",
"W",
">",
"Pair",
"<",
"V",
",",
"W",
">",
"of",
"(",
"final",
"V",
"left",
",",
"final",
"W",
"right",
")",
"{",
"return",
"new",
"Pair",
"<>",
"(",
"left",
",",
"right",
")",
";",
"}"
] | Creates a new pair with left and right value.
@param left The left value (can be {@code null})
@param right The right value (can be {@code null})
@param <V> The type of the left value
@param <W> The type of the right value
@return The constructed pair | [
"Creates",
"a",
"new",
"pair",
"with",
"left",
"and",
"right",
"value",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/utils/Pair.java#L79-L81 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodPool.java | MethodPool.addProjectMethod | public void addProjectMethod(final ProjectMethod method) {
readWriteLock.writeLock().lock();
try {
availableMethods.add(method);
} finally {
readWriteLock.writeLock().unlock();
}
} | java | public void addProjectMethod(final ProjectMethod method) {
readWriteLock.writeLock().lock();
try {
availableMethods.add(method);
} finally {
readWriteLock.writeLock().unlock();
}
} | [
"public",
"void",
"addProjectMethod",
"(",
"final",
"ProjectMethod",
"method",
")",
"{",
"readWriteLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"availableMethods",
".",
"add",
"(",
"method",
")",
";",
"}",
"finally",
"{",
"r... | Adds a project method to the pool.
@param method The method to add | [
"Adds",
"a",
"project",
"method",
"to",
"the",
"pool",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodPool.java#L70-L77 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodPool.java | MethodPool.get | public Method get(final MethodIdentifier identifier) {
// search for available methods
readWriteLock.readLock().lock();
try {
final Optional<? extends IdentifiableMethod> method = availableMethods.stream().filter(m -> m.matches(identifier)).findAny();
if (method.isPresent... | java | public Method get(final MethodIdentifier identifier) {
// search for available methods
readWriteLock.readLock().lock();
try {
final Optional<? extends IdentifiableMethod> method = availableMethods.stream().filter(m -> m.matches(identifier)).findAny();
if (method.isPresent... | [
"public",
"Method",
"get",
"(",
"final",
"MethodIdentifier",
"identifier",
")",
"{",
"// search for available methods",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"final",
"Optional",
"<",
"?",
"extends",
"IdentifiableMet... | Returns a method identified by an method identifier.
@param identifier The method identifier
@return The found method or a default handler | [
"Returns",
"a",
"method",
"identified",
"by",
"an",
"method",
"identifier",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodPool.java#L85-L98 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/InstructionFinder.java | InstructionFinder.findLoadIndexes | static Set<Integer> findLoadIndexes(final List<Instruction> instructions, final Predicate<LoadInstruction> isLoadIgnored) {
return instructions.stream().filter(i -> i.getType() == Instruction.InstructionType.LOAD).map(i -> (LoadInstruction) i)
.filter(i -> !isLoadIgnored.test(i)).map(LoadInstruc... | java | static Set<Integer> findLoadIndexes(final List<Instruction> instructions, final Predicate<LoadInstruction> isLoadIgnored) {
return instructions.stream().filter(i -> i.getType() == Instruction.InstructionType.LOAD).map(i -> (LoadInstruction) i)
.filter(i -> !isLoadIgnored.test(i)).map(LoadInstruc... | [
"static",
"Set",
"<",
"Integer",
">",
"findLoadIndexes",
"(",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
",",
"final",
"Predicate",
"<",
"LoadInstruction",
">",
"isLoadIgnored",
")",
"{",
"return",
"instructions",
".",
"stream",
"(",
")",
".",
... | Searches for all LOAD indexes which occur in the given instructions.
The LOAD instruction is checked against the given predicate if it should be ignored.
@param instructions The instructions where to search
@param isLoadIgnored The ignore predicate
@return All found LOAD indexes | [
"Searches",
"for",
"all",
"LOAD",
"indexes",
"which",
"occur",
"in",
"the",
"given",
"instructions",
".",
"The",
"LOAD",
"instruction",
"is",
"checked",
"against",
"the",
"given",
"predicate",
"if",
"it",
"should",
"be",
"ignored",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/InstructionFinder.java#L48-L51 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/InstructionFinder.java | InstructionFinder.findReturnsAndThrows | static Set<Integer> findReturnsAndThrows(final List<Instruction> instructions) {
return find(instruction -> instruction.getType() == Instruction.InstructionType.RETURN || instruction.getType() == Instruction.InstructionType.THROW, instructions);
} | java | static Set<Integer> findReturnsAndThrows(final List<Instruction> instructions) {
return find(instruction -> instruction.getType() == Instruction.InstructionType.RETURN || instruction.getType() == Instruction.InstructionType.THROW, instructions);
} | [
"static",
"Set",
"<",
"Integer",
">",
"findReturnsAndThrows",
"(",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
")",
"{",
"return",
"find",
"(",
"instruction",
"->",
"instruction",
".",
"getType",
"(",
")",
"==",
"Instruction",
".",
"InstructionTy... | Searches for return instructions in the given instructions.
@param instructions The instructions where to search
@return The positions of all found return instructions | [
"Searches",
"for",
"return",
"instructions",
"in",
"the",
"given",
"instructions",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/InstructionFinder.java#L72-L74 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/InstructionFinder.java | InstructionFinder.find | private static Set<Integer> find(final Predicate<Instruction> predicate, final List<Instruction> instructions) {
final Set<Integer> positions = new HashSet<>();
for (int i = 0; i < instructions.size(); i++) {
final Instruction instruction = instructions.get(i);
if (predicate.tes... | java | private static Set<Integer> find(final Predicate<Instruction> predicate, final List<Instruction> instructions) {
final Set<Integer> positions = new HashSet<>();
for (int i = 0; i < instructions.size(); i++) {
final Instruction instruction = instructions.get(i);
if (predicate.tes... | [
"private",
"static",
"Set",
"<",
"Integer",
">",
"find",
"(",
"final",
"Predicate",
"<",
"Instruction",
">",
"predicate",
",",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
")",
"{",
"final",
"Set",
"<",
"Integer",
">",
"positions",
"=",
"new",... | Searches for certain instruction positions be testing against the predicate.
@param predicate The criteria predicate
@param instructions The instructions where to search
@return The positions of all matching instructions | [
"Searches",
"for",
"certain",
"instruction",
"positions",
"be",
"testing",
"against",
"the",
"predicate",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/InstructionFinder.java#L83-L94 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.simulate | public Element simulate(final List<Instruction> instructions) {
lock.lock();
try {
returnElement = null;
return simulateInternal(instructions);
} finally {
lock.unlock();
}
} | java | public Element simulate(final List<Instruction> instructions) {
lock.lock();
try {
returnElement = null;
return simulateInternal(instructions);
} finally {
lock.unlock();
}
} | [
"public",
"Element",
"simulate",
"(",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"returnElement",
"=",
"null",
";",
"return",
"simulateInternal",
"(",
"instructions",
")",
";",
"}",
... | Simulates the instructions and collects information about the resource method.
@param instructions The instructions of the method
@return The return element merged with all possible values | [
"Simulates",
"the",
"instructions",
"and",
"collects",
"information",
"about",
"the",
"resource",
"method",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L61-L69 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.simulate | private void simulate(final Instruction instruction) {
switch (instruction.getType()) {
case PUSH:
final PushInstruction pushInstruction = (PushInstruction) instruction;
runtimeStack.push(new Element(pushInstruction.getValueType(), pushInstruction.getValue()));
... | java | private void simulate(final Instruction instruction) {
switch (instruction.getType()) {
case PUSH:
final PushInstruction pushInstruction = (PushInstruction) instruction;
runtimeStack.push(new Element(pushInstruction.getValueType(), pushInstruction.getValue()));
... | [
"private",
"void",
"simulate",
"(",
"final",
"Instruction",
"instruction",
")",
"{",
"switch",
"(",
"instruction",
".",
"getType",
"(",
")",
")",
"{",
"case",
"PUSH",
":",
"final",
"PushInstruction",
"pushInstruction",
"=",
"(",
"PushInstruction",
")",
"instru... | Simulates the instruction.
@param instruction The instruction to simulate | [
"Simulates",
"the",
"instruction",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L88-L149 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.simulateMethodHandle | private void simulateMethodHandle(final InvokeDynamicInstruction instruction) {
final List<Element> arguments = IntStream.range(0, instruction.getDynamicIdentifier().getParameters().size())
.mapToObj(t -> runtimeStack.pop()).collect(Collectors.toList());
Collections.reverse(arguments);
... | java | private void simulateMethodHandle(final InvokeDynamicInstruction instruction) {
final List<Element> arguments = IntStream.range(0, instruction.getDynamicIdentifier().getParameters().size())
.mapToObj(t -> runtimeStack.pop()).collect(Collectors.toList());
Collections.reverse(arguments);
... | [
"private",
"void",
"simulateMethodHandle",
"(",
"final",
"InvokeDynamicInstruction",
"instruction",
")",
"{",
"final",
"List",
"<",
"Element",
">",
"arguments",
"=",
"IntStream",
".",
"range",
"(",
"0",
",",
"instruction",
".",
"getDynamicIdentifier",
"(",
")",
... | Simulates the invoke dynamic call. Pushes a method handle on the stack.
@param instruction The instruction to simulate | [
"Simulates",
"the",
"invoke",
"dynamic",
"call",
".",
"Pushes",
"a",
"method",
"handle",
"on",
"the",
"stack",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L156-L167 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.simulateInvoke | private void simulateInvoke(final InvokeInstruction instruction) {
final List<Element> arguments = new LinkedList<>();
MethodIdentifier identifier = instruction.getIdentifier();
IntStream.range(0, identifier.getParameters().size()).forEach(i -> arguments.add(runtimeStack.pop()));
Collec... | java | private void simulateInvoke(final InvokeInstruction instruction) {
final List<Element> arguments = new LinkedList<>();
MethodIdentifier identifier = instruction.getIdentifier();
IntStream.range(0, identifier.getParameters().size()).forEach(i -> arguments.add(runtimeStack.pop()));
Collec... | [
"private",
"void",
"simulateInvoke",
"(",
"final",
"InvokeInstruction",
"instruction",
")",
"{",
"final",
"List",
"<",
"Element",
">",
"arguments",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"MethodIdentifier",
"identifier",
"=",
"instruction",
".",
"getIden... | Simulates the invoke instruction.
@param instruction The instruction to simulate | [
"Simulates",
"the",
"invoke",
"instruction",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L174-L198 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.simulateStore | private void simulateStore(final StoreInstruction instruction) {
final int index = instruction.getNumber();
final Element elementToStore = runtimeStack.pop();
if (elementToStore instanceof MethodHandle)
mergeMethodHandleStore(index, (MethodHandle) elementToStore);
else
... | java | private void simulateStore(final StoreInstruction instruction) {
final int index = instruction.getNumber();
final Element elementToStore = runtimeStack.pop();
if (elementToStore instanceof MethodHandle)
mergeMethodHandleStore(index, (MethodHandle) elementToStore);
else
... | [
"private",
"void",
"simulateStore",
"(",
"final",
"StoreInstruction",
"instruction",
")",
"{",
"final",
"int",
"index",
"=",
"instruction",
".",
"getNumber",
"(",
")",
";",
"final",
"Element",
"elementToStore",
"=",
"runtimeStack",
".",
"pop",
"(",
")",
";",
... | Simulates the store instruction.
@param instruction The instruction to simulate | [
"Simulates",
"the",
"store",
"instruction",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L205-L213 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.mergeElementStore | private void mergeElementStore(final int index, final String type, final Element element) {
// new element must be created for immutability
final String elementType = type.equals(Types.OBJECT) ? determineLeastSpecificType(element.getTypes().toArray(new String[element.getTypes().size()])) : type;
... | java | private void mergeElementStore(final int index, final String type, final Element element) {
// new element must be created for immutability
final String elementType = type.equals(Types.OBJECT) ? determineLeastSpecificType(element.getTypes().toArray(new String[element.getTypes().size()])) : type;
... | [
"private",
"void",
"mergeElementStore",
"(",
"final",
"int",
"index",
",",
"final",
"String",
"type",
",",
"final",
"Element",
"element",
")",
"{",
"// new element must be created for immutability",
"final",
"String",
"elementType",
"=",
"type",
".",
"equals",
"(",
... | Merges a stored element to the local variables.
@param index The index of the variable
@param type The type of the variable or the element (whatever is more specific)
@param element The element to merge | [
"Merges",
"a",
"stored",
"element",
"to",
"the",
"local",
"variables",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L222-L228 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.mergeMethodHandleStore | private void mergeMethodHandleStore(final int index, final MethodHandle methodHandle) {
localVariables.merge(index, new MethodHandle(methodHandle), Element::merge);
} | java | private void mergeMethodHandleStore(final int index, final MethodHandle methodHandle) {
localVariables.merge(index, new MethodHandle(methodHandle), Element::merge);
} | [
"private",
"void",
"mergeMethodHandleStore",
"(",
"final",
"int",
"index",
",",
"final",
"MethodHandle",
"methodHandle",
")",
"{",
"localVariables",
".",
"merge",
"(",
"index",
",",
"new",
"MethodHandle",
"(",
"methodHandle",
")",
",",
"Element",
"::",
"merge",
... | Merges a stored method handle to the local variables.
@param index The index of the variable
@param methodHandle The method handle to merge | [
"Merges",
"a",
"stored",
"method",
"handle",
"to",
"the",
"local",
"variables",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L236-L238 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.mergePossibleResponse | private void mergePossibleResponse() {
// TODO only HttpResponse element?
if (!runtimeStack.isEmpty() && runtimeStack.peek().getTypes().contains(Types.RESPONSE)) {
mergeReturnElement(runtimeStack.peek());
}
} | java | private void mergePossibleResponse() {
// TODO only HttpResponse element?
if (!runtimeStack.isEmpty() && runtimeStack.peek().getTypes().contains(Types.RESPONSE)) {
mergeReturnElement(runtimeStack.peek());
}
} | [
"private",
"void",
"mergePossibleResponse",
"(",
")",
"{",
"// TODO only HttpResponse element?",
"if",
"(",
"!",
"runtimeStack",
".",
"isEmpty",
"(",
")",
"&&",
"runtimeStack",
".",
"peek",
"(",
")",
".",
"getTypes",
"(",
")",
".",
"contains",
"(",
"Types",
... | Checks if the current stack element is eligible for being merged with the returned element. | [
"Checks",
"if",
"the",
"current",
"stack",
"element",
"is",
"eligible",
"for",
"being",
"merged",
"with",
"the",
"returned",
"element",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L243-L248 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java | MethodSimulator.simulateSizeChange | private void simulateSizeChange(final SizeChangingInstruction instruction) {
IntStream.range(0, instruction.getNumberOfPops()).forEach(i -> runtimeStack.pop());
IntStream.range(0, instruction.getNumberOfPushes()).forEach(i -> runtimeStack.push(new Element()));
} | java | private void simulateSizeChange(final SizeChangingInstruction instruction) {
IntStream.range(0, instruction.getNumberOfPops()).forEach(i -> runtimeStack.pop());
IntStream.range(0, instruction.getNumberOfPushes()).forEach(i -> runtimeStack.push(new Element()));
} | [
"private",
"void",
"simulateSizeChange",
"(",
"final",
"SizeChangingInstruction",
"instruction",
")",
"{",
"IntStream",
".",
"range",
"(",
"0",
",",
"instruction",
".",
"getNumberOfPops",
"(",
")",
")",
".",
"forEach",
"(",
"i",
"->",
"runtimeStack",
".",
"pop... | Simulates the size change instruction.
@param instruction The instruction to simulate | [
"Simulates",
"the",
"size",
"change",
"instruction",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L255-L258 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java | ResultInterpreter.interpret | public Resources interpret(final Set<ClassResult> classResults) {
resources = new Resources();
resources.setBasePath(PathNormalizer.getApplicationPath(classResults));
javaTypeAnalyzer = new JavaTypeAnalyzer(resources.getTypeRepresentations());
dynamicTypeAnalyzer = new DynamicTypeAnalyz... | java | public Resources interpret(final Set<ClassResult> classResults) {
resources = new Resources();
resources.setBasePath(PathNormalizer.getApplicationPath(classResults));
javaTypeAnalyzer = new JavaTypeAnalyzer(resources.getTypeRepresentations());
dynamicTypeAnalyzer = new DynamicTypeAnalyz... | [
"public",
"Resources",
"interpret",
"(",
"final",
"Set",
"<",
"ClassResult",
">",
"classResults",
")",
"{",
"resources",
"=",
"new",
"Resources",
"(",
")",
";",
"resources",
".",
"setBasePath",
"(",
"PathNormalizer",
".",
"getApplicationPath",
"(",
"classResults... | Interprets the class results.
@return All REST resources | [
"Interprets",
"the",
"class",
"results",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L54-L66 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java | ResultInterpreter.interpretClassResult | private void interpretClassResult(final ClassResult classResult) {
classResult.getMethods().forEach(m -> interpretMethodResult(m, classResult));
} | java | private void interpretClassResult(final ClassResult classResult) {
classResult.getMethods().forEach(m -> interpretMethodResult(m, classResult));
} | [
"private",
"void",
"interpretClassResult",
"(",
"final",
"ClassResult",
"classResult",
")",
"{",
"classResult",
".",
"getMethods",
"(",
")",
".",
"forEach",
"(",
"m",
"->",
"interpretMethodResult",
"(",
"m",
",",
"classResult",
")",
")",
";",
"}"
] | Interprets the class result.
@param classResult The class result | [
"Interprets",
"the",
"class",
"result",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L73-L75 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java | ResultInterpreter.interpretMethodResult | private void interpretMethodResult(final MethodResult methodResult, final ClassResult classResult) {
if (methodResult.getSubResource() != null) {
interpretClassResult(methodResult.getSubResource());
return;
}
// determine resource of the method
final String path ... | java | private void interpretMethodResult(final MethodResult methodResult, final ClassResult classResult) {
if (methodResult.getSubResource() != null) {
interpretClassResult(methodResult.getSubResource());
return;
}
// determine resource of the method
final String path ... | [
"private",
"void",
"interpretMethodResult",
"(",
"final",
"MethodResult",
"methodResult",
",",
"final",
"ClassResult",
"classResult",
")",
"{",
"if",
"(",
"methodResult",
".",
"getSubResource",
"(",
")",
"!=",
"null",
")",
"{",
"interpretClassResult",
"(",
"method... | Interprets the method result.
@param methodResult The method result
@param classResult The result of the containing class | [
"Interprets",
"the",
"method",
"result",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L83-L95 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java | ResultInterpreter.interpretResourceMethod | private ResourceMethod interpretResourceMethod(final MethodResult methodResult, final ClassResult classResult) {
final MethodComment methodDoc = methodResult.getMethodDoc();
final String description = methodDoc != null ? methodDoc.getComment() : null;
final ResourceMethod resourceMethod = new R... | java | private ResourceMethod interpretResourceMethod(final MethodResult methodResult, final ClassResult classResult) {
final MethodComment methodDoc = methodResult.getMethodDoc();
final String description = methodDoc != null ? methodDoc.getComment() : null;
final ResourceMethod resourceMethod = new R... | [
"private",
"ResourceMethod",
"interpretResourceMethod",
"(",
"final",
"MethodResult",
"methodResult",
",",
"final",
"ClassResult",
"classResult",
")",
"{",
"final",
"MethodComment",
"methodDoc",
"=",
"methodResult",
".",
"getMethodDoc",
"(",
")",
";",
"final",
"String... | Interprets the result of a resource method.
@param methodResult The method result
@param classResult The result of the containing class
@return The resource method which this method represents | [
"Interprets",
"the",
"result",
"of",
"a",
"resource",
"method",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L104-L133 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java | ResultInterpreter.addMediaTypes | private void addMediaTypes(final MethodResult methodResult, final ClassResult classResult, final ResourceMethod resourceMethod) {
// accept media types -> inherit
resourceMethod.getRequestMediaTypes().addAll(methodResult.getRequestMediaTypes());
if (resourceMethod.getRequestMediaTypes().isEmpty(... | java | private void addMediaTypes(final MethodResult methodResult, final ClassResult classResult, final ResourceMethod resourceMethod) {
// accept media types -> inherit
resourceMethod.getRequestMediaTypes().addAll(methodResult.getRequestMediaTypes());
if (resourceMethod.getRequestMediaTypes().isEmpty(... | [
"private",
"void",
"addMediaTypes",
"(",
"final",
"MethodResult",
"methodResult",
",",
"final",
"ClassResult",
"classResult",
",",
"final",
"ResourceMethod",
"resourceMethod",
")",
"{",
"// accept media types -> inherit",
"resourceMethod",
".",
"getRequestMediaTypes",
"(",
... | Adds the request and response media type information to the resource method.
@param methodResult The method result
@param classResult The class result
@param resourceMethod The resource method | [
"Adds",
"the",
"request",
"and",
"response",
"media",
"type",
"information",
"to",
"the",
"resource",
"method",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L240-L254 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/MethodContentAnalyzer.java | MethodContentAnalyzer.buildPackagePrefix | void buildPackagePrefix(final String className) {
// TODO test
final int lastPackageSeparator = className.lastIndexOf('/');
final String packageName = className.substring(0, lastPackageSeparator == -1 ? className.length() : lastPackageSeparator);
final String[] splitPackage = packageName... | java | void buildPackagePrefix(final String className) {
// TODO test
final int lastPackageSeparator = className.lastIndexOf('/');
final String packageName = className.substring(0, lastPackageSeparator == -1 ? className.length() : lastPackageSeparator);
final String[] splitPackage = packageName... | [
"void",
"buildPackagePrefix",
"(",
"final",
"String",
"className",
")",
"{",
"// TODO test",
"final",
"int",
"lastPackageSeparator",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"final",
"String",
"packageName",
"=",
"className",
".",
"substrin... | Builds the project package prefix for the class of given method.
The current project which is analyzed is identified by the first two package nodes. | [
"Builds",
"the",
"project",
"package",
"prefix",
"for",
"the",
"class",
"of",
"given",
"method",
".",
"The",
"current",
"project",
"which",
"is",
"analyzed",
"is",
"identified",
"by",
"the",
"first",
"two",
"package",
"nodes",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/MethodContentAnalyzer.java#L66-L77 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/MethodContentAnalyzer.java | MethodContentAnalyzer.findProjectMethods | Set<ProjectMethod> findProjectMethods(final List<Instruction> instructions) {
final Set<ProjectMethod> projectMethods = new HashSet<>();
addProjectMethods(instructions, projectMethods);
return projectMethods;
} | java | Set<ProjectMethod> findProjectMethods(final List<Instruction> instructions) {
final Set<ProjectMethod> projectMethods = new HashSet<>();
addProjectMethods(instructions, projectMethods);
return projectMethods;
} | [
"Set",
"<",
"ProjectMethod",
">",
"findProjectMethods",
"(",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
")",
"{",
"final",
"Set",
"<",
"ProjectMethod",
">",
"projectMethods",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"addProjectMethods",
"(",
... | Searches for own project method invoke instructions in the given list.
@param instructions The instructions where to search
@return The found project methods | [
"Searches",
"for",
"own",
"project",
"method",
"invoke",
"instructions",
"in",
"the",
"given",
"list",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/MethodContentAnalyzer.java#L85-L91 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/MethodContentAnalyzer.java | MethodContentAnalyzer.isProjectMethod | private boolean isProjectMethod(final InvokeInstruction instruction) {
final MethodIdentifier identifier = instruction.getIdentifier();
// check if method is in own package
return identifier.getContainingClass().startsWith(projectPackagePrefix);
} | java | private boolean isProjectMethod(final InvokeInstruction instruction) {
final MethodIdentifier identifier = instruction.getIdentifier();
// check if method is in own package
return identifier.getContainingClass().startsWith(projectPackagePrefix);
} | [
"private",
"boolean",
"isProjectMethod",
"(",
"final",
"InvokeInstruction",
"instruction",
")",
"{",
"final",
"MethodIdentifier",
"identifier",
"=",
"instruction",
".",
"getIdentifier",
"(",
")",
";",
"// check if method is in own package",
"return",
"identifier",
".",
... | Checks if the given instruction invokes a method defined in the analyzed project.
@param instruction The invoke instruction
@return {@code true} if method was defined in the project | [
"Checks",
"if",
"the",
"given",
"instruction",
"invokes",
"a",
"method",
"defined",
"in",
"the",
"analyzed",
"project",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/MethodContentAnalyzer.java#L153-L158 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/StackSizeSimulator.java | StackSizeSimulator.isStackCleared | private static boolean isStackCleared(final Instruction instruction) {
return instruction.getType() == Instruction.InstructionType.RETURN || instruction.getType() == Instruction.InstructionType.THROW;
} | java | private static boolean isStackCleared(final Instruction instruction) {
return instruction.getType() == Instruction.InstructionType.RETURN || instruction.getType() == Instruction.InstructionType.THROW;
} | [
"private",
"static",
"boolean",
"isStackCleared",
"(",
"final",
"Instruction",
"instruction",
")",
"{",
"return",
"instruction",
".",
"getType",
"(",
")",
"==",
"Instruction",
".",
"InstructionType",
".",
"RETURN",
"||",
"instruction",
".",
"getType",
"(",
")",
... | Checks if the stack will be cleared on invoking the given instruction.
@param instruction The instruction
@return {@code true} if the stack will be cleared | [
"Checks",
"if",
"the",
"stack",
"will",
"be",
"cleared",
"on",
"invoking",
"the",
"given",
"instruction",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/StackSizeSimulator.java#L66-L68 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/StackSizeSimulator.java | StackSizeSimulator.findBacktrackPosition | private int findBacktrackPosition(final int position) {
int currentPosition = position;
// check against stack size after the instruction was executed
while (stackSizes.get(currentPosition).getRight() > 0) {
currentPosition++;
}
return currentPosition;
} | java | private int findBacktrackPosition(final int position) {
int currentPosition = position;
// check against stack size after the instruction was executed
while (stackSizes.get(currentPosition).getRight() > 0) {
currentPosition++;
}
return currentPosition;
} | [
"private",
"int",
"findBacktrackPosition",
"(",
"final",
"int",
"position",
")",
"{",
"int",
"currentPosition",
"=",
"position",
";",
"// check against stack size after the instruction was executed",
"while",
"(",
"stackSizes",
".",
"get",
"(",
"currentPosition",
")",
"... | Returns the next position where the stack will be empty.
@param position The current position
@return The next empty position | [
"Returns",
"the",
"next",
"position",
"where",
"the",
"stack",
"will",
"be",
"empty",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/StackSizeSimulator.java#L108-L117 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/javadoc/JavaDocAnalyzer.java | JavaDocAnalyzer.equalsSimpleTypeNames | private boolean equalsSimpleTypeNames(MethodIdentifier identifier, MethodResult methodResult) {
MethodIdentifier originalIdentifier = methodResult.getOriginalMethodSignature();
return originalIdentifier.getMethodName().equals(identifier.getMethodName()) &&
matchesTypeBestEffort(original... | java | private boolean equalsSimpleTypeNames(MethodIdentifier identifier, MethodResult methodResult) {
MethodIdentifier originalIdentifier = methodResult.getOriginalMethodSignature();
return originalIdentifier.getMethodName().equals(identifier.getMethodName()) &&
matchesTypeBestEffort(original... | [
"private",
"boolean",
"equalsSimpleTypeNames",
"(",
"MethodIdentifier",
"identifier",
",",
"MethodResult",
"methodResult",
")",
"{",
"MethodIdentifier",
"originalIdentifier",
"=",
"methodResult",
".",
"getOriginalMethodSignature",
"(",
")",
";",
"return",
"originalIdentifie... | This is a best-effort approach combining only the simple types.
@see JavaDocParserVisitor#calculateMethodIdentifier(MethodDeclaration) | [
"This",
"is",
"a",
"best",
"-",
"effort",
"approach",
"combining",
"only",
"the",
"simple",
"types",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/javadoc/JavaDocAnalyzer.java#L96-L102 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResponseTypeNormalizer.java | ResponseTypeNormalizer.normalizeCollection | static String normalizeCollection(final String type) {
if (isAssignableTo(type, Types.COLLECTION)) {
if (!getTypeParameters(type).isEmpty()) {
return getTypeParameters(type).get(0);
}
return Types.OBJECT;
}
return type;
} | java | static String normalizeCollection(final String type) {
if (isAssignableTo(type, Types.COLLECTION)) {
if (!getTypeParameters(type).isEmpty()) {
return getTypeParameters(type).get(0);
}
return Types.OBJECT;
}
return type;
} | [
"static",
"String",
"normalizeCollection",
"(",
"final",
"String",
"type",
")",
"{",
"if",
"(",
"isAssignableTo",
"(",
"type",
",",
"Types",
".",
"COLLECTION",
")",
")",
"{",
"if",
"(",
"!",
"getTypeParameters",
"(",
"type",
")",
".",
"isEmpty",
"(",
")"... | Normalizes the contained collection type.
@param type The type
@return The normalized type | [
"Normalizes",
"the",
"contained",
"collection",
"type",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResponseTypeNormalizer.java#L43-L51 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/RelevantInstructionReducer.java | RelevantInstructionReducer.reduceInstructions | public List<Instruction> reduceInstructions(final List<Instruction> instructions) {
lock.lock();
try {
this.instructions = instructions;
stackSizeSimulator.buildStackSizes(instructions);
return reduceInstructionsInternal(instructions);
} finally {
... | java | public List<Instruction> reduceInstructions(final List<Instruction> instructions) {
lock.lock();
try {
this.instructions = instructions;
stackSizeSimulator.buildStackSizes(instructions);
return reduceInstructionsInternal(instructions);
} finally {
... | [
"public",
"List",
"<",
"Instruction",
">",
"reduceInstructions",
"(",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"this",
".",
"instructions",
"=",
"instructions",
";",
"stackSizeSimulat... | Returns all instructions which are somewhat "relevant" for the returned object of the method.
The instructions are visited backwards - starting from the return statement.
Load and Store operations are handled as well.
@param instructions The instructions to reduce
@return The relevant instructions | [
"Returns",
"all",
"instructions",
"which",
"are",
"somewhat",
"relevant",
"for",
"the",
"returned",
"object",
"of",
"the",
"method",
".",
"The",
"instructions",
"are",
"visited",
"backwards",
"-",
"starting",
"from",
"the",
"return",
"statement",
".",
"Load",
... | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/RelevantInstructionReducer.java#L51-L61 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/RelevantInstructionReducer.java | RelevantInstructionReducer.reduceInstructionsInternal | private List<Instruction> reduceInstructionsInternal(final List<Instruction> instructions) {
final List<Instruction> visitedInstructions = new LinkedList<>();
final Set<Integer> visitedInstructionPositions = new HashSet<>();
final Set<Integer> handledLoadIndexes = new HashSet<>();
final ... | java | private List<Instruction> reduceInstructionsInternal(final List<Instruction> instructions) {
final List<Instruction> visitedInstructions = new LinkedList<>();
final Set<Integer> visitedInstructionPositions = new HashSet<>();
final Set<Integer> handledLoadIndexes = new HashSet<>();
final ... | [
"private",
"List",
"<",
"Instruction",
">",
"reduceInstructionsInternal",
"(",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
")",
"{",
"final",
"List",
"<",
"Instruction",
">",
"visitedInstructions",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"... | Returns all reduced instructions.
@param instructions All instructions
@return The relevant instructions | [
"Returns",
"all",
"reduced",
"instructions",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/RelevantInstructionReducer.java#L69-L102 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/RelevantInstructionReducer.java | RelevantInstructionReducer.isLoadIgnored | private static boolean isLoadIgnored(final LoadInstruction instruction) {
return Stream.of(VARIABLE_NAMES_TO_IGNORE).anyMatch(instruction.getName()::equals);
} | java | private static boolean isLoadIgnored(final LoadInstruction instruction) {
return Stream.of(VARIABLE_NAMES_TO_IGNORE).anyMatch(instruction.getName()::equals);
} | [
"private",
"static",
"boolean",
"isLoadIgnored",
"(",
"final",
"LoadInstruction",
"instruction",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"VARIABLE_NAMES_TO_IGNORE",
")",
".",
"anyMatch",
"(",
"instruction",
".",
"getName",
"(",
")",
"::",
"equals",
")",
... | Checks if the given LOAD instruction should be ignored for backtracking.
@param instruction The instruction to check
@return {@code true} if the LOAD instruction will be ignored | [
"Checks",
"if",
"the",
"given",
"LOAD",
"instruction",
"should",
"be",
"ignored",
"for",
"backtracking",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/reduction/RelevantInstructionReducer.java#L132-L134 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java | ProjectAnalyzer.analyze | public Resources analyze(Set<Path> projectClassPaths, Set<Path> projectSourcePaths, Set<String> ignoredResources) {
lock.lock();
try {
projectClassPaths.forEach(this::addProjectPath);
// analyze relevant classes
final JobRegistry jobRegistry = JobRegistry.getInstance... | java | public Resources analyze(Set<Path> projectClassPaths, Set<Path> projectSourcePaths, Set<String> ignoredResources) {
lock.lock();
try {
projectClassPaths.forEach(this::addProjectPath);
// analyze relevant classes
final JobRegistry jobRegistry = JobRegistry.getInstance... | [
"public",
"Resources",
"analyze",
"(",
"Set",
"<",
"Path",
">",
"projectClassPaths",
",",
"Set",
"<",
"Path",
">",
"projectSourcePaths",
",",
"Set",
"<",
"String",
">",
"ignoredResources",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"projec... | Analyzes all classes in the given project path.
@param projectClassPaths The project class paths
@param projectSourcePaths The project source file paths
@param ignoredResources The fully-qualified root resource class names to be ignored
@return The REST resource representations | [
"Analyzes",
"all",
"classes",
"in",
"the",
"given",
"project",
"path",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java#L83-L113 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java | ProjectAnalyzer.addToClassPool | private void addToClassPool(final Path location) {
if (!location.toFile().exists())
throw new IllegalArgumentException("The location '" + location + "' does not exist!");
try {
ContextClassReader.addClassPath(location.toUri().toURL());
} catch (Exception e) {
... | java | private void addToClassPool(final Path location) {
if (!location.toFile().exists())
throw new IllegalArgumentException("The location '" + location + "' does not exist!");
try {
ContextClassReader.addClassPath(location.toUri().toURL());
} catch (Exception e) {
... | [
"private",
"void",
"addToClassPool",
"(",
"final",
"Path",
"location",
")",
"{",
"if",
"(",
"!",
"location",
".",
"toFile",
"(",
")",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The location '\"",
"+",
"location",
"+",
... | Adds the location to the class pool.
@param location The location of a jar file or a directory | [
"Adds",
"the",
"location",
"to",
"the",
"class",
"pool",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java#L137-L145 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java | ProjectAnalyzer.addProjectPath | private void addProjectPath(final Path path) {
addToClassPool(path);
if (path.toFile().isFile() && path.toString().endsWith(".jar")) {
addJarClasses(path);
} else if (path.toFile().isDirectory()) {
addDirectoryClasses(path, Paths.get(""));
} else {
th... | java | private void addProjectPath(final Path path) {
addToClassPool(path);
if (path.toFile().isFile() && path.toString().endsWith(".jar")) {
addJarClasses(path);
} else if (path.toFile().isDirectory()) {
addDirectoryClasses(path, Paths.get(""));
} else {
th... | [
"private",
"void",
"addProjectPath",
"(",
"final",
"Path",
"path",
")",
"{",
"addToClassPool",
"(",
"path",
")",
";",
"if",
"(",
"path",
".",
"toFile",
"(",
")",
".",
"isFile",
"(",
")",
"&&",
"path",
".",
"toString",
"(",
")",
".",
"endsWith",
"(",
... | Adds the project paths and loads all classes.
@param path The project path | [
"Adds",
"the",
"project",
"paths",
"and",
"loads",
"all",
"classes",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java#L152-L162 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java | ProjectAnalyzer.addJarClasses | private void addJarClasses(final Path location) {
try (final JarFile jarFile = new JarFile(location.toFile())) {
final Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
final JarEntry entry = entries.nextElement();
fina... | java | private void addJarClasses(final Path location) {
try (final JarFile jarFile = new JarFile(location.toFile())) {
final Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
final JarEntry entry = entries.nextElement();
fina... | [
"private",
"void",
"addJarClasses",
"(",
"final",
"Path",
"location",
")",
"{",
"try",
"(",
"final",
"JarFile",
"jarFile",
"=",
"new",
"JarFile",
"(",
"location",
".",
"toFile",
"(",
")",
")",
")",
"{",
"final",
"Enumeration",
"<",
"JarEntry",
">",
"entr... | Adds all classes in the given jar-file location to the set of known classes.
@param location The location of the jar-file | [
"Adds",
"all",
"classes",
"in",
"the",
"given",
"jar",
"-",
"file",
"location",
"to",
"the",
"set",
"of",
"known",
"classes",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java#L169-L181 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java | ProjectAnalyzer.addDirectoryClasses | private void addDirectoryClasses(final Path location, final Path subPath) {
for (final File file : location.toFile().listFiles()) {
if (file.isDirectory())
addDirectoryClasses(location.resolve(file.getName()), subPath.resolve(file.getName()));
else if (file.isFile() && fi... | java | private void addDirectoryClasses(final Path location, final Path subPath) {
for (final File file : location.toFile().listFiles()) {
if (file.isDirectory())
addDirectoryClasses(location.resolve(file.getName()), subPath.resolve(file.getName()));
else if (file.isFile() && fi... | [
"private",
"void",
"addDirectoryClasses",
"(",
"final",
"Path",
"location",
",",
"final",
"Path",
"subPath",
")",
"{",
"for",
"(",
"final",
"File",
"file",
":",
"location",
".",
"toFile",
"(",
")",
".",
"listFiles",
"(",
")",
")",
"{",
"if",
"(",
"file... | Adds all classes in the given directory location to the set of known classes.
@param location The location of the current directory
@param subPath The sub-path which is relevant for the package names or {@code null} if currently in the root directory | [
"Adds",
"all",
"classes",
"in",
"the",
"given",
"directory",
"location",
"to",
"the",
"set",
"of",
"known",
"classes",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java#L189-L198 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java | ProjectAnalyzer.toQualifiedClassName | private static String toQualifiedClassName(final String fileName) {
final String replacedSeparators = fileName.replace(File.separatorChar, '.');
return replacedSeparators.substring(0, replacedSeparators.length() - ".class".length());
} | java | private static String toQualifiedClassName(final String fileName) {
final String replacedSeparators = fileName.replace(File.separatorChar, '.');
return replacedSeparators.substring(0, replacedSeparators.length() - ".class".length());
} | [
"private",
"static",
"String",
"toQualifiedClassName",
"(",
"final",
"String",
"fileName",
")",
"{",
"final",
"String",
"replacedSeparators",
"=",
"fileName",
".",
"replace",
"(",
"File",
".",
"separatorChar",
",",
"'",
"'",
")",
";",
"return",
"replacedSeparato... | Converts the given file name of a class-file to the fully-qualified class name.
@param fileName The file name (e.g. a/package/AClass.class)
@return The fully-qualified class name (e.g. a.package.AClass) | [
"Converts",
"the",
"given",
"file",
"name",
"of",
"a",
"class",
"-",
"file",
"to",
"the",
"fully",
"-",
"qualified",
"class",
"name",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java#L206-L209 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/PathNormalizer.java | PathNormalizer.getApplicationPath | static String getApplicationPath(final Set<ClassResult> classResults) {
return classResults.stream().map(ClassResult::getApplicationPath).filter(Objects::nonNull)
.map(PathNormalizer::normalize).findAny().orElse("");
} | java | static String getApplicationPath(final Set<ClassResult> classResults) {
return classResults.stream().map(ClassResult::getApplicationPath).filter(Objects::nonNull)
.map(PathNormalizer::normalize).findAny().orElse("");
} | [
"static",
"String",
"getApplicationPath",
"(",
"final",
"Set",
"<",
"ClassResult",
">",
"classResults",
")",
"{",
"return",
"classResults",
".",
"stream",
"(",
")",
".",
"map",
"(",
"ClassResult",
"::",
"getApplicationPath",
")",
".",
"filter",
"(",
"Objects",... | Returns the normalized application path found in any of the given class results.
@return The base URI of the application | [
"Returns",
"the",
"normalized",
"application",
"path",
"found",
"in",
"any",
"of",
"the",
"given",
"class",
"results",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/PathNormalizer.java#L42-L45 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/PathNormalizer.java | PathNormalizer.determinePaths | private static List<String> determinePaths(final MethodResult methodResult) {
final List<String> paths = new LinkedList<>();
MethodResult currentMethod = methodResult;
while (true) {
addNonBlank(currentMethod.getPath(), paths);
final ClassResult parentClass = currentMeth... | java | private static List<String> determinePaths(final MethodResult methodResult) {
final List<String> paths = new LinkedList<>();
MethodResult currentMethod = methodResult;
while (true) {
addNonBlank(currentMethod.getPath(), paths);
final ClassResult parentClass = currentMeth... | [
"private",
"static",
"List",
"<",
"String",
">",
"determinePaths",
"(",
"final",
"MethodResult",
"methodResult",
")",
"{",
"final",
"List",
"<",
"String",
">",
"paths",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"MethodResult",
"currentMethod",
"=",
"met... | Determines all single paths of the method result recursively. All parent class and method results are analyzed as well.
@param methodResult The method result
@return All single path pieces | [
"Determines",
"all",
"single",
"paths",
"of",
"the",
"method",
"result",
"recursively",
".",
"All",
"parent",
"class",
"and",
"method",
"results",
"are",
"analyzed",
"as",
"well",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/PathNormalizer.java#L66-L86 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/PathNormalizer.java | PathNormalizer.addNonBlank | private static void addNonBlank(final String string, final List<String> strings) {
if (!StringUtils.isBlank(string) && !"/".equals(string))
strings.add(string);
} | java | private static void addNonBlank(final String string, final List<String> strings) {
if (!StringUtils.isBlank(string) && !"/".equals(string))
strings.add(string);
} | [
"private",
"static",
"void",
"addNonBlank",
"(",
"final",
"String",
"string",
",",
"final",
"List",
"<",
"String",
">",
"strings",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"string",
")",
"&&",
"!",
"\"/\"",
".",
"equals",
"(",
"str... | Adds the string to the list if it is not blank.
@param string The string to add
@param strings The list | [
"Adds",
"the",
"string",
"to",
"the",
"list",
"if",
"it",
"is",
"not",
"blank",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/PathNormalizer.java#L94-L97 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/PathNormalizer.java | PathNormalizer.normalize | private static String normalize(final String path) {
final StringBuilder builder = new StringBuilder(path);
int index = 0;
int colonIndex = -1;
char current = 0;
char last;
while ((index > -1) && (index < builder.length())) {
last = current;
curr... | java | private static String normalize(final String path) {
final StringBuilder builder = new StringBuilder(path);
int index = 0;
int colonIndex = -1;
char current = 0;
char last;
while ((index > -1) && (index < builder.length())) {
last = current;
curr... | [
"private",
"static",
"String",
"normalize",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"path",
")",
";",
"int",
"index",
"=",
"0",
";",
"int",
"colonIndex",
"=",
"-",
"1",
";",
"char",... | Normalizes the given path, i.e. trims leading or trailing forward-slashes and removes path parameter matchers.
@param path The path to normalize
@return The normalized path | [
"Normalizes",
"the",
"given",
"path",
"i",
".",
"e",
".",
"trims",
"leading",
"or",
"trailing",
"forward",
"-",
"slashes",
"and",
"removes",
"path",
"parameter",
"matchers",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/PathNormalizer.java#L105-L146 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/InjectableArgumentMethodSimulator.java | InjectableArgumentMethodSimulator.simulate | public Element simulate(final List<Element> arguments, final List<Instruction> instructions, final MethodIdentifier identifier) {
// prevent infinite loops on analysing recursion
if (EXECUTED_PATH_METHODS.contains(identifier))
return new Element();
lock.lock();
EXECUTED_PATH... | java | public Element simulate(final List<Element> arguments, final List<Instruction> instructions, final MethodIdentifier identifier) {
// prevent infinite loops on analysing recursion
if (EXECUTED_PATH_METHODS.contains(identifier))
return new Element();
lock.lock();
EXECUTED_PATH... | [
"public",
"Element",
"simulate",
"(",
"final",
"List",
"<",
"Element",
">",
"arguments",
",",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
",",
"final",
"MethodIdentifier",
"identifier",
")",
"{",
"// prevent infinite loops on analysing recursion",
"if",
... | Simulates the instructions of the method which will be called with the given arguments.
@param arguments The argument values
@param instructions The instructions of the method
@param identifier The identifier of the method
@return The return value or {@code null} if return type is void | [
"Simulates",
"the",
"instructions",
"of",
"the",
"method",
"which",
"will",
"be",
"called",
"with",
"the",
"given",
"arguments",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/InjectableArgumentMethodSimulator.java#L52-L68 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/InjectableArgumentMethodSimulator.java | InjectableArgumentMethodSimulator.injectArguments | private void injectArguments(final List<Element> arguments, final MethodIdentifier identifier) {
final boolean staticMethod = identifier.isStaticMethod();
final int startIndex = staticMethod ? 0 : 1;
final int endIndex = staticMethod ? arguments.size() - 1 : arguments.size();
IntStream.... | java | private void injectArguments(final List<Element> arguments, final MethodIdentifier identifier) {
final boolean staticMethod = identifier.isStaticMethod();
final int startIndex = staticMethod ? 0 : 1;
final int endIndex = staticMethod ? arguments.size() - 1 : arguments.size();
IntStream.... | [
"private",
"void",
"injectArguments",
"(",
"final",
"List",
"<",
"Element",
">",
"arguments",
",",
"final",
"MethodIdentifier",
"identifier",
")",
"{",
"final",
"boolean",
"staticMethod",
"=",
"identifier",
".",
"isStaticMethod",
"(",
")",
";",
"final",
"int",
... | Injects the arguments of the method invocation to the local variables.
@param arguments The argument values | [
"Injects",
"the",
"arguments",
"of",
"the",
"method",
"invocation",
"to",
"the",
"local",
"variables",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/InjectableArgumentMethodSimulator.java#L75-L81 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/backend/swagger/SchemaBuilder.java | SchemaBuilder.toSwaggerType | private static SwaggerType toSwaggerType(final String type) {
if (INTEGER_TYPES.contains(type))
return SwaggerType.INTEGER;
if (DOUBLE_TYPES.contains(type))
return SwaggerType.NUMBER;
if (BOOLEAN.equals(type) || PRIMITIVE_BOOLEAN.equals(type))
return Swagger... | java | private static SwaggerType toSwaggerType(final String type) {
if (INTEGER_TYPES.contains(type))
return SwaggerType.INTEGER;
if (DOUBLE_TYPES.contains(type))
return SwaggerType.NUMBER;
if (BOOLEAN.equals(type) || PRIMITIVE_BOOLEAN.equals(type))
return Swagger... | [
"private",
"static",
"SwaggerType",
"toSwaggerType",
"(",
"final",
"String",
"type",
")",
"{",
"if",
"(",
"INTEGER_TYPES",
".",
"contains",
"(",
"type",
")",
")",
"return",
"SwaggerType",
".",
"INTEGER",
";",
"if",
"(",
"DOUBLE_TYPES",
".",
"contains",
"(",
... | Converts the given Java type to the Swagger JSON type.
@param type The Java type definition
@return The Swagger type | [
"Converts",
"the",
"given",
"Java",
"type",
"to",
"the",
"Swagger",
"JSON",
"type",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/backend/swagger/SchemaBuilder.java#L183-L197 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/elements/Element.java | Element.merge | public Element merge(final Element element) {
types.addAll(element.types);
possibleValues.addAll(element.possibleValues);
return this;
} | java | public Element merge(final Element element) {
types.addAll(element.types);
possibleValues.addAll(element.possibleValues);
return this;
} | [
"public",
"Element",
"merge",
"(",
"final",
"Element",
"element",
")",
"{",
"types",
".",
"addAll",
"(",
"element",
".",
"types",
")",
";",
"possibleValues",
".",
"addAll",
"(",
"element",
".",
"possibleValues",
")",
";",
"return",
"this",
";",
"}"
] | Merges the other element into this element.
@param element The element to merge
@return This element (needed as BinaryOperator) | [
"Merges",
"the",
"other",
"element",
"into",
"this",
"element",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/elements/Element.java#L63-L67 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/Resources.java | Resources.addMethod | public void addMethod(final String resource, final ResourceMethod method) {
resources.putIfAbsent(resource, new HashSet<>());
resources.get(resource).add(method);
} | java | public void addMethod(final String resource, final ResourceMethod method) {
resources.putIfAbsent(resource, new HashSet<>());
resources.get(resource).add(method);
} | [
"public",
"void",
"addMethod",
"(",
"final",
"String",
"resource",
",",
"final",
"ResourceMethod",
"method",
")",
"{",
"resources",
".",
"putIfAbsent",
"(",
"resource",
",",
"new",
"HashSet",
"<>",
"(",
")",
")",
";",
"resources",
".",
"get",
"(",
"resourc... | Adds the method to the resource's methods.
@param resource The resource path where to add
@param method The method to add | [
"Adds",
"the",
"method",
"to",
"the",
"resource",
"s",
"methods",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/Resources.java#L39-L42 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/Resources.java | Resources.getMethods | public Set<ResourceMethod> getMethods(final String resource) {
return Collections.unmodifiableSet(resources.get(resource));
} | java | public Set<ResourceMethod> getMethods(final String resource) {
return Collections.unmodifiableSet(resources.get(resource));
} | [
"public",
"Set",
"<",
"ResourceMethod",
">",
"getMethods",
"(",
"final",
"String",
"resource",
")",
"{",
"return",
"Collections",
".",
"unmodifiableSet",
"(",
"resources",
".",
"get",
"(",
"resource",
")",
")",
";",
"}"
] | Returns the resource methods for a given resource.
@param resource The resource path
@return The methods | [
"Returns",
"the",
"resource",
"methods",
"for",
"a",
"given",
"resource",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/Resources.java#L59-L61 | train |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/Resources.java | Resources.consolidateMultiplePaths | public void consolidateMultiplePaths() {
Map<String, Set<ResourceMethod>> oldResources = resources;
resources = new HashMap<>();
oldResources.keySet().forEach(s -> consolidateMultipleMethodsForSamePath(s, oldResources.get(s)));
} | java | public void consolidateMultiplePaths() {
Map<String, Set<ResourceMethod>> oldResources = resources;
resources = new HashMap<>();
oldResources.keySet().forEach(s -> consolidateMultipleMethodsForSamePath(s, oldResources.get(s)));
} | [
"public",
"void",
"consolidateMultiplePaths",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Set",
"<",
"ResourceMethod",
">",
">",
"oldResources",
"=",
"resources",
";",
"resources",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"oldResources",
".",
"keySet",
"... | Consolidates the information contained in multiple responses for the same path.
Internally creates new resources. | [
"Consolidates",
"the",
"information",
"contained",
"in",
"multiple",
"responses",
"for",
"the",
"same",
"path",
".",
"Internally",
"creates",
"new",
"resources",
"."
] | 4ac62942202d05632977d6c14d3cd7e2d27e2b9b | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/Resources.java#L74-L79 | train |
tomasbjerre/git-changelog-lib | src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java | GitChangelogApi.getChangelog | public Changelog getChangelog(final boolean useIntegrationIfConfigured)
throws GitChangelogRepositoryException {
try (GitRepo gitRepo = new GitRepo(new File(this.settings.getFromRepo()))) {
return getChangelog(gitRepo, useIntegrationIfConfigured);
} catch (final IOException e) {
throw new GitC... | java | public Changelog getChangelog(final boolean useIntegrationIfConfigured)
throws GitChangelogRepositoryException {
try (GitRepo gitRepo = new GitRepo(new File(this.settings.getFromRepo()))) {
return getChangelog(gitRepo, useIntegrationIfConfigured);
} catch (final IOException e) {
throw new GitC... | [
"public",
"Changelog",
"getChangelog",
"(",
"final",
"boolean",
"useIntegrationIfConfigured",
")",
"throws",
"GitChangelogRepositoryException",
"{",
"try",
"(",
"GitRepo",
"gitRepo",
"=",
"new",
"GitRepo",
"(",
"new",
"File",
"(",
"this",
".",
"settings",
".",
"ge... | Get the changelog as data object.
@param useIntegrationIfConfigured true if title/link/labels/issueType should be fetched from
integrations (GitHub, GitLab, Jira) if that is configured.
@throws GitChangelogRepositoryException | [
"Get",
"the",
"changelog",
"as",
"data",
"object",
"."
] | e6b26d29592a57bd53fe98fbe4a56d8c2267a192 | https://github.com/tomasbjerre/git-changelog-lib/blob/e6b26d29592a57bd53fe98fbe4a56d8c2267a192/src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java#L74-L81 | train |
tomasbjerre/git-changelog-lib | src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java | GitChangelogApi.toFile | public void toFile(final File file) throws GitChangelogRepositoryException, IOException {
createParentDirs(file);
write(render().getBytes("UTF-8"), file);
} | java | public void toFile(final File file) throws GitChangelogRepositoryException, IOException {
createParentDirs(file);
write(render().getBytes("UTF-8"), file);
} | [
"public",
"void",
"toFile",
"(",
"final",
"File",
"file",
")",
"throws",
"GitChangelogRepositoryException",
",",
"IOException",
"{",
"createParentDirs",
"(",
"file",
")",
";",
"write",
"(",
"render",
"(",
")",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
",",
"fi... | Write changelog to file.
@throws GitChangelogRepositoryException
@throws IOException When file cannot be written. | [
"Write",
"changelog",
"to",
"file",
"."
] | e6b26d29592a57bd53fe98fbe4a56d8c2267a192 | https://github.com/tomasbjerre/git-changelog-lib/blob/e6b26d29592a57bd53fe98fbe4a56d8c2267a192/src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java#L133-L136 | train |
tomasbjerre/git-changelog-lib | src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java | GitChangelogApi.toMediaWiki | public void toMediaWiki(
final String username, final String password, final String url, final String title)
throws GitChangelogRepositoryException, GitChangelogIntegrationException {
new MediaWikiClient(url, title, render()) //
.withUser(username, password) //
.createMediaWikiPage();
... | java | public void toMediaWiki(
final String username, final String password, final String url, final String title)
throws GitChangelogRepositoryException, GitChangelogIntegrationException {
new MediaWikiClient(url, title, render()) //
.withUser(username, password) //
.createMediaWikiPage();
... | [
"public",
"void",
"toMediaWiki",
"(",
"final",
"String",
"username",
",",
"final",
"String",
"password",
",",
"final",
"String",
"url",
",",
"final",
"String",
"title",
")",
"throws",
"GitChangelogRepositoryException",
",",
"GitChangelogIntegrationException",
"{",
"... | Create MediaWiki page with changelog.
@throws GitChangelogRepositoryException
@throws GitChangelogIntegrationException | [
"Create",
"MediaWiki",
"page",
"with",
"changelog",
"."
] | e6b26d29592a57bd53fe98fbe4a56d8c2267a192 | https://github.com/tomasbjerre/git-changelog-lib/blob/e6b26d29592a57bd53fe98fbe4a56d8c2267a192/src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java#L144-L150 | train |
TinkoffCreditSystems/decoro | library/src/main/java/ru/tinkoff/decoro/SlotsList.java | SlotsList.insertSlotAt | public Slot insertSlotAt(final int position, @NonNull final Slot slot) {
if (position < 0 || size < position) {
throw new IndexOutOfBoundsException("New slot position should be inside the slots list. Or on the tail (position = size)");
}
final Slot toInsert = new Slot(slot);
... | java | public Slot insertSlotAt(final int position, @NonNull final Slot slot) {
if (position < 0 || size < position) {
throw new IndexOutOfBoundsException("New slot position should be inside the slots list. Or on the tail (position = size)");
}
final Slot toInsert = new Slot(slot);
... | [
"public",
"Slot",
"insertSlotAt",
"(",
"final",
"int",
"position",
",",
"@",
"NonNull",
"final",
"Slot",
"slot",
")",
"{",
"if",
"(",
"position",
"<",
"0",
"||",
"size",
"<",
"position",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"New sl... | Inserts a slot on a specified position
@param position index where new slot weill be placed should be >= 0 and <= size.
@param slot slot ot insert. IMPORTANT: a copy of this slot will be inserted!
@return newly inserted slot (copy of the passed one) | [
"Inserts",
"a",
"slot",
"on",
"a",
"specified",
"position"
] | f2693d0b3def13aabf59cf642fc0b6f5c8c94f63 | https://github.com/TinkoffCreditSystems/decoro/blob/f2693d0b3def13aabf59cf642fc0b6f5c8c94f63/library/src/main/java/ru/tinkoff/decoro/SlotsList.java#L136-L178 | train |
aerogear/aerogear-otp-java | src/main/java/org/jboss/aerogear/security/otp/Totp.java | Totp.uri | public String uri(String name) {
try {
return String.format("otpauth://totp/%s?secret=%s", URLEncoder.encode(name, "UTF-8"), secret);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
} | java | public String uri(String name) {
try {
return String.format("otpauth://totp/%s?secret=%s", URLEncoder.encode(name, "UTF-8"), secret);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
} | [
"public",
"String",
"uri",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"String",
".",
"format",
"(",
"\"otpauth://totp/%s?secret=%s\"",
",",
"URLEncoder",
".",
"encode",
"(",
"name",
",",
"\"UTF-8\"",
")",
",",
"secret",
")",
";",
"}",
"catch",
... | Prover - To be used only on the client side
Retrieves the encoded URI to generated the QRCode required by Google Authenticator
@param name Account name
@return Encoded URI | [
"Prover",
"-",
"To",
"be",
"used",
"only",
"on",
"the",
"client",
"side",
"Retrieves",
"the",
"encoded",
"URI",
"to",
"generated",
"the",
"QRCode",
"required",
"by",
"Google",
"Authenticator"
] | c7ac41324afa58515a5f749d87ea135e8e0ac16f | https://github.com/aerogear/aerogear-otp-java/blob/c7ac41324afa58515a5f749d87ea135e8e0ac16f/src/main/java/org/jboss/aerogear/security/otp/Totp.java#L65-L71 | train |
aerogear/aerogear-otp-java | src/main/java/org/jboss/aerogear/security/otp/Totp.java | Totp.verify | public boolean verify(String otp) {
long code = Long.parseLong(otp);
long currentInterval = clock.getCurrentInterval();
int pastResponse = Math.max(DELAY_WINDOW, 0);
for (int i = pastResponse; i >= 0; --i) {
int candidate = generate(this.secret, currentInterval - i);
... | java | public boolean verify(String otp) {
long code = Long.parseLong(otp);
long currentInterval = clock.getCurrentInterval();
int pastResponse = Math.max(DELAY_WINDOW, 0);
for (int i = pastResponse; i >= 0; --i) {
int candidate = generate(this.secret, currentInterval - i);
... | [
"public",
"boolean",
"verify",
"(",
"String",
"otp",
")",
"{",
"long",
"code",
"=",
"Long",
".",
"parseLong",
"(",
"otp",
")",
";",
"long",
"currentInterval",
"=",
"clock",
".",
"getCurrentInterval",
"(",
")",
";",
"int",
"pastResponse",
"=",
"Math",
"."... | Verifier - To be used only on the server side
Taken from Google Authenticator with small modifications from
<a href="http://code.google.com/p/google-authenticator/source/browse/src/com/google/android/apps/authenticator/PasscodeGenerator.java?repo=android#212">PasscodeGenerator.java</a>
Verify a timeout code. The time... | [
"Verifier",
"-",
"To",
"be",
"used",
"only",
"on",
"the",
"server",
"side"
] | c7ac41324afa58515a5f749d87ea135e8e0ac16f | https://github.com/aerogear/aerogear-otp-java/blob/c7ac41324afa58515a5f749d87ea135e8e0ac16f/src/main/java/org/jboss/aerogear/security/otp/Totp.java#L97-L111 | train |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/CompoundIteratorImpl.java | CompoundIteratorImpl.reattach | private void reattach(HeapElement el) {
if (el.shift()) {
queue.add(el);
} else if (el.inclusion) {
/*
* If we have no live inclusions, then the rest are exclusions which
* we can safely discard.
*/
if (--nInclusionsRemaining == 0) {
queue.clear();
}
}
} | java | private void reattach(HeapElement el) {
if (el.shift()) {
queue.add(el);
} else if (el.inclusion) {
/*
* If we have no live inclusions, then the rest are exclusions which
* we can safely discard.
*/
if (--nInclusionsRemaining == 0) {
queue.clear();
}
}
} | [
"private",
"void",
"reattach",
"(",
"HeapElement",
"el",
")",
"{",
"if",
"(",
"el",
".",
"shift",
"(",
")",
")",
"{",
"queue",
".",
"add",
"(",
"el",
")",
";",
"}",
"else",
"if",
"(",
"el",
".",
"inclusion",
")",
"{",
"/*\n\t\t\t * If we have no live... | If the given element's iterator has more data, then push back onto the
heap.
@param el the element to push back into the heap. | [
"If",
"the",
"given",
"element",
"s",
"iterator",
"has",
"more",
"data",
"then",
"push",
"back",
"onto",
"the",
"heap",
"."
] | 2e21350f85c13dfff52fdef98fdbebe2976fcf61 | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/CompoundIteratorImpl.java#L141-L153 | train |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/CompoundIteratorImpl.java | HeapElement.shift | boolean shift() {
if (!it.hasNext()) {
return false;
}
head = it.next();
comparable = DateValueComparison.comparable(head);
return true;
} | java | boolean shift() {
if (!it.hasNext()) {
return false;
}
head = it.next();
comparable = DateValueComparison.comparable(head);
return true;
} | [
"boolean",
"shift",
"(",
")",
"{",
"if",
"(",
"!",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"head",
"=",
"it",
".",
"next",
"(",
")",
";",
"comparable",
"=",
"DateValueComparison",
".",
"comparable",
"(",
"head",
")",
... | Discards the current element and move to the next.
@return true if there is a next element, false if not | [
"Discards",
"the",
"current",
"element",
"and",
"move",
"to",
"the",
"next",
"."
] | 2e21350f85c13dfff52fdef98fdbebe2976fcf61 | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/CompoundIteratorImpl.java#L257-L264 | train |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/IntSet.java | IntSet.toIntArray | int[] toIntArray() {
int[] out = new int[size()];
int a = 0, b = out.length;
for (int i = -1; (i = ints.nextSetBit(i + 1)) >= 0;) {
int n = decode(i);
if (n < 0) {
out[a++] = n;
} else {
out[--b] = n;
}
}
//if it contains -3, -1, 0, 1, 2, 4
//then out will be -1, -3, 4, 2, 1, 0
rever... | java | int[] toIntArray() {
int[] out = new int[size()];
int a = 0, b = out.length;
for (int i = -1; (i = ints.nextSetBit(i + 1)) >= 0;) {
int n = decode(i);
if (n < 0) {
out[a++] = n;
} else {
out[--b] = n;
}
}
//if it contains -3, -1, 0, 1, 2, 4
//then out will be -1, -3, 4, 2, 1, 0
rever... | [
"int",
"[",
"]",
"toIntArray",
"(",
")",
"{",
"int",
"[",
"]",
"out",
"=",
"new",
"int",
"[",
"size",
"(",
")",
"]",
";",
"int",
"a",
"=",
"0",
",",
"b",
"=",
"out",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"-",
"1",
";",
"(",
"... | Converts this set to a new integer array that is sorted in ascending
order.
@return the array (sorted in ascending order) | [
"Converts",
"this",
"set",
"to",
"a",
"new",
"integer",
"array",
"that",
"is",
"sorted",
"in",
"ascending",
"order",
"."
] | 2e21350f85c13dfff52fdef98fdbebe2976fcf61 | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/IntSet.java#L82-L100 | train |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/IntSet.java | IntSet.reverse | private static void reverse(int[] array, int start, int end) {
for (int i = start, j = end; i < --j; ++i) {
int t = array[i];
array[i] = array[j];
array[j] = t;
}
} | java | private static void reverse(int[] array, int start, int end) {
for (int i = start, j = end; i < --j; ++i) {
int t = array[i];
array[i] = array[j];
array[j] = t;
}
} | [
"private",
"static",
"void",
"reverse",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
",",
"j",
"=",
"end",
";",
"i",
"<",
"--",
"j",
";",
"++",
"i",
")",
"{",
"int",
... | Reverses an array.
@param array the array
@param start the index to start at
@param end the index to end at | [
"Reverses",
"an",
"array",
"."
] | 2e21350f85c13dfff52fdef98fdbebe2976fcf61 | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/IntSet.java#L126-L132 | train |
mangstadt/biweekly | src/main/java/biweekly/io/ParseContext.java | ParseContext.addTimezonedDate | public void addTimezonedDate(String tzid, ICalProperty property, ICalDate date) {
timezonedDates.put(tzid, new TimezonedDate(date, property));
} | java | public void addTimezonedDate(String tzid, ICalProperty property, ICalDate date) {
timezonedDates.put(tzid, new TimezonedDate(date, property));
} | [
"public",
"void",
"addTimezonedDate",
"(",
"String",
"tzid",
",",
"ICalProperty",
"property",
",",
"ICalDate",
"date",
")",
"{",
"timezonedDates",
".",
"put",
"(",
"tzid",
",",
"new",
"TimezonedDate",
"(",
"date",
",",
"property",
")",
")",
";",
"}"
] | Keeps track of a date-time property value that uses a timezone so it can
be parsed later. Timezones cannot be handled until the entire iCalendar
object has been parsed.
@param tzid the timezone ID (TZID parameter)
@param property the property
@param date the date object that was assigned to the property object | [
"Keeps",
"track",
"of",
"a",
"date",
"-",
"time",
"property",
"value",
"that",
"uses",
"a",
"timezone",
"so",
"it",
"can",
"be",
"parsed",
"later",
".",
"Timezones",
"cannot",
"be",
"handled",
"until",
"the",
"entire",
"iCalendar",
"object",
"has",
"been",... | 2e21350f85c13dfff52fdef98fdbebe2976fcf61 | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/ParseContext.java#L133-L135 | train |
mangstadt/biweekly | src/main/java/biweekly/property/DateOrDateTimeProperty.java | DateOrDateTimeProperty.setValue | public void setValue(Date value, boolean hasTime) {
setValue((value == null) ? null : new ICalDate(value, hasTime));
} | java | public void setValue(Date value, boolean hasTime) {
setValue((value == null) ? null : new ICalDate(value, hasTime));
} | [
"public",
"void",
"setValue",
"(",
"Date",
"value",
",",
"boolean",
"hasTime",
")",
"{",
"setValue",
"(",
"(",
"value",
"==",
"null",
")",
"?",
"null",
":",
"new",
"ICalDate",
"(",
"value",
",",
"hasTime",
")",
")",
";",
"}"
] | Sets the date-time value.
@param value the date-time value
@param hasTime true if the value has a time component, false if it is
strictly a date | [
"Sets",
"the",
"date",
"-",
"time",
"value",
"."
] | 2e21350f85c13dfff52fdef98fdbebe2976fcf61 | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/property/DateOrDateTimeProperty.java#L78-L80 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.