id int32 0 165k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
106,900 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/CrawlFrontier.java | CrawlFrontier.feedRequest | public void feedRequest(final CrawlRequest request, final boolean isCrawlSeed) {
if (config.isOffsiteRequestFilteringEnabled()) {
boolean inCrawlDomain = false;
for (CrawlDomain allowedCrawlDomain : config.getAllowedCrawlDomains()) {
if (allowedCrawlDomain.contains(... | java | public void feedRequest(final CrawlRequest request, final boolean isCrawlSeed) {
if (config.isOffsiteRequestFilteringEnabled()) {
boolean inCrawlDomain = false;
for (CrawlDomain allowedCrawlDomain : config.getAllowedCrawlDomains()) {
if (allowedCrawlDomain.contains(... | [
"public",
"void",
"feedRequest",
"(",
"final",
"CrawlRequest",
"request",
",",
"final",
"boolean",
"isCrawlSeed",
")",
"{",
"if",
"(",
"config",
".",
"isOffsiteRequestFilteringEnabled",
"(",
")",
")",
"{",
"boolean",
"inCrawlDomain",
"=",
"false",
";",
"for",
... | Feeds a crawl request to the frontier.
@param request the crawl request
@param isCrawlSeed indicates if the request is a crawl seed | [
"Feeds",
"a",
"crawl",
"request",
"to",
"the",
"frontier",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/CrawlFrontier.java#L70-L112 |
106,901 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/CrawlFrontier.java | CrawlFrontier.createFingerprintForUrl | private static String createFingerprintForUrl(final URI url) {
StringBuilder truncatedUrl = new StringBuilder(url.getHost());
String path = url.getPath();
if (path != null) {
truncatedUrl.append(path);
}
String query = url.getQuery();
if (query != n... | java | private static String createFingerprintForUrl(final URI url) {
StringBuilder truncatedUrl = new StringBuilder(url.getHost());
String path = url.getPath();
if (path != null) {
truncatedUrl.append(path);
}
String query = url.getQuery();
if (query != n... | [
"private",
"static",
"String",
"createFingerprintForUrl",
"(",
"final",
"URI",
"url",
")",
"{",
"StringBuilder",
"truncatedUrl",
"=",
"new",
"StringBuilder",
"(",
"url",
".",
"getHost",
"(",
")",
")",
";",
"String",
"path",
"=",
"url",
".",
"getPath",
"(",
... | Creates the fingerprint of the given URL. If the URL contains query parameters, it sorts
them. This way URLs with different order of query parameters get the same fingerprint.
@param url the URL for which the fingerprint is created
@return the fingerprint of the URL | [
"Creates",
"the",
"fingerprint",
"of",
"the",
"given",
"URL",
".",
"If",
"the",
"URL",
"contains",
"query",
"parameters",
"it",
"sorts",
"them",
".",
"This",
"way",
"URLs",
"with",
"different",
"order",
"of",
"query",
"parameters",
"get",
"the",
"same",
"f... | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/CrawlFrontier.java#L141-L162 |
106,902 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/CrawlFrontier.java | CrawlFrontier.createPriorityQueue | @SuppressWarnings("checkstyle:MissingSwitchDefault")
private PriorityQueue<CrawlCandidate> createPriorityQueue() {
Function crawlDepthGetter
= (Function<CrawlCandidate, Integer> & Serializable) CrawlCandidate::getCrawlDepth;
Function priorityGetter
= (Function<Cr... | java | @SuppressWarnings("checkstyle:MissingSwitchDefault")
private PriorityQueue<CrawlCandidate> createPriorityQueue() {
Function crawlDepthGetter
= (Function<CrawlCandidate, Integer> & Serializable) CrawlCandidate::getCrawlDepth;
Function priorityGetter
= (Function<Cr... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:MissingSwitchDefault\"",
")",
"private",
"PriorityQueue",
"<",
"CrawlCandidate",
">",
"createPriorityQueue",
"(",
")",
"{",
"Function",
"crawlDepthGetter",
"=",
"(",
"Function",
"<",
"CrawlCandidate",
",",
"Integer",
">",
"&... | Creates a priority queue using the strategy specified in the configuration.
@return the priority queue using the strategy specified in the configuration | [
"Creates",
"a",
"priority",
"queue",
"using",
"the",
"strategy",
"specified",
"in",
"the",
"configuration",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/CrawlFrontier.java#L169-L191 |
106,903 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/event/EventCallbackManager.java | EventCallbackManager.setDefaultEventCallback | public <T extends EventObject> void setDefaultEventCallback(
final CrawlEvent event,
final Consumer<T> callback) {
defaultCallbacks.put(event, callback);
} | java | public <T extends EventObject> void setDefaultEventCallback(
final CrawlEvent event,
final Consumer<T> callback) {
defaultCallbacks.put(event, callback);
} | [
"public",
"<",
"T",
"extends",
"EventObject",
">",
"void",
"setDefaultEventCallback",
"(",
"final",
"CrawlEvent",
"event",
",",
"final",
"Consumer",
"<",
"T",
">",
"callback",
")",
"{",
"defaultCallbacks",
".",
"put",
"(",
"event",
",",
"callback",
")",
";",... | Sets the default callback for the specific event.
@param <T> the type of the input to the operation
@param event the event for which the callback should be invoked
@param callback the operation to be performed | [
"Sets",
"the",
"default",
"callback",
"for",
"the",
"specific",
"event",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/event/EventCallbackManager.java#L55-L59 |
106,904 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/event/EventCallbackManager.java | EventCallbackManager.addCustomEventCallback | public void addCustomEventCallback(
final CrawlEvent event,
final PatternMatchingCallback callback) {
customCallbacks.computeIfAbsent(event, key -> new ArrayList<>()).add(callback);
} | java | public void addCustomEventCallback(
final CrawlEvent event,
final PatternMatchingCallback callback) {
customCallbacks.computeIfAbsent(event, key -> new ArrayList<>()).add(callback);
} | [
"public",
"void",
"addCustomEventCallback",
"(",
"final",
"CrawlEvent",
"event",
",",
"final",
"PatternMatchingCallback",
"callback",
")",
"{",
"customCallbacks",
".",
"computeIfAbsent",
"(",
"event",
",",
"key",
"->",
"new",
"ArrayList",
"<>",
"(",
")",
")",
".... | Associates a pattern matching callback with the specific event.
@param event the event for which the callback should be invoked
@param callback the pattern matching callback to invoke | [
"Associates",
"a",
"pattern",
"matching",
"callback",
"with",
"the",
"specific",
"event",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/event/EventCallbackManager.java#L67-L71 |
106,905 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/event/EventCallbackManager.java | EventCallbackManager.call | public <T extends EventObject> void call(final CrawlEvent event, final T eventObject) {
if (!customCallbacks.containsKey(event)) {
((Consumer<T>) defaultCallbacks.get(event)).accept(eventObject);
return;
}
String requestUrl = eventObject.getCrawlCandidate().getRequestUrl... | java | public <T extends EventObject> void call(final CrawlEvent event, final T eventObject) {
if (!customCallbacks.containsKey(event)) {
((Consumer<T>) defaultCallbacks.get(event)).accept(eventObject);
return;
}
String requestUrl = eventObject.getCrawlCandidate().getRequestUrl... | [
"public",
"<",
"T",
"extends",
"EventObject",
">",
"void",
"call",
"(",
"final",
"CrawlEvent",
"event",
",",
"final",
"T",
"eventObject",
")",
"{",
"if",
"(",
"!",
"customCallbacks",
".",
"containsKey",
"(",
"event",
")",
")",
"{",
"(",
"(",
"Consumer",
... | Invokes the default callback for the specific event, if no custom callbacks are registered
for it. Otherwise, it calls all the associated callbacks whose pattern matches the URL of the
request.
@param <T> the type of the input to the operation
@param event the event for which the callback should be invok... | [
"Invokes",
"the",
"default",
"callback",
"for",
"the",
"specific",
"event",
"if",
"no",
"custom",
"callbacks",
"are",
"registered",
"for",
"it",
".",
"Otherwise",
"it",
"calls",
"all",
"the",
"associated",
"callbacks",
"whose",
"pattern",
"matches",
"the",
"UR... | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/event/EventCallbackManager.java#L82-L102 |
106,906 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.start | private void start(final WebDriver webDriver, final boolean isResuming) {
try {
Validate.validState(isStopped, "The crawler is already running.");
this.webDriver = Validate.notNull(webDriver, "The webdriver cannot be null.");
// If the crawl delay strategy is set to ada... | java | private void start(final WebDriver webDriver, final boolean isResuming) {
try {
Validate.validState(isStopped, "The crawler is already running.");
this.webDriver = Validate.notNull(webDriver, "The webdriver cannot be null.");
// If the crawl delay strategy is set to ada... | [
"private",
"void",
"start",
"(",
"final",
"WebDriver",
"webDriver",
",",
"final",
"boolean",
"isResuming",
")",
"{",
"try",
"{",
"Validate",
".",
"validState",
"(",
"isStopped",
",",
"\"The crawler is already running.\"",
")",
";",
"this",
".",
"webDriver",
"=",... | Performs initialization and runs the crawler.
@param isResuming indicates if a previously saved state is to be resumed | [
"Performs",
"initialization",
"and",
"runs",
"the",
"crawler",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L151-L187 |
106,907 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.saveState | public final void saveState(final OutputStream outStream) {
Validate.validState(crawlFrontier != null, "Cannot save state at this point.");
CrawlerState state = new CrawlerState();
state.putStateObject(config);
state.putStateObject(crawlFrontier);
SerializationUtils.seri... | java | public final void saveState(final OutputStream outStream) {
Validate.validState(crawlFrontier != null, "Cannot save state at this point.");
CrawlerState state = new CrawlerState();
state.putStateObject(config);
state.putStateObject(crawlFrontier);
SerializationUtils.seri... | [
"public",
"final",
"void",
"saveState",
"(",
"final",
"OutputStream",
"outStream",
")",
"{",
"Validate",
".",
"validState",
"(",
"crawlFrontier",
"!=",
"null",
",",
"\"Cannot save state at this point.\"",
")",
";",
"CrawlerState",
"state",
"=",
"new",
"CrawlerState"... | Saves the current state of the crawler to the given output stream.
@param outStream the output stream | [
"Saves",
"the",
"current",
"state",
"of",
"the",
"crawler",
"to",
"the",
"given",
"output",
"stream",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L194-L202 |
106,908 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.registerCustomEventCallback | protected final void registerCustomEventCallback(
final CrawlEvent event,
final PatternMatchingCallback callback) {
Validate.notNull(event, "The event cannot be null.");
Validate.notNull(callback, "The callback cannot be null.");
callbackManager.addCustomEventCallb... | java | protected final void registerCustomEventCallback(
final CrawlEvent event,
final PatternMatchingCallback callback) {
Validate.notNull(event, "The event cannot be null.");
Validate.notNull(callback, "The callback cannot be null.");
callbackManager.addCustomEventCallb... | [
"protected",
"final",
"void",
"registerCustomEventCallback",
"(",
"final",
"CrawlEvent",
"event",
",",
"final",
"PatternMatchingCallback",
"callback",
")",
"{",
"Validate",
".",
"notNull",
"(",
"event",
",",
"\"The event cannot be null.\"",
")",
";",
"Validate",
".",
... | Registers an operation which is invoked when the specific event occurs and the provided
pattern matches the request URL.
@param event the event for which the callback should be triggered
@param callback the pattern matching callback to invoke | [
"Registers",
"an",
"operation",
"which",
"is",
"invoked",
"when",
"the",
"specific",
"event",
"occurs",
"and",
"the",
"provided",
"pattern",
"matches",
"the",
"request",
"URL",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L231-L238 |
106,909 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.crawl | protected final void crawl(final CrawlRequest request) {
Validate.validState(!isStopped,
"The crawler is not started. Maybe you meant to add this request as a crawl seed?");
Validate.validState(!isStopping, "Cannot add request when the crawler is stopping.");
Validate.notNull... | java | protected final void crawl(final CrawlRequest request) {
Validate.validState(!isStopped,
"The crawler is not started. Maybe you meant to add this request as a crawl seed?");
Validate.validState(!isStopping, "Cannot add request when the crawler is stopping.");
Validate.notNull... | [
"protected",
"final",
"void",
"crawl",
"(",
"final",
"CrawlRequest",
"request",
")",
"{",
"Validate",
".",
"validState",
"(",
"!",
"isStopped",
",",
"\"The crawler is not started. Maybe you meant to add this request as a crawl seed?\"",
")",
";",
"Validate",
".",
"validSt... | Feeds a crawl request to the crawler. The crawler should be running, otherwise the request
has to be added as a crawl seed instead.
@param request the crawl request | [
"Feeds",
"a",
"crawl",
"request",
"to",
"the",
"crawler",
".",
"The",
"crawler",
"should",
"be",
"running",
"otherwise",
"the",
"request",
"has",
"to",
"be",
"added",
"as",
"a",
"crawl",
"seed",
"instead",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L257-L264 |
106,910 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.downloadFile | protected final void downloadFile(final URI source, final File destination) throws IOException {
Validate.validState(!isStopped, "Cannot download file when the crawler is not started.");
Validate.validState(!isStopping, "Cannot download file when the crawler is stopping.");
Validate.notNull(s... | java | protected final void downloadFile(final URI source, final File destination) throws IOException {
Validate.validState(!isStopped, "Cannot download file when the crawler is not started.");
Validate.validState(!isStopping, "Cannot download file when the crawler is stopping.");
Validate.notNull(s... | [
"protected",
"final",
"void",
"downloadFile",
"(",
"final",
"URI",
"source",
",",
"final",
"File",
"destination",
")",
"throws",
"IOException",
"{",
"Validate",
".",
"validState",
"(",
"!",
"isStopped",
",",
"\"Cannot download file when the crawler is not started.\"",
... | Downloads the file specified by the URL.
@param source the source URL
@param destination the destination file
@throws IOException if an I/O error occurs while downloading the file | [
"Downloads",
"the",
"file",
"specified",
"by",
"the",
"URL",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L284-L297 |
106,911 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.run | private void run() {
onStart();
while (!isStopping && crawlFrontier.hasNextCandidate()) {
CrawlCandidate currentCandidate = crawlFrontier.getNextCandidate();
String candidateUrl = currentCandidate.getRequestUrl().toString();
HttpClientContext context = HttpClie... | java | private void run() {
onStart();
while (!isStopping && crawlFrontier.hasNextCandidate()) {
CrawlCandidate currentCandidate = crawlFrontier.getNextCandidate();
String candidateUrl = currentCandidate.getRequestUrl().toString();
HttpClientContext context = HttpClie... | [
"private",
"void",
"run",
"(",
")",
"{",
"onStart",
"(",
")",
";",
"while",
"(",
"!",
"isStopping",
"&&",
"crawlFrontier",
".",
"hasNextCandidate",
"(",
")",
")",
"{",
"CrawlCandidate",
"currentCandidate",
"=",
"crawlFrontier",
".",
"getNextCandidate",
"(",
... | Defines the workflow of the crawler. | [
"Defines",
"the",
"workflow",
"of",
"the",
"crawler",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L302-L369 |
106,912 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.createCrawlDelayMechanism | @SuppressWarnings("checkstyle:MissingSwitchDefault")
private CrawlDelayMechanism createCrawlDelayMechanism() {
switch (config.getCrawlDelayStrategy()) {
case FIXED:
return new FixedCrawlDelayMechanism(config);
case RANDOM:
return new RandomCrawlD... | java | @SuppressWarnings("checkstyle:MissingSwitchDefault")
private CrawlDelayMechanism createCrawlDelayMechanism() {
switch (config.getCrawlDelayStrategy()) {
case FIXED:
return new FixedCrawlDelayMechanism(config);
case RANDOM:
return new RandomCrawlD... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:MissingSwitchDefault\"",
")",
"private",
"CrawlDelayMechanism",
"createCrawlDelayMechanism",
"(",
")",
"{",
"switch",
"(",
"config",
".",
"getCrawlDelayStrategy",
"(",
")",
")",
"{",
"case",
"FIXED",
":",
"return",
"new",
... | Creates the crawl delay mechanism according to the configuration.
@return the created crawl delay mechanism | [
"Creates",
"the",
"crawl",
"delay",
"mechanism",
"according",
"to",
"the",
"configuration",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L376-L388 |
106,913 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.getHttpHeadResponse | private CloseableHttpResponse getHttpHeadResponse(
final String destinationUrl,
final HttpClientContext context) throws IOException {
HttpHead request = new HttpHead(destinationUrl);
return httpClient.execute(request, context);
} | java | private CloseableHttpResponse getHttpHeadResponse(
final String destinationUrl,
final HttpClientContext context) throws IOException {
HttpHead request = new HttpHead(destinationUrl);
return httpClient.execute(request, context);
} | [
"private",
"CloseableHttpResponse",
"getHttpHeadResponse",
"(",
"final",
"String",
"destinationUrl",
",",
"final",
"HttpClientContext",
"context",
")",
"throws",
"IOException",
"{",
"HttpHead",
"request",
"=",
"new",
"HttpHead",
"(",
"destinationUrl",
")",
";",
"retur... | Sends an HTTP HEAD request to the given URL and returns the response.
@param destinationUrl the destination URL
@return the HTTP HEAD response
@throws IOException if an error occurs while trying to fulfill the request | [
"Sends",
"an",
"HTTP",
"HEAD",
"request",
"to",
"the",
"given",
"URL",
"and",
"returns",
"the",
"response",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L399-L404 |
106,914 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.getFinalResponseUrl | private static String getFinalResponseUrl(
final HttpClientContext context,
final String candidateUrl) {
List<URI> redirectLocations = context.getRedirectLocations();
if (redirectLocations != null) {
return redirectLocations.get(redirectLocations.size() - 1).toSt... | java | private static String getFinalResponseUrl(
final HttpClientContext context,
final String candidateUrl) {
List<URI> redirectLocations = context.getRedirectLocations();
if (redirectLocations != null) {
return redirectLocations.get(redirectLocations.size() - 1).toSt... | [
"private",
"static",
"String",
"getFinalResponseUrl",
"(",
"final",
"HttpClientContext",
"context",
",",
"final",
"String",
"candidateUrl",
")",
"{",
"List",
"<",
"URI",
">",
"redirectLocations",
"=",
"context",
".",
"getRedirectLocations",
"(",
")",
";",
"if",
... | If the HTTP HEAD request was redirected, it returns the final redirected URL. If not, it
returns the original URL of the candidate.
@param context the current HTTP client context
@param candidateUrl the URL of the candidate
@return the final response URL | [
"If",
"the",
"HTTP",
"HEAD",
"request",
"was",
"redirected",
"it",
"returns",
"the",
"final",
"redirected",
"URL",
".",
"If",
"not",
"it",
"returns",
"the",
"original",
"URL",
"of",
"the",
"candidate",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L415-L424 |
106,915 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.handleRequestRedirect | private void handleRequestRedirect(
final CrawlCandidate currentCrawlCandidate,
final String redirectedUrl) {
CrawlRequestBuilder builder = new CrawlRequestBuilder(redirectedUrl)
.setPriority(currentCrawlCandidate.getPriority());
currentCrawlCandidate.getMeta... | java | private void handleRequestRedirect(
final CrawlCandidate currentCrawlCandidate,
final String redirectedUrl) {
CrawlRequestBuilder builder = new CrawlRequestBuilder(redirectedUrl)
.setPriority(currentCrawlCandidate.getPriority());
currentCrawlCandidate.getMeta... | [
"private",
"void",
"handleRequestRedirect",
"(",
"final",
"CrawlCandidate",
"currentCrawlCandidate",
",",
"final",
"String",
"redirectedUrl",
")",
"{",
"CrawlRequestBuilder",
"builder",
"=",
"new",
"CrawlRequestBuilder",
"(",
"redirectedUrl",
")",
".",
"setPriority",
"(... | Creates a crawl request for the redirected URL, feeds it to the crawler and calls the
appropriate event callback.
@param currentCrawlCandidate the current crawl candidate
@param redirectedUrl the URL of the redirected request | [
"Creates",
"a",
"crawl",
"request",
"for",
"the",
"redirected",
"URL",
"feeds",
"it",
"to",
"the",
"crawler",
"and",
"calls",
"the",
"appropriate",
"event",
"callback",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L457-L468 |
106,916 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.syncHttpClientCookies | private void syncHttpClientCookies() {
webDriver.manage()
.getCookies()
.stream()
.map(CookieConverter::convertToHttpClientCookie)
.forEach(cookieStore::addCookie);
} | java | private void syncHttpClientCookies() {
webDriver.manage()
.getCookies()
.stream()
.map(CookieConverter::convertToHttpClientCookie)
.forEach(cookieStore::addCookie);
} | [
"private",
"void",
"syncHttpClientCookies",
"(",
")",
"{",
"webDriver",
".",
"manage",
"(",
")",
".",
"getCookies",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"CookieConverter",
"::",
"convertToHttpClientCookie",
")",
".",
"forEach",
"(",
"cookieSto... | Copies all the Selenium cookies for the current domain to the HTTP client cookie store. | [
"Copies",
"all",
"the",
"Selenium",
"cookies",
"for",
"the",
"current",
"domain",
"to",
"the",
"HTTP",
"client",
"cookie",
"store",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L473-L479 |
106,917 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.performDelay | private void performDelay() {
try {
TimeUnit.MILLISECONDS.sleep(crawlDelayMechanism.getDelay());
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
isStopping = true;
}
} | java | private void performDelay() {
try {
TimeUnit.MILLISECONDS.sleep(crawlDelayMechanism.getDelay());
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
isStopping = true;
}
} | [
"private",
"void",
"performDelay",
"(",
")",
"{",
"try",
"{",
"TimeUnit",
".",
"MILLISECONDS",
".",
"sleep",
"(",
"crawlDelayMechanism",
".",
"getDelay",
"(",
")",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"Thread",
".",
"current... | Delays the next request. | [
"Delays",
"the",
"next",
"request",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L484-L491 |
106,918 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.onPageLoad | protected void onPageLoad(final PageLoadEvent event) {
LOGGER.log(Level.INFO, "onPageLoad: {0}", event.getCrawlCandidate().getRequestUrl());
} | java | protected void onPageLoad(final PageLoadEvent event) {
LOGGER.log(Level.INFO, "onPageLoad: {0}", event.getCrawlCandidate().getRequestUrl());
} | [
"protected",
"void",
"onPageLoad",
"(",
"final",
"PageLoadEvent",
"event",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"onPageLoad: {0}\"",
",",
"event",
".",
"getCrawlCandidate",
"(",
")",
".",
"getRequestUrl",
"(",
")",
")",
";",
"}... | Callback which gets called when the browser loads the page.
@param event the <code>PageLoadEvent</code> instance | [
"Callback",
"which",
"gets",
"called",
"when",
"the",
"browser",
"loads",
"the",
"page",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L505-L507 |
106,919 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.onNonHtmlContent | protected void onNonHtmlContent(final NonHtmlContentEvent event) {
LOGGER.log(Level.INFO, "onNonHtmlContent: {0}", event.getCrawlCandidate().getRequestUrl());
} | java | protected void onNonHtmlContent(final NonHtmlContentEvent event) {
LOGGER.log(Level.INFO, "onNonHtmlContent: {0}", event.getCrawlCandidate().getRequestUrl());
} | [
"protected",
"void",
"onNonHtmlContent",
"(",
"final",
"NonHtmlContentEvent",
"event",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"onNonHtmlContent: {0}\"",
",",
"event",
".",
"getCrawlCandidate",
"(",
")",
".",
"getRequestUrl",
"(",
")",
... | Callback which gets called when the content type is not HTML.
@param event the <code>NonHtmlContentEvent</code> instance | [
"Callback",
"which",
"gets",
"called",
"when",
"the",
"content",
"type",
"is",
"not",
"HTML",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L514-L516 |
106,920 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.onRequestError | protected void onRequestError(final RequestErrorEvent event) {
LOGGER.log(Level.INFO, "onRequestError: {0}", event.getCrawlCandidate().getRequestUrl());
} | java | protected void onRequestError(final RequestErrorEvent event) {
LOGGER.log(Level.INFO, "onRequestError: {0}", event.getCrawlCandidate().getRequestUrl());
} | [
"protected",
"void",
"onRequestError",
"(",
"final",
"RequestErrorEvent",
"event",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"onRequestError: {0}\"",
",",
"event",
".",
"getCrawlCandidate",
"(",
")",
".",
"getRequestUrl",
"(",
")",
")",... | Callback which gets called when a request error occurs.
@param event the <code>RequestErrorEvent</code> instance | [
"Callback",
"which",
"gets",
"called",
"when",
"a",
"request",
"error",
"occurs",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L523-L525 |
106,921 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.onRequestRedirect | protected void onRequestRedirect(final RequestRedirectEvent event) {
LOGGER.log(Level.INFO, "onRequestRedirect: {0} -> {1}",
new Object[]{
event.getCrawlCandidate().getRequestUrl(),
event.getRedirectedCrawlRequest().getRequestUrl()
});... | java | protected void onRequestRedirect(final RequestRedirectEvent event) {
LOGGER.log(Level.INFO, "onRequestRedirect: {0} -> {1}",
new Object[]{
event.getCrawlCandidate().getRequestUrl(),
event.getRedirectedCrawlRequest().getRequestUrl()
});... | [
"protected",
"void",
"onRequestRedirect",
"(",
"final",
"RequestRedirectEvent",
"event",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"onRequestRedirect: {0} -> {1}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"event",
".",
"getCrawlCandidate",
... | Callback which gets called when a request is redirected.
@param event the <code>RequestRedirectEvent</code> instance | [
"Callback",
"which",
"gets",
"called",
"when",
"a",
"request",
"is",
"redirected",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L532-L538 |
106,922 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.onPageLoadTimeout | protected void onPageLoadTimeout(final PageLoadTimeoutEvent event) {
LOGGER.log(Level.INFO, "onPageLoadTimeout: {0}", event.getCrawlCandidate().getRequestUrl());
} | java | protected void onPageLoadTimeout(final PageLoadTimeoutEvent event) {
LOGGER.log(Level.INFO, "onPageLoadTimeout: {0}", event.getCrawlCandidate().getRequestUrl());
} | [
"protected",
"void",
"onPageLoadTimeout",
"(",
"final",
"PageLoadTimeoutEvent",
"event",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"onPageLoadTimeout: {0}\"",
",",
"event",
".",
"getCrawlCandidate",
"(",
")",
".",
"getRequestUrl",
"(",
")... | Callback which gets called when the page does not load in the browser within the timeout
period.
@param event the <code>PageLoadTimeoutEvent</code> instance | [
"Callback",
"which",
"gets",
"called",
"when",
"the",
"page",
"does",
"not",
"load",
"in",
"the",
"browser",
"within",
"the",
"timeout",
"period",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L546-L548 |
106,923 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/CrawlDomain.java | CrawlDomain.contains | public boolean contains(final InternetDomainName domain) {
ImmutableList<String> otherDomainParts = domain.parts();
if (parts.size() > otherDomainParts.size()) {
return false;
}
otherDomainParts = otherDomainParts.reverse()
.subList(0, parts.size());
... | java | public boolean contains(final InternetDomainName domain) {
ImmutableList<String> otherDomainParts = domain.parts();
if (parts.size() > otherDomainParts.size()) {
return false;
}
otherDomainParts = otherDomainParts.reverse()
.subList(0, parts.size());
... | [
"public",
"boolean",
"contains",
"(",
"final",
"InternetDomainName",
"domain",
")",
"{",
"ImmutableList",
"<",
"String",
">",
"otherDomainParts",
"=",
"domain",
".",
"parts",
"(",
")",
";",
"if",
"(",
"parts",
".",
"size",
"(",
")",
">",
"otherDomainParts",
... | Indicates if this crawl domain contains the specific internet domain.
@param domain an immutable well-formed internet domain name
@return <code>true</code> if belongs, <code>false</code> otherwise | [
"Indicates",
"if",
"this",
"crawl",
"domain",
"contains",
"the",
"specific",
"internet",
"domain",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/CrawlDomain.java#L80-L92 |
106,924 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/CookieConverter.java | CookieConverter.convertToHttpClientCookie | public static BasicClientCookie convertToHttpClientCookie(final Cookie seleniumCookie) {
BasicClientCookie httpClientCookie
= new BasicClientCookie(seleniumCookie.getName(), seleniumCookie.getValue());
httpClientCookie.setDomain(seleniumCookie.getDomain());
httpClientCookie.setPa... | java | public static BasicClientCookie convertToHttpClientCookie(final Cookie seleniumCookie) {
BasicClientCookie httpClientCookie
= new BasicClientCookie(seleniumCookie.getName(), seleniumCookie.getValue());
httpClientCookie.setDomain(seleniumCookie.getDomain());
httpClientCookie.setPa... | [
"public",
"static",
"BasicClientCookie",
"convertToHttpClientCookie",
"(",
"final",
"Cookie",
"seleniumCookie",
")",
"{",
"BasicClientCookie",
"httpClientCookie",
"=",
"new",
"BasicClientCookie",
"(",
"seleniumCookie",
".",
"getName",
"(",
")",
",",
"seleniumCookie",
".... | Converts a Selenium cookie to a HTTP client one.
@param seleniumCookie the browser cookie to be converted
@return the converted HTTP client cookie | [
"Converts",
"a",
"Selenium",
"cookie",
"to",
"a",
"HTTP",
"client",
"one",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/CookieConverter.java#L39-L52 |
106,925 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/helper/UrlFinder.java | UrlFinder.findUrlsInPage | public List<String> findUrlsInPage(final PageLoadEvent event) {
Set<String> foundUrls = new HashSet<>();
// Find elements using the specified locating mechanisms
Set<WebElement> extractedElements = locatingMechanisms.stream()
.map(event.getWebDriver()::findElements)
... | java | public List<String> findUrlsInPage(final PageLoadEvent event) {
Set<String> foundUrls = new HashSet<>();
// Find elements using the specified locating mechanisms
Set<WebElement> extractedElements = locatingMechanisms.stream()
.map(event.getWebDriver()::findElements)
... | [
"public",
"List",
"<",
"String",
">",
"findUrlsInPage",
"(",
"final",
"PageLoadEvent",
"event",
")",
"{",
"Set",
"<",
"String",
">",
"foundUrls",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"// Find elements using the specified locating mechanisms",
"Set",
"<",
... | Returns a list of validated URLs found in the page's HTML source.
@param event the <code>PageLoadEvent</code> instance
@return the list of found URLs | [
"Returns",
"a",
"list",
"of",
"validated",
"URLs",
"found",
"in",
"the",
"page",
"s",
"HTML",
"source",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/helper/UrlFinder.java#L73-L94 |
106,926 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/helper/UrlFinder.java | UrlFinder.findUrlsInAttributeValue | private List<String> findUrlsInAttributeValue(final String attributeValue) {
List<String> foundUrls = new ArrayList<>();
urlPatterns.stream()
.map((Pattern urlPattern) -> urlPattern.matcher(attributeValue))
.forEach((Matcher urlPatternMatcher) -> {
wh... | java | private List<String> findUrlsInAttributeValue(final String attributeValue) {
List<String> foundUrls = new ArrayList<>();
urlPatterns.stream()
.map((Pattern urlPattern) -> urlPattern.matcher(attributeValue))
.forEach((Matcher urlPatternMatcher) -> {
wh... | [
"private",
"List",
"<",
"String",
">",
"findUrlsInAttributeValue",
"(",
"final",
"String",
"attributeValue",
")",
"{",
"List",
"<",
"String",
">",
"foundUrls",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"urlPatterns",
".",
"stream",
"(",
")",
".",
"map"... | Returns a list of validated URLs found in the attribute's value.
@param attributeValue the value of the attribute
@return the list of found URLs | [
"Returns",
"a",
"list",
"of",
"validated",
"URLs",
"found",
"in",
"the",
"attribute",
"s",
"value",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/helper/UrlFinder.java#L103-L119 |
106,927 | peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/internal/CrawlerState.java | CrawlerState.getStateObject | public <T extends Serializable> T getStateObject(final Class<T> stateObjectClass) {
return (T) stateObjects.get(stateObjectClass);
} | java | public <T extends Serializable> T getStateObject(final Class<T> stateObjectClass) {
return (T) stateObjects.get(stateObjectClass);
} | [
"public",
"<",
"T",
"extends",
"Serializable",
">",
"T",
"getStateObject",
"(",
"final",
"Class",
"<",
"T",
">",
"stateObjectClass",
")",
"{",
"return",
"(",
"T",
")",
"stateObjects",
".",
"get",
"(",
"stateObjectClass",
")",
";",
"}"
] | Returns the state object specified by its class.
@param <T> the type of the state object
@param stateObjectClass the runtime class of the state object
@return the state object specified by its class | [
"Returns",
"the",
"state",
"object",
"specified",
"by",
"its",
"class",
"."
] | 10ed6f82c90fa1dccd684382b68b5d77a37652c0 | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/internal/CrawlerState.java#L57-L59 |
106,928 | pwittchen/kirai | src/main/java/com/github/pwittchen/kirai/library/Preconditions.java | Preconditions.checkNotEmpty | public static void checkNotEmpty(CharSequence str, String message) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException(message);
}
} | java | public static void checkNotEmpty(CharSequence str, String message) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"checkNotEmpty",
"(",
"CharSequence",
"str",
",",
"String",
"message",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"mess... | Throws an exception with a message, when CharSequence is null
@param str is a CharSequence to examine
@param message for IllegalArgumentException | [
"Throws",
"an",
"exception",
"with",
"a",
"message",
"when",
"CharSequence",
"is",
"null"
] | 0b8080a1f28c1e068a00e5bd2804dc3d2fb3c334 | https://github.com/pwittchen/kirai/blob/0b8080a1f28c1e068a00e5bd2804dc3d2fb3c334/src/main/java/com/github/pwittchen/kirai/library/Preconditions.java#L25-L29 |
106,929 | pwittchen/kirai | src/main/java/com/github/pwittchen/kirai/library/Kirai.java | Kirai.format | public CharSequence format(Formatter formatter) {
CharSequence input = format();
return formatter.format(String.valueOf(input));
} | java | public CharSequence format(Formatter formatter) {
CharSequence input = format();
return formatter.format(String.valueOf(input));
} | [
"public",
"CharSequence",
"format",
"(",
"Formatter",
"formatter",
")",
"{",
"CharSequence",
"input",
"=",
"format",
"(",
")",
";",
"return",
"formatter",
".",
"format",
"(",
"String",
".",
"valueOf",
"(",
"input",
")",
")",
";",
"}"
] | Returns CharSequence formatted with custom formatter implementation
@param formatter implementation
@return formatted CharSequence | [
"Returns",
"CharSequence",
"formatted",
"with",
"custom",
"formatter",
"implementation"
] | 0b8080a1f28c1e068a00e5bd2804dc3d2fb3c334 | https://github.com/pwittchen/kirai/blob/0b8080a1f28c1e068a00e5bd2804dc3d2fb3c334/src/main/java/com/github/pwittchen/kirai/library/Kirai.java#L123-L126 |
106,930 | pwittchen/kirai | src/main/java/com/github/pwittchen/kirai/library/Kirai.java | Kirai.format | public CharSequence format() {
if (pieces.isEmpty()) {
return input;
}
String target;
for (Piece piece : pieces) {
target = BRACE_START + piece.getKey() + BRACE_END;
input = input.replace(target, String.valueOf(piece.getValue()));
}
return input;
} | java | public CharSequence format() {
if (pieces.isEmpty()) {
return input;
}
String target;
for (Piece piece : pieces) {
target = BRACE_START + piece.getKey() + BRACE_END;
input = input.replace(target, String.valueOf(piece.getValue()));
}
return input;
} | [
"public",
"CharSequence",
"format",
"(",
")",
"{",
"if",
"(",
"pieces",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"input",
";",
"}",
"String",
"target",
";",
"for",
"(",
"Piece",
"piece",
":",
"pieces",
")",
"{",
"target",
"=",
"BRACE_START",
"+"... | Returns formatted CharSequence without additional operations
@return formatted CharSequence | [
"Returns",
"formatted",
"CharSequence",
"without",
"additional",
"operations"
] | 0b8080a1f28c1e068a00e5bd2804dc3d2fb3c334 | https://github.com/pwittchen/kirai/blob/0b8080a1f28c1e068a00e5bd2804dc3d2fb3c334/src/main/java/com/github/pwittchen/kirai/library/Kirai.java#L133-L146 |
106,931 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.setHref | public EntityBuilder setHref(String href) {
if(StringUtils.isBlank(href)) {
throw new IllegalArgumentException("href cannot be null or empty.");
}
addStep("setHref", new Object[] { href });
isEmbedded = true;
return this;
} | java | public EntityBuilder setHref(String href) {
if(StringUtils.isBlank(href)) {
throw new IllegalArgumentException("href cannot be null or empty.");
}
addStep("setHref", new Object[] { href });
isEmbedded = true;
return this;
} | [
"public",
"EntityBuilder",
"setHref",
"(",
"String",
"href",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"href",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"href cannot be null or empty.\"",
")",
";",
"}",
"addStep",
"(",
"\... | Set the href of the entity to be built. This method can be called many times
but only the value of the last call is used in the built entity. This is a required property if this entity is an embedded link, as specified
by the Siren specification. If set then this entity will be considered an embedded link.
@param href ... | [
"Set",
"the",
"href",
"of",
"the",
"entity",
"to",
"be",
"built",
".",
"This",
"method",
"can",
"be",
"called",
"many",
"times",
"but",
"only",
"the",
"value",
"of",
"the",
"last",
"call",
"is",
"used",
"in",
"the",
"built",
"entity",
".",
"This",
"i... | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L145-L152 |
106,932 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.addProperty | public EntityBuilder addProperty(String name, Object value) {
if(StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be null or empty.");
}
addStep("_addProperty", new Object[] { name, value }, new Class<?>[]{String.class, Object.class}, true);
return this;
... | java | public EntityBuilder addProperty(String name, Object value) {
if(StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be null or empty.");
}
addStep("_addProperty", new Object[] { name, value }, new Class<?>[]{String.class, Object.class}, true);
return this;
... | [
"public",
"EntityBuilder",
"addProperty",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"name cannot be null or empty.\"",
")",
";... | Adds a single property to the entity to be built.
Properties are optional according to the Siren specification.
@param name cannot be <code>null</code> or empty.
@param value may be <code>null</code> or empty.
@return <code>this</code> builder, never <code>null</code>. | [
"Adds",
"a",
"single",
"property",
"to",
"the",
"entity",
"to",
"be",
"built",
".",
"Properties",
"are",
"optional",
"according",
"to",
"the",
"Siren",
"specification",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L161-L167 |
106,933 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.addProperties | public EntityBuilder addProperties(Map<String, Object> properties) {
if(MapUtils.isEmpty(properties)) {
throw new IllegalArgumentException("properties cannot be null or empty.");
}
for (String key : properties.keySet()) {
addProperty(key, properties.get(key));
}
... | java | public EntityBuilder addProperties(Map<String, Object> properties) {
if(MapUtils.isEmpty(properties)) {
throw new IllegalArgumentException("properties cannot be null or empty.");
}
for (String key : properties.keySet()) {
addProperty(key, properties.get(key));
}
... | [
"public",
"EntityBuilder",
"addProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"MapUtils",
".",
"isEmpty",
"(",
"properties",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"properties cannot be n... | Adds a map of properties to the entity to be built.
Properties are optional according to the Siren specification.
@param properties cannot be <code>null</code>.
@return <code>this</code> builder, never <code>null</code>. | [
"Adds",
"a",
"map",
"of",
"properties",
"to",
"the",
"entity",
"to",
"be",
"built",
".",
"Properties",
"are",
"optional",
"according",
"to",
"the",
"Siren",
"specification",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L175-L183 |
106,934 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.addSubEntity | public EntityBuilder addSubEntity(Entity subEntity) {
if(subEntity == null) {
throw new IllegalArgumentException("subEntity cannot be null.");
}
addStep("_addEntity", new Object[] { subEntity }, true);
return this;
} | java | public EntityBuilder addSubEntity(Entity subEntity) {
if(subEntity == null) {
throw new IllegalArgumentException("subEntity cannot be null.");
}
addStep("_addEntity", new Object[] { subEntity }, true);
return this;
} | [
"public",
"EntityBuilder",
"addSubEntity",
"(",
"Entity",
"subEntity",
")",
"{",
"if",
"(",
"subEntity",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"subEntity cannot be null.\"",
")",
";",
"}",
"addStep",
"(",
"\"_addEntity\"",
",",... | Add a sub entity to the entity to be built.
Sub entities are optional according to the Siren specification.
@param subEntity cannot be <code>null</code>.
@return <code>this</code> builder, never <code>null</code>. | [
"Add",
"a",
"sub",
"entity",
"to",
"the",
"entity",
"to",
"be",
"built",
".",
"Sub",
"entities",
"are",
"optional",
"according",
"to",
"the",
"Siren",
"specification",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L191-L197 |
106,935 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.addSubEntities | public EntityBuilder addSubEntities(List<Entity> entities) {
if(entities == null) {
throw new IllegalArgumentException("entities cannot be null.");
}
for (Entity entity : entities) {
addSubEntity(entity);
}
return this;
} | java | public EntityBuilder addSubEntities(List<Entity> entities) {
if(entities == null) {
throw new IllegalArgumentException("entities cannot be null.");
}
for (Entity entity : entities) {
addSubEntity(entity);
}
return this;
} | [
"public",
"EntityBuilder",
"addSubEntities",
"(",
"List",
"<",
"Entity",
">",
"entities",
")",
"{",
"if",
"(",
"entities",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"entities cannot be null.\"",
")",
";",
"}",
"for",
"(",
"Enti... | Add a list of sub entities to the entity to be built.
Sub entities are optional according to the Siren specification.
@param entities cannot be <code>null</code>, may be empty.
@return <code>this</code> builder, never <code>null</code>. | [
"Add",
"a",
"list",
"of",
"sub",
"entities",
"to",
"the",
"entity",
"to",
"be",
"built",
".",
"Sub",
"entities",
"are",
"optional",
"according",
"to",
"the",
"Siren",
"specification",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L205-L213 |
106,936 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.addLink | public EntityBuilder addLink(Link link) {
if(link == null) {
throw new IllegalArgumentException("link cannot be null.");
}
addStep("_addLink", new Object[] { link }, true);
return this;
} | java | public EntityBuilder addLink(Link link) {
if(link == null) {
throw new IllegalArgumentException("link cannot be null.");
}
addStep("_addLink", new Object[] { link }, true);
return this;
} | [
"public",
"EntityBuilder",
"addLink",
"(",
"Link",
"link",
")",
"{",
"if",
"(",
"link",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"link cannot be null.\"",
")",
";",
"}",
"addStep",
"(",
"\"_addLink\"",
",",
"new",
"Object",
... | Add a link to the entity to be built. Links are optional according to the Siren specification, however
an entity should always have a 'self' link to be considered HATEAOS compliant.
@param link cannot be <code>null</code> or empty.
@return <code>this</code> builder, never <code>null</code>. | [
"Add",
"a",
"link",
"to",
"the",
"entity",
"to",
"be",
"built",
".",
"Links",
"are",
"optional",
"according",
"to",
"the",
"Siren",
"specification",
"however",
"an",
"entity",
"should",
"always",
"have",
"a",
"self",
"link",
"to",
"be",
"considered",
"HATE... | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L221-L227 |
106,937 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.addLinks | public EntityBuilder addLinks(List<Link> links) {
if(links == null) {
throw new IllegalArgumentException("links cannot be null.");
}
for (Link link : links) {
addLink(link);
}
return this;
} | java | public EntityBuilder addLinks(List<Link> links) {
if(links == null) {
throw new IllegalArgumentException("links cannot be null.");
}
for (Link link : links) {
addLink(link);
}
return this;
} | [
"public",
"EntityBuilder",
"addLinks",
"(",
"List",
"<",
"Link",
">",
"links",
")",
"{",
"if",
"(",
"links",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"links cannot be null.\"",
")",
";",
"}",
"for",
"(",
"Link",
"link",
":... | Adds list of links to the entity to be built. Links are optional according to the Siren specification, however
an entity should always have a 'self' link to be considered HATEAOS compliant.
@param links cannot be <code>null</code>, may be empty.
@return <code>this</code> builder, never <code>null</code>. | [
"Adds",
"list",
"of",
"links",
"to",
"the",
"entity",
"to",
"be",
"built",
".",
"Links",
"are",
"optional",
"according",
"to",
"the",
"Siren",
"specification",
"however",
"an",
"entity",
"should",
"always",
"have",
"a",
"self",
"link",
"to",
"be",
"conside... | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L235-L243 |
106,938 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.addAction | public EntityBuilder addAction(Action action) {
if(action == null) {
throw new IllegalArgumentException("action cannot be null.");
}
addStep("_addAction", new Object[] { action }, true);
return this;
} | java | public EntityBuilder addAction(Action action) {
if(action == null) {
throw new IllegalArgumentException("action cannot be null.");
}
addStep("_addAction", new Object[] { action }, true);
return this;
} | [
"public",
"EntityBuilder",
"addAction",
"(",
"Action",
"action",
")",
"{",
"if",
"(",
"action",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"action cannot be null.\"",
")",
";",
"}",
"addStep",
"(",
"\"_addAction\"",
",",
"new",
... | Add an action to the entity to be built. Actions are options according to the Siren specification.
@param action cannot be <code>null</code>.
@return <code>this</code> builder, never <code>null</code>. | [
"Add",
"an",
"action",
"to",
"the",
"entity",
"to",
"be",
"built",
".",
"Actions",
"are",
"options",
"according",
"to",
"the",
"Siren",
"specification",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L250-L256 |
106,939 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.addActions | public EntityBuilder addActions(List<Action> actions) {
if(actions == null) {
throw new IllegalArgumentException("actions cannot be null.");
}
for (Action action : actions) {
addAction(action);
}
return this;
} | java | public EntityBuilder addActions(List<Action> actions) {
if(actions == null) {
throw new IllegalArgumentException("actions cannot be null.");
}
for (Action action : actions) {
addAction(action);
}
return this;
} | [
"public",
"EntityBuilder",
"addActions",
"(",
"List",
"<",
"Action",
">",
"actions",
")",
"{",
"if",
"(",
"actions",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"actions cannot be null.\"",
")",
";",
"}",
"for",
"(",
"Action",
... | Add a list of actions to the entity to be built. Actions are options according to the Siren specification.
@param actions cannot be <code>null</code>, may be empty.
@return <code>this</code> builder, never <code>null</code>. | [
"Add",
"a",
"list",
"of",
"actions",
"to",
"the",
"entity",
"to",
"be",
"built",
".",
"Actions",
"are",
"options",
"according",
"to",
"the",
"Siren",
"specification",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L263-L271 |
106,940 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java | EntityBuilder.validateSubEntities | private void validateSubEntities(Entity obj) {
// Validate that all sub entities have a "rel" set.
String relRequired = "Sub entities are required to have a <rel> property set.";
String hrefReqForEmbed = "Sub entities that are embedded links are required to have a <href> property set.";
... | java | private void validateSubEntities(Entity obj) {
// Validate that all sub entities have a "rel" set.
String relRequired = "Sub entities are required to have a <rel> property set.";
String hrefReqForEmbed = "Sub entities that are embedded links are required to have a <href> property set.";
... | [
"private",
"void",
"validateSubEntities",
"(",
"Entity",
"obj",
")",
"{",
"// Validate that all sub entities have a \"rel\" set.\r",
"String",
"relRequired",
"=",
"\"Sub entities are required to have a <rel> property set.\"",
";",
"String",
"hrefReqForEmbed",
"=",
"\"Sub entities t... | Validate sub entities ensuring the existence of a relationship and if an embedded link then ensure the
existence of an href.
@param obj assumed not <code>null</code>. | [
"Validate",
"sub",
"entities",
"ensuring",
"the",
"existence",
"of",
"a",
"relationship",
"and",
"if",
"an",
"embedded",
"link",
"then",
"ensure",
"the",
"existence",
"of",
"an",
"href",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L324-L338 |
106,941 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleSetProperties | private void handleSetProperties(Object obj, Class<?> clazz, Entity entity, List<ReflectedInfo> fieldInfo)
throws Siren4JConversionException {
if (!MapUtils.isEmpty(entity.getProperties())) {
for (String key : entity.getProperties().keySet()) {
if (key.startsWith(Sire... | java | private void handleSetProperties(Object obj, Class<?> clazz, Entity entity, List<ReflectedInfo> fieldInfo)
throws Siren4JConversionException {
if (!MapUtils.isEmpty(entity.getProperties())) {
for (String key : entity.getProperties().keySet()) {
if (key.startsWith(Sire... | [
"private",
"void",
"handleSetProperties",
"(",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Entity",
"entity",
",",
"List",
"<",
"ReflectedInfo",
">",
"fieldInfo",
")",
"throws",
"Siren4JConversionException",
"{",
"if",
"(",
"!",
"MapUtils",
... | Sets field value for an entity's property field.
@param obj assumed not <code>null</code>.
@param clazz assumed not <code>null</code>.
@param entity assumed not <code>null</code>.
@param fieldInfo assumed not <code>null</code>.
@throws Siren4JConversionException | [
"Sets",
"field",
"value",
"for",
"an",
"entity",
"s",
"property",
"field",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L216-L241 |
106,942 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleSetSubEntities | @SuppressWarnings({"rawtypes", "unchecked"})
private void handleSetSubEntities(Object obj, Class<?> clazz, Entity entity, List<ReflectedInfo> fieldInfo)
throws Siren4JConversionException {
if (!CollectionUtils.isEmpty(entity.getEntities())) {
for (Entity ent : entity.getEntities(... | java | @SuppressWarnings({"rawtypes", "unchecked"})
private void handleSetSubEntities(Object obj, Class<?> clazz, Entity entity, List<ReflectedInfo> fieldInfo)
throws Siren4JConversionException {
if (!CollectionUtils.isEmpty(entity.getEntities())) {
for (Entity ent : entity.getEntities(... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"private",
"void",
"handleSetSubEntities",
"(",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Entity",
"entity",
",",
"List",
"<",
"ReflectedInfo",
">",
"fieldI... | Sets field value for an entity's sub entities field.
@param obj assumed not <code>null</code>.
@param clazz assumed not <code>null</code>.
@param entity assumed not <code>null</code>.
@param fieldInfo assumed not <code>null</code>.
@throws Siren4JConversionException | [
"Sets",
"field",
"value",
"for",
"an",
"entity",
"s",
"sub",
"entities",
"field",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L252-L304 |
106,943 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleSubEntity | private void handleSubEntity(EntityBuilder builder, Object obj, Field currentField, List<ReflectedInfo> fieldInfo)
throws Siren4JException {
Siren4JSubEntity subAnno = getSubEntityAnnotation(currentField, fieldInfo);
if (subAnno != null) {
if (isCollection(obj, currentField... | java | private void handleSubEntity(EntityBuilder builder, Object obj, Field currentField, List<ReflectedInfo> fieldInfo)
throws Siren4JException {
Siren4JSubEntity subAnno = getSubEntityAnnotation(currentField, fieldInfo);
if (subAnno != null) {
if (isCollection(obj, currentField... | [
"private",
"void",
"handleSubEntity",
"(",
"EntityBuilder",
"builder",
",",
"Object",
"obj",
",",
"Field",
"currentField",
",",
"List",
"<",
"ReflectedInfo",
">",
"fieldInfo",
")",
"throws",
"Siren4JException",
"{",
"Siren4JSubEntity",
"subAnno",
"=",
"getSubEntityA... | Handles sub entities.
@param builder assumed not <code>null</code>.
@param obj assumed not <code>null</code>.
@param currentField assumed not <code>null</code>.
@throws Siren4JException | [
"Handles",
"sub",
"entities",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L474-L494 |
106,944 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.resolveUri | private String resolveUri(String rawUri, EntityContext context, boolean handleURIOverride) throws Siren4JException {
String resolvedUri = rawUri;
String baseUri = null;
boolean fullyQualified = false;
if (context.getCurrentObject() instanceof Resource) {
Resource resourc... | java | private String resolveUri(String rawUri, EntityContext context, boolean handleURIOverride) throws Siren4JException {
String resolvedUri = rawUri;
String baseUri = null;
boolean fullyQualified = false;
if (context.getCurrentObject() instanceof Resource) {
Resource resourc... | [
"private",
"String",
"resolveUri",
"(",
"String",
"rawUri",
",",
"EntityContext",
"context",
",",
"boolean",
"handleURIOverride",
")",
"throws",
"Siren4JException",
"{",
"String",
"resolvedUri",
"=",
"rawUri",
";",
"String",
"baseUri",
"=",
"null",
";",
"boolean",... | Resolves the raw uri by replacing field tokens with the actual data.
@param rawUri assumed not <code>null</code> or .
@param context
@return uri with tokens resolved.
@throws Siren4JException | [
"Resolves",
"the",
"raw",
"uri",
"by",
"replacing",
"field",
"tokens",
"with",
"the",
"actual",
"data",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L504-L527 |
106,945 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleTokenReplacement | private String handleTokenReplacement(String str, EntityContext context) throws Siren4JException {
String result = "";
// First resolve parents
result = ReflectionUtils.replaceFieldTokens(
context.getParentObject(), str, context.getParentFieldInfo(), true);
// Now re... | java | private String handleTokenReplacement(String str, EntityContext context) throws Siren4JException {
String result = "";
// First resolve parents
result = ReflectionUtils.replaceFieldTokens(
context.getParentObject(), str, context.getParentFieldInfo(), true);
// Now re... | [
"private",
"String",
"handleTokenReplacement",
"(",
"String",
"str",
",",
"EntityContext",
"context",
")",
"throws",
"Siren4JException",
"{",
"String",
"result",
"=",
"\"\"",
";",
"// First resolve parents\r",
"result",
"=",
"ReflectionUtils",
".",
"replaceFieldTokens",... | Helper method to do token replacement for strings.
@param str
@param context
@return
@throws Siren4JException | [
"Helper",
"method",
"to",
"do",
"token",
"replacement",
"for",
"strings",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L542-L551 |
106,946 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.getSubEntityAnnotation | private Siren4JSubEntity getSubEntityAnnotation(Field currentField, List<ReflectedInfo> fieldInfo) {
Siren4JSubEntity result = null;
result = currentField.getAnnotation(Siren4JSubEntity.class);
if (result == null && fieldInfo != null) {
ReflectedInfo info = ReflectionUtils.getFie... | java | private Siren4JSubEntity getSubEntityAnnotation(Field currentField, List<ReflectedInfo> fieldInfo) {
Siren4JSubEntity result = null;
result = currentField.getAnnotation(Siren4JSubEntity.class);
if (result == null && fieldInfo != null) {
ReflectedInfo info = ReflectionUtils.getFie... | [
"private",
"Siren4JSubEntity",
"getSubEntityAnnotation",
"(",
"Field",
"currentField",
",",
"List",
"<",
"ReflectedInfo",
">",
"fieldInfo",
")",
"{",
"Siren4JSubEntity",
"result",
"=",
"null",
";",
"result",
"=",
"currentField",
".",
"getAnnotation",
"(",
"Siren4JSu... | Helper to retrieve a sub entity annotation from either the field itself or the getter.
If an annotation exists on both, then the field wins.
@param currentField assumed not <code>null</code>.
@param fieldInfo assumed not <code>null</code>.
@return the annotation if found else <code>null</code>. | [
"Helper",
"to",
"retrieve",
"a",
"sub",
"entity",
"annotation",
"from",
"either",
"the",
"field",
"itself",
"or",
"the",
"getter",
".",
"If",
"an",
"annotation",
"exists",
"on",
"both",
"then",
"the",
"field",
"wins",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L561-L571 |
106,947 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleSelfLink | private void handleSelfLink(EntityBuilder builder, String resolvedUri) {
if (StringUtils.isBlank(resolvedUri)) {
return;
}
Link link = LinkBuilder.newInstance().setRelationship(Link.RELATIONSHIP_SELF).setHref(resolvedUri).build();
builder.addLink(link);
} | java | private void handleSelfLink(EntityBuilder builder, String resolvedUri) {
if (StringUtils.isBlank(resolvedUri)) {
return;
}
Link link = LinkBuilder.newInstance().setRelationship(Link.RELATIONSHIP_SELF).setHref(resolvedUri).build();
builder.addLink(link);
} | [
"private",
"void",
"handleSelfLink",
"(",
"EntityBuilder",
"builder",
",",
"String",
"resolvedUri",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"resolvedUri",
")",
")",
"{",
"return",
";",
"}",
"Link",
"link",
"=",
"LinkBuilder",
".",
"newInstan... | Add the self link to the entity.
@param builder assumed not <code>null</code>.
@param resolvedUri the token resolved uri. Assumed not blank. | [
"Add",
"the",
"self",
"link",
"to",
"the",
"entity",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L579-L585 |
106,948 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleBaseUriLink | private void handleBaseUriLink(EntityBuilder builder, String baseUri) {
if (StringUtils.isBlank(baseUri)) {
return;
}
Link link = LinkBuilder.newInstance().setRelationship(Link.RELATIONSHIP_BASEURI).setHref(baseUri).build();
builder.addLink(link);
} | java | private void handleBaseUriLink(EntityBuilder builder, String baseUri) {
if (StringUtils.isBlank(baseUri)) {
return;
}
Link link = LinkBuilder.newInstance().setRelationship(Link.RELATIONSHIP_BASEURI).setHref(baseUri).build();
builder.addLink(link);
} | [
"private",
"void",
"handleBaseUriLink",
"(",
"EntityBuilder",
"builder",
",",
"String",
"baseUri",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"baseUri",
")",
")",
"{",
"return",
";",
"}",
"Link",
"link",
"=",
"LinkBuilder",
".",
"newInstance",
... | Add the baseUri link to the entity if the baseUri is set on the entity.
@param builder assumed not <code>null</code>.
@param baseUri the token resolved uri. Assumed not blank. | [
"Add",
"the",
"baseUri",
"link",
"to",
"the",
"entity",
"if",
"the",
"baseUri",
"is",
"set",
"on",
"the",
"entity",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L593-L599 |
106,949 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleEntityLinks | private void handleEntityLinks(EntityBuilder builder, EntityContext context) throws Siren4JException {
Class<?> clazz = context.getCurrentObject().getClass();
Map<String, Link> links = new HashMap<String, Link>();
/* Caution!! Order matters when adding to the links map */
Siren4J... | java | private void handleEntityLinks(EntityBuilder builder, EntityContext context) throws Siren4JException {
Class<?> clazz = context.getCurrentObject().getClass();
Map<String, Link> links = new HashMap<String, Link>();
/* Caution!! Order matters when adding to the links map */
Siren4J... | [
"private",
"void",
"handleEntityLinks",
"(",
"EntityBuilder",
"builder",
",",
"EntityContext",
"context",
")",
"throws",
"Siren4JException",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"context",
".",
"getCurrentObject",
"(",
")",
".",
"getClass",
"(",
")",
";"... | Handles getting all entity links both dynamically set and via annotations and merges them together overriding with
the proper precedence order which is Dynamic > SubEntity > Entity. Href and uri's are resolved with the correct data
bound in.
@param builder assumed not <code>null</code>.
@param context assumed not <cod... | [
"Handles",
"getting",
"all",
"entity",
"links",
"both",
"dynamically",
"set",
"and",
"via",
"annotations",
"and",
"merges",
"them",
"together",
"overriding",
"with",
"the",
"proper",
"precedence",
"order",
"which",
"is",
"Dynamic",
">",
"SubEntity",
">",
"Entity... | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L610-L647 |
106,950 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleEntityActions | private void handleEntityActions(EntityBuilder builder, EntityContext context) throws Siren4JException {
Class<?> clazz = context.getCurrentObject().getClass();
Map<String, Action> actions = new HashMap<String, Action>();
/* Caution!! Order matters when adding to the actions map */
... | java | private void handleEntityActions(EntityBuilder builder, EntityContext context) throws Siren4JException {
Class<?> clazz = context.getCurrentObject().getClass();
Map<String, Action> actions = new HashMap<String, Action>();
/* Caution!! Order matters when adding to the actions map */
... | [
"private",
"void",
"handleEntityActions",
"(",
"EntityBuilder",
"builder",
",",
"EntityContext",
"context",
")",
"throws",
"Siren4JException",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"context",
".",
"getCurrentObject",
"(",
")",
".",
"getClass",
"(",
")",
"... | Handles getting all entity actions both dynamically set and via annotations and merges them together overriding with
the proper precedence order which is Dynamic > SubEntity > Entity. Href and uri's are resolved with the correct data
bound in.
@param builder
@param context
@throws Exception | [
"Handles",
"getting",
"all",
"entity",
"actions",
"both",
"dynamically",
"set",
"and",
"via",
"annotations",
"and",
"merges",
"them",
"together",
"overriding",
"with",
"the",
"proper",
"precedence",
"order",
"which",
"is",
"Dynamic",
">",
"SubEntity",
">",
"Enti... | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L658-L693 |
106,951 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.evaluateConditional | private boolean evaluateConditional(Siren4JCondition condition, EntityContext context) {
boolean result = true;
if (condition != null && !("null".equals(condition.name()))) {
result = false;
Object val = null;
ConditionFactory factory = ConditionFactory.getInstan... | java | private boolean evaluateConditional(Siren4JCondition condition, EntityContext context) {
boolean result = true;
if (condition != null && !("null".equals(condition.name()))) {
result = false;
Object val = null;
ConditionFactory factory = ConditionFactory.getInstan... | [
"private",
"boolean",
"evaluateConditional",
"(",
"Siren4JCondition",
"condition",
",",
"EntityContext",
"context",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"if",
"(",
"condition",
"!=",
"null",
"&&",
"!",
"(",
"\"null\"",
".",
"equals",
"(",
"conditio... | Evaluates a value against its specified conditional.
@param condition
@param context
@return | [
"Evaluates",
"a",
"value",
"against",
"its",
"specified",
"conditional",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L702-L751 |
106,952 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.annotationToLink | private Link annotationToLink(Siren4JLink linkAnno, EntityContext context) {
LinkBuilder builder = LinkBuilder.newInstance().setRelationship(linkAnno.rel()).setHref(linkAnno.href());
if (StringUtils.isNotBlank(linkAnno.title())) {
builder.setTitle(linkAnno.title());
}
if... | java | private Link annotationToLink(Siren4JLink linkAnno, EntityContext context) {
LinkBuilder builder = LinkBuilder.newInstance().setRelationship(linkAnno.rel()).setHref(linkAnno.href());
if (StringUtils.isNotBlank(linkAnno.title())) {
builder.setTitle(linkAnno.title());
}
if... | [
"private",
"Link",
"annotationToLink",
"(",
"Siren4JLink",
"linkAnno",
",",
"EntityContext",
"context",
")",
"{",
"LinkBuilder",
"builder",
"=",
"LinkBuilder",
".",
"newInstance",
"(",
")",
".",
"setRelationship",
"(",
"linkAnno",
".",
"rel",
"(",
")",
")",
".... | Convert a link annotation to an actual link. The href will not be resolved in the instantiated link, this will need
to be post processed.
@param linkAnno assumed not <code>null</code>.
@return new link, never <code>null</code>. | [
"Convert",
"a",
"link",
"annotation",
"to",
"an",
"actual",
"link",
".",
"The",
"href",
"will",
"not",
"be",
"resolved",
"in",
"the",
"instantiated",
"link",
"this",
"will",
"need",
"to",
"be",
"post",
"processed",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L760-L769 |
106,953 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.annotationToAction | private Action annotationToAction(Siren4JAction actionAnno, EntityContext context) throws Siren4JException {
ActionBuilder builder = ActionBuilder.newInstance();
builder.setName(actionAnno.name()).setHref(actionAnno.href()).setMethod(actionAnno.method());
if (ArrayUtils.isNotEmpty(actionAnno.... | java | private Action annotationToAction(Siren4JAction actionAnno, EntityContext context) throws Siren4JException {
ActionBuilder builder = ActionBuilder.newInstance();
builder.setName(actionAnno.name()).setHref(actionAnno.href()).setMethod(actionAnno.method());
if (ArrayUtils.isNotEmpty(actionAnno.... | [
"private",
"Action",
"annotationToAction",
"(",
"Siren4JAction",
"actionAnno",
",",
"EntityContext",
"context",
")",
"throws",
"Siren4JException",
"{",
"ActionBuilder",
"builder",
"=",
"ActionBuilder",
".",
"newInstance",
"(",
")",
";",
"builder",
".",
"setName",
"(... | Convert an action annotation to an actual action. The href will not be resolved in the instantiated action, this will
need to be post processed.
@param actionAnno assumed not <code>null</code>.
@return new action, never <code>null</code>. | [
"Convert",
"an",
"action",
"annotation",
"to",
"an",
"actual",
"action",
".",
"The",
"href",
"will",
"not",
"be",
"resolved",
"in",
"the",
"instantiated",
"action",
"this",
"will",
"need",
"to",
"be",
"post",
"processed",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L778-L813 |
106,954 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.skipProperty | private boolean skipProperty(Object obj, Field field) throws Siren4JException {
boolean skip = false;
Class<?> clazz = obj.getClass();
Include inc = Include.ALWAYS;
Siren4JInclude typeInclude = clazz.getAnnotation(Siren4JInclude.class);
if (typeInclude != null) {
... | java | private boolean skipProperty(Object obj, Field field) throws Siren4JException {
boolean skip = false;
Class<?> clazz = obj.getClass();
Include inc = Include.ALWAYS;
Siren4JInclude typeInclude = clazz.getAnnotation(Siren4JInclude.class);
if (typeInclude != null) {
... | [
"private",
"boolean",
"skipProperty",
"(",
"Object",
"obj",
",",
"Field",
"field",
")",
"throws",
"Siren4JException",
"{",
"boolean",
"skip",
"=",
"false",
";",
"Class",
"<",
"?",
">",
"clazz",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"Include",
"inc"... | Determine if the property or entity should be skipped based on any existing include policy. The TYPE annotation is
checked first and then the field annotation, the field annotation takes precedence.
@param obj assumed not <code>null</code>.
@param field assumed not <code>null</code>.
@return <code>true</code> if the p... | [
"Determine",
"if",
"the",
"property",
"or",
"entity",
"should",
"be",
"skipped",
"based",
"on",
"any",
"existing",
"include",
"policy",
".",
"The",
"TYPE",
"annotation",
"is",
"checked",
"first",
"and",
"then",
"the",
"field",
"annotation",
"the",
"field",
"... | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L899-L936 |
106,955 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.getEntityClass | public String[] getEntityClass(Object obj, String name, Siren4JEntity entityAnno) {
Class<?> clazz = obj.getClass();
String[] compClass = entityAnno == null ? null : entityAnno.entityClass();
//If entity class specified then use it.
if (compClass != null && !ArrayUtils.isEmpty(compCl... | java | public String[] getEntityClass(Object obj, String name, Siren4JEntity entityAnno) {
Class<?> clazz = obj.getClass();
String[] compClass = entityAnno == null ? null : entityAnno.entityClass();
//If entity class specified then use it.
if (compClass != null && !ArrayUtils.isEmpty(compCl... | [
"public",
"String",
"[",
"]",
"getEntityClass",
"(",
"Object",
"obj",
",",
"String",
"name",
",",
"Siren4JEntity",
"entityAnno",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"String",
"[",
"]",
"compClass",
"="... | Determine entity class by first using the name set on the Siren entity and then if not found using the actual class
name, though it is preferable to use the first option to not tie to a language specific class.
@param obj
@param name
@return | [
"Determine",
"entity",
"class",
"by",
"first",
"using",
"the",
"name",
"set",
"on",
"the",
"Siren",
"entity",
"and",
"then",
"if",
"not",
"found",
"using",
"the",
"actual",
"class",
"name",
"though",
"it",
"is",
"preferable",
"to",
"use",
"the",
"first",
... | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L946-L963 |
106,956 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.isCollection | public boolean isCollection(Object obj, Field field) {
try {
Object val = field.get(obj);
boolean isCollResource = false;
if (val != null) {
isCollResource = CollectionResource.class.equals(val.getClass());
}
return (!isCollResou... | java | public boolean isCollection(Object obj, Field field) {
try {
Object val = field.get(obj);
boolean isCollResource = false;
if (val != null) {
isCollResource = CollectionResource.class.equals(val.getClass());
}
return (!isCollResou... | [
"public",
"boolean",
"isCollection",
"(",
"Object",
"obj",
",",
"Field",
"field",
")",
"{",
"try",
"{",
"Object",
"val",
"=",
"field",
".",
"get",
"(",
"obj",
")",
";",
"boolean",
"isCollResource",
"=",
"false",
";",
"if",
"(",
"val",
"!=",
"null",
"... | Determine if the field is a Collection class and not a CollectionResource class which needs special treatment.
@param field
@return | [
"Determine",
"if",
"the",
"field",
"is",
"a",
"Collection",
"class",
"and",
"not",
"a",
"CollectionResource",
"class",
"which",
"needs",
"special",
"treatment",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L971-L984 |
106,957 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.getGetterField | public static Field getGetterField(Method method) {
if (method == null) {
throw new IllegalArgumentException("method cannot be null.");
}
Class<?> clazz = method.getDeclaringClass();
String fName = stripGetterPrefix(method.getName());
Field field = null;
... | java | public static Field getGetterField(Method method) {
if (method == null) {
throw new IllegalArgumentException("method cannot be null.");
}
Class<?> clazz = method.getDeclaringClass();
String fName = stripGetterPrefix(method.getName());
Field field = null;
... | [
"public",
"static",
"Field",
"getGetterField",
"(",
"Method",
"method",
")",
"{",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"method cannot be null.\"",
")",
";",
"}",
"Class",
"<",
"?",
">",
"clazz",
"=",... | Find the field for the getter method based on the get methods name. It finds the field on the declaring class.
@param method cannot be <code>null</code>.
@return the field or <code>null</code> if not found. | [
"Find",
"the",
"field",
"for",
"the",
"getter",
"method",
"based",
"on",
"the",
"get",
"methods",
"name",
".",
"It",
"finds",
"the",
"field",
"on",
"the",
"declaring",
"class",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L95-L108 |
106,958 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.getExposedFieldInfo | public static List<ReflectedInfo> getExposedFieldInfo(final Class<?> clazz) {
List<ReflectedInfo> results = null;
try {
results = fieldInfoCache.get(clazz, new Callable<List<ReflectedInfo>>() {
/**
* This method is called if the value is not found in the... | java | public static List<ReflectedInfo> getExposedFieldInfo(final Class<?> clazz) {
List<ReflectedInfo> results = null;
try {
results = fieldInfoCache.get(clazz, new Callable<List<ReflectedInfo>>() {
/**
* This method is called if the value is not found in the... | [
"public",
"static",
"List",
"<",
"ReflectedInfo",
">",
"getExposedFieldInfo",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"List",
"<",
"ReflectedInfo",
">",
"results",
"=",
"null",
";",
"try",
"{",
"results",
"=",
"fieldInfoCache",
".",
"get",... | Retrieve all fields deemed as Exposed, i.e. they are public or have a public accessor method or are marked by an
annotation to be exposed.
@param clazz cannot be <code>null</code>.
@return | [
"Retrieve",
"all",
"fields",
"deemed",
"as",
"Exposed",
"i",
".",
"e",
".",
"they",
"are",
"public",
"or",
"have",
"a",
"public",
"accessor",
"method",
"or",
"are",
"marked",
"by",
"an",
"annotation",
"to",
"be",
"exposed",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L117-L171 |
106,959 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.isGetter | public static boolean isGetter(Method method) {
String name = method.getName();
String[] splitname = StringUtils.splitByCharacterTypeCamelCase(name);
return !method.getReturnType().equals(void.class) && Modifier.isPublic(method.getModifiers())
&& (splitname[0].equals(GETTER_P... | java | public static boolean isGetter(Method method) {
String name = method.getName();
String[] splitname = StringUtils.splitByCharacterTypeCamelCase(name);
return !method.getReturnType().equals(void.class) && Modifier.isPublic(method.getModifiers())
&& (splitname[0].equals(GETTER_P... | [
"public",
"static",
"boolean",
"isGetter",
"(",
"Method",
"method",
")",
"{",
"String",
"name",
"=",
"method",
".",
"getName",
"(",
")",
";",
"String",
"[",
"]",
"splitname",
"=",
"StringUtils",
".",
"splitByCharacterTypeCamelCase",
"(",
"name",
")",
";",
... | Determine if the method is a getter.
@param method
@return | [
"Determine",
"if",
"the",
"method",
"is",
"a",
"getter",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L212-L217 |
106,960 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.isSetter | public static boolean isSetter(Method method) {
String name = method.getName();
String[] splitname = StringUtils.splitByCharacterTypeCamelCase(name);
return method.getReturnType().equals(void.class) && Modifier.isPublic(method.getModifiers())
&& splitname[0].equals(SETTER_PRE... | java | public static boolean isSetter(Method method) {
String name = method.getName();
String[] splitname = StringUtils.splitByCharacterTypeCamelCase(name);
return method.getReturnType().equals(void.class) && Modifier.isPublic(method.getModifiers())
&& splitname[0].equals(SETTER_PRE... | [
"public",
"static",
"boolean",
"isSetter",
"(",
"Method",
"method",
")",
"{",
"String",
"name",
"=",
"method",
".",
"getName",
"(",
")",
";",
"String",
"[",
"]",
"splitname",
"=",
"StringUtils",
".",
"splitByCharacterTypeCamelCase",
"(",
"name",
")",
";",
... | Determine if the method is a setter.
@param method
@return | [
"Determine",
"if",
"the",
"method",
"is",
"a",
"setter",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L225-L230 |
106,961 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.replaceFieldTokens | public static String replaceFieldTokens(Object obj, String str, List<ReflectedInfo> fields, boolean parentMode)
throws Siren4JException {
Map<String, Field> index = new HashMap<String, Field>();
if (StringUtils.isBlank(str)) {
return str;
}
if (fields != nul... | java | public static String replaceFieldTokens(Object obj, String str, List<ReflectedInfo> fields, boolean parentMode)
throws Siren4JException {
Map<String, Field> index = new HashMap<String, Field>();
if (StringUtils.isBlank(str)) {
return str;
}
if (fields != nul... | [
"public",
"static",
"String",
"replaceFieldTokens",
"(",
"Object",
"obj",
",",
"String",
"str",
",",
"List",
"<",
"ReflectedInfo",
">",
"fields",
",",
"boolean",
"parentMode",
")",
"throws",
"Siren4JException",
"{",
"Map",
"<",
"String",
",",
"Field",
">",
"... | Replaces field tokens with the actual value in the fields. The field types must be simple property types
@param str
@param fields info
@param parentMode
@param obj
@return
@throws Siren4JException | [
"Replaces",
"field",
"tokens",
"with",
"the",
"actual",
"value",
"in",
"the",
"fields",
".",
"The",
"field",
"types",
"must",
"be",
"simple",
"property",
"types"
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L242-L281 |
106,962 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.flattenReservedTokens | public static String flattenReservedTokens(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
return str.replaceAll("\\{\\[", "{").replaceAll("\\]\\}", "}");
} | java | public static String flattenReservedTokens(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
return str.replaceAll("\\{\\[", "{").replaceAll("\\]\\}", "}");
} | [
"public",
"static",
"String",
"flattenReservedTokens",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"str",
")",
")",
"{",
"return",
"str",
";",
"}",
"return",
"str",
".",
"replaceAll",
"(",
"\"\\\\{\\\\[\"",
",",
"\"{\"",
... | Removes the square brackets that signify reserved from inside the tokens in the string.
@param str
@return | [
"Removes",
"the",
"square",
"brackets",
"that",
"signify",
"reserved",
"from",
"inside",
"the",
"tokens",
"in",
"the",
"string",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L289-L294 |
106,963 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.getTokenKeys | public static Set<String> getTokenKeys(String str) {
Set<String> results = new HashSet<String>();
String sDelim = "{";
String eDelim = "}";
if (StringUtils.isBlank(str)) {
return results;
}
int start = -1;
int end = 0;
do {
... | java | public static Set<String> getTokenKeys(String str) {
Set<String> results = new HashSet<String>();
String sDelim = "{";
String eDelim = "}";
if (StringUtils.isBlank(str)) {
return results;
}
int start = -1;
int end = 0;
do {
... | [
"public",
"static",
"Set",
"<",
"String",
">",
"getTokenKeys",
"(",
"String",
"str",
")",
"{",
"Set",
"<",
"String",
">",
"results",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"String",
"sDelim",
"=",
"\"{\"",
";",
"String",
"eDelim",
... | Retrieve all token keys from a string. A token is found by its its start and end delimiters which are open and close
curly braces.
@param str the string to parse, may be <code>null</code> or empty.
@return the set of unique token keys. Never <code>null</code>.May be empty. | [
"Retrieve",
"all",
"token",
"keys",
"from",
"a",
"string",
".",
"A",
"token",
"is",
"found",
"by",
"its",
"its",
"start",
"and",
"end",
"delimiters",
"which",
"are",
"open",
"and",
"close",
"curly",
"braces",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L313-L334 |
106,964 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.getFieldInfoByEffectiveName | public static ReflectedInfo getFieldInfoByEffectiveName(List<ReflectedInfo> infoList, String name) {
if (infoList == null) {
throw new IllegalArgumentException("infoList cannot be null.");
}
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name ca... | java | public static ReflectedInfo getFieldInfoByEffectiveName(List<ReflectedInfo> infoList, String name) {
if (infoList == null) {
throw new IllegalArgumentException("infoList cannot be null.");
}
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name ca... | [
"public",
"static",
"ReflectedInfo",
"getFieldInfoByEffectiveName",
"(",
"List",
"<",
"ReflectedInfo",
">",
"infoList",
",",
"String",
"name",
")",
"{",
"if",
"(",
"infoList",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"infoList can... | Helper method to find the field info by its effective name from the passed in list of info.
@param infoList cannot be <code>null</code>.
@param name cannot be <code>null</code> or empty.
@return the info or <code>null</code> if not found. | [
"Helper",
"method",
"to",
"find",
"the",
"field",
"info",
"by",
"its",
"effective",
"name",
"from",
"the",
"passed",
"in",
"list",
"of",
"info",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L476-L491 |
106,965 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.getFieldInfoByName | public static ReflectedInfo getFieldInfoByName(List<ReflectedInfo> infoList, String name) {
if (infoList == null) {
throw new IllegalArgumentException("infoList cannot be null.");
}
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be n... | java | public static ReflectedInfo getFieldInfoByName(List<ReflectedInfo> infoList, String name) {
if (infoList == null) {
throw new IllegalArgumentException("infoList cannot be null.");
}
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be n... | [
"public",
"static",
"ReflectedInfo",
"getFieldInfoByName",
"(",
"List",
"<",
"ReflectedInfo",
">",
"infoList",
",",
"String",
"name",
")",
"{",
"if",
"(",
"infoList",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"infoList cannot be nu... | Helper method to find the field info by its name from the passed in list of info.
@param infoList cannot be <code>null</code>.
@param name cannot be <code>null</code> or empty.
@return the info or <code>null</code> if not found. | [
"Helper",
"method",
"to",
"find",
"the",
"field",
"info",
"by",
"its",
"name",
"from",
"the",
"passed",
"in",
"list",
"of",
"info",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L500-L518 |
106,966 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ReflectionUtils.java | ReflectionUtils.setFieldValue | public static void setFieldValue(Object obj, ReflectedInfo info, Object value) throws Siren4JException {
if (obj == null) {
throw new IllegalArgumentException("obj cannot be null");
}
if (info == null) {
throw new IllegalArgumentException("info cannot be null");
... | java | public static void setFieldValue(Object obj, ReflectedInfo info, Object value) throws Siren4JException {
if (obj == null) {
throw new IllegalArgumentException("obj cannot be null");
}
if (info == null) {
throw new IllegalArgumentException("info cannot be null");
... | [
"public",
"static",
"void",
"setFieldValue",
"(",
"Object",
"obj",
",",
"ReflectedInfo",
"info",
",",
"Object",
"value",
")",
"throws",
"Siren4JException",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"obj c... | Sets the fields value, first by attempting to call the setter method if it exists and then
falling back to setting the field directly.
@param obj the object instance to set the value on, cannot be <code>null</code>.
@param info the fields reflected info object, cannot be <code>null</code>.
@param value the value to se... | [
"Sets",
"the",
"fields",
"value",
"first",
"by",
"attempting",
"to",
"call",
"the",
"setter",
"method",
"if",
"it",
"exists",
"and",
"then",
"falling",
"back",
"to",
"setting",
"the",
"field",
"directly",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L529-L553 |
106,967 | eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ResourceRegistryImpl.java | ResourceRegistryImpl.init | @SuppressWarnings("deprecation")
private void init(String... packages) throws Siren4JException {
LOG.info("Siren4J scanning classpath for resource entries...");
Reflections reflections = null;
ConfigurationBuilder builder = new ConfigurationBuilder();
Collection<URL> urls = new ... | java | @SuppressWarnings("deprecation")
private void init(String... packages) throws Siren4JException {
LOG.info("Siren4J scanning classpath for resource entries...");
Reflections reflections = null;
ConfigurationBuilder builder = new ConfigurationBuilder();
Collection<URL> urls = new ... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"init",
"(",
"String",
"...",
"packages",
")",
"throws",
"Siren4JException",
"{",
"LOG",
".",
"info",
"(",
"\"Siren4J scanning classpath for resource entries...\"",
")",
";",
"Reflections",
"refl... | Scans the classpath for resources.
@param packages
@throws Siren4JException | [
"Scans",
"the",
"classpath",
"for",
"resources",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ResourceRegistryImpl.java#L124-L158 |
106,968 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/BaseBuilder.java | BaseBuilder.callMethod | private void callMethod(Object obj, Step step) throws SecurityException, NoSuchMethodException,
IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> clazz = obj.getClass();
Method method = ReflectionUtils.findMethod(clazz, step.getMethodName(), step.getArgTyp... | java | private void callMethod(Object obj, Step step) throws SecurityException, NoSuchMethodException,
IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> clazz = obj.getClass();
Method method = ReflectionUtils.findMethod(clazz, step.getMethodName(), step.getArgTyp... | [
"private",
"void",
"callMethod",
"(",
"Object",
"obj",
",",
"Step",
"step",
")",
"throws",
"SecurityException",
",",
"NoSuchMethodException",
",",
"IllegalArgumentException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"Class",
"<",
"?",
">",... | Finds and calls the method specified by the step passed in.
@param obj assumed not <code>null</code>.
@param step assumed not <code>null</code>.
@throws SecurityException
@throws NoSuchMethodException
@throws IllegalArgumentException
@throws IllegalAccessException
@throws InvocationTargetException | [
"Finds",
"and",
"calls",
"the",
"method",
"specified",
"by",
"the",
"step",
"passed",
"in",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/BaseBuilder.java#L171-L177 |
106,969 | eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/BaseBuilder.java | BaseBuilder.getTypes | private Class<?>[] getTypes(Object[] args) {
if (args == null || args.length == 0) {
return null;
}
List<Class<?>> classList = new ArrayList<Class<?>>();
for (Object obj : args) {
classList.add(obj == null ? Object.class : obj.getClass());
}
... | java | private Class<?>[] getTypes(Object[] args) {
if (args == null || args.length == 0) {
return null;
}
List<Class<?>> classList = new ArrayList<Class<?>>();
for (Object obj : args) {
classList.add(obj == null ? Object.class : obj.getClass());
}
... | [
"private",
"Class",
"<",
"?",
">",
"[",
"]",
"getTypes",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
"==",
"null",
"||",
"args",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"Class",
"<",
"?",
... | Attempts to determine the argument types based on the passed in object instances.
@param args assumed not <code>null</code>.
@return array of argument types. | [
"Attempts",
"to",
"determine",
"the",
"argument",
"types",
"based",
"on",
"the",
"passed",
"in",
"object",
"instances",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/BaseBuilder.java#L186-L195 |
106,970 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ComponentUtils.java | ComponentUtils.getSubEntityByRel | public static Entity getSubEntityByRel(Entity entity, String... rel) {
if(entity == null) {
throw new IllegalArgumentException("entity cannot be null.");
}
if(ArrayUtils.isEmpty(rel)) {
throw new IllegalArgumentException("rel cannot be null or empty");
}
... | java | public static Entity getSubEntityByRel(Entity entity, String... rel) {
if(entity == null) {
throw new IllegalArgumentException("entity cannot be null.");
}
if(ArrayUtils.isEmpty(rel)) {
throw new IllegalArgumentException("rel cannot be null or empty");
}
... | [
"public",
"static",
"Entity",
"getSubEntityByRel",
"(",
"Entity",
"entity",
",",
"String",
"...",
"rel",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"entity cannot be null.\"",
")",
";",
"}",
"if",
... | Retrieve a sub entity by its relationship.
@param entity cannot be <code>null</code>.
@param rel cannot be <code>null</code> or empty.
@return the located entity or <code>null</code> if not found. | [
"Retrieve",
"a",
"sub",
"entity",
"by",
"its",
"relationship",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ComponentUtils.java#L50-L68 |
106,971 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ComponentUtils.java | ComponentUtils.getLinkByRel | public static Link getLinkByRel(Entity entity, String... rel) {
if(entity == null) {
throw new IllegalArgumentException("entity cannot be null.");
}
if(ArrayUtils.isEmpty(rel)) {
throw new IllegalArgumentException("rel cannot be null or empty");
}
L... | java | public static Link getLinkByRel(Entity entity, String... rel) {
if(entity == null) {
throw new IllegalArgumentException("entity cannot be null.");
}
if(ArrayUtils.isEmpty(rel)) {
throw new IllegalArgumentException("rel cannot be null or empty");
}
L... | [
"public",
"static",
"Link",
"getLinkByRel",
"(",
"Entity",
"entity",
",",
"String",
"...",
"rel",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"entity cannot be null.\"",
")",
";",
"}",
"if",
"(",
... | Retrieve a link by its relationship.
@param entity cannot be <code>null</code>.
@param rel cannot be <code>null</code> or empty.
@return the located link or <code>null</code> if not found. | [
"Retrieve",
"a",
"link",
"by",
"its",
"relationship",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ComponentUtils.java#L76-L94 |
106,972 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ComponentUtils.java | ComponentUtils.getActionByName | public static Action getActionByName(Entity entity, String name) {
if(entity == null) {
throw new IllegalArgumentException("entity cannot be null.");
}
if(StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be null or empty.");
}
... | java | public static Action getActionByName(Entity entity, String name) {
if(entity == null) {
throw new IllegalArgumentException("entity cannot be null.");
}
if(StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be null or empty.");
}
... | [
"public",
"static",
"Action",
"getActionByName",
"(",
"Entity",
"entity",
",",
"String",
"name",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"entity cannot be null.\"",
")",
";",
"}",
"if",
"(",
"... | Retrieve an action by its name.
@param entity cannot be <code>null</code>.
@param name cannot be <code>null</code> or empty.
@return the located action or <code>null</code> if not found. | [
"Retrieve",
"an",
"action",
"by",
"its",
"name",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ComponentUtils.java#L102-L120 |
106,973 | eserating/siren4j | src/main/java/com/google/code/siren4j/util/ComponentUtils.java | ComponentUtils.isStringArrayEmpty | public static boolean isStringArrayEmpty(String[] arr) {
boolean empty = true;
if (arr != null) {
if (arr.length > 0) {
for (String s : arr) {
if (StringUtils.isNotBlank(s)) {
empty = false;
break;
... | java | public static boolean isStringArrayEmpty(String[] arr) {
boolean empty = true;
if (arr != null) {
if (arr.length > 0) {
for (String s : arr) {
if (StringUtils.isNotBlank(s)) {
empty = false;
break;
... | [
"public",
"static",
"boolean",
"isStringArrayEmpty",
"(",
"String",
"[",
"]",
"arr",
")",
"{",
"boolean",
"empty",
"=",
"true",
";",
"if",
"(",
"arr",
"!=",
"null",
")",
"{",
"if",
"(",
"arr",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"String"... | Determine if the string array is empty. It is considered empty if zero length or all items are blank strings;
@param arr
@return | [
"Determine",
"if",
"the",
"string",
"array",
"is",
"empty",
".",
"It",
"is",
"considered",
"empty",
"if",
"zero",
"length",
"or",
"all",
"items",
"are",
"blank",
"strings",
";"
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ComponentUtils.java#L128-L141 |
106,974 | yshavit/antlr-denter | core/src/main/java/com/yuvalshavit/antlr4/DenterHelper.java | DenterHelper.unwindTo | private Token unwindTo(int targetIndent, Token copyFrom) {
assert dentsBuffer.isEmpty() : dentsBuffer;
dentsBuffer.add(createToken(nlToken, copyFrom));
// To make things easier, we'll queue up ALL of the dedents, and then pop off the first one.
// For example, here's how some text is analyzed:
//
... | java | private Token unwindTo(int targetIndent, Token copyFrom) {
assert dentsBuffer.isEmpty() : dentsBuffer;
dentsBuffer.add(createToken(nlToken, copyFrom));
// To make things easier, we'll queue up ALL of the dedents, and then pop off the first one.
// For example, here's how some text is analyzed:
//
... | [
"private",
"Token",
"unwindTo",
"(",
"int",
"targetIndent",
",",
"Token",
"copyFrom",
")",
"{",
"assert",
"dentsBuffer",
".",
"isEmpty",
"(",
")",
":",
"dentsBuffer",
";",
"dentsBuffer",
".",
"add",
"(",
"createToken",
"(",
"nlToken",
",",
"copyFrom",
")",
... | Returns a DEDENT token, and also queues up additional DEDENTS as necessary.
@param targetIndent the "size" of the indentation (number of spaces) by the end
@param copyFrom the triggering token
@return a DEDENT token | [
"Returns",
"a",
"DEDENT",
"token",
"and",
"also",
"queues",
"up",
"additional",
"DEDENTS",
"as",
"necessary",
"."
] | 65ab8d2f491cc044cee873078fb063c021a8a708 | https://github.com/yshavit/antlr-denter/blob/65ab8d2f491cc044cee873078fb063c021a8a708/core/src/main/java/com/yuvalshavit/antlr4/DenterHelper.java#L141-L168 |
106,975 | MindscapeHQ/raygun4java | webprovider/src/main/java/com/mindscapehq/raygun4java/webprovider/RaygunClient.java | RaygunClient.initialize | public static void initialize(HttpServletRequest request) {
if (factory == null) {
throw new RuntimeException("RaygunClient is not initialized. Call RaygunClient.Initialize()");
}
client.set(factory.newClient(request));
} | java | public static void initialize(HttpServletRequest request) {
if (factory == null) {
throw new RuntimeException("RaygunClient is not initialized. Call RaygunClient.Initialize()");
}
client.set(factory.newClient(request));
} | [
"public",
"static",
"void",
"initialize",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"factory",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"RaygunClient is not initialized. Call RaygunClient.Initialize()\"",
")",
";",
"}",
"clie... | Initialize the static accessor for the given request
@param request | [
"Initialize",
"the",
"static",
"accessor",
"for",
"the",
"given",
"request"
] | 284a818446cfc6f0c2f83b5365514bc1bfc129b0 | https://github.com/MindscapeHQ/raygun4java/blob/284a818446cfc6f0c2f83b5365514bc1bfc129b0/webprovider/src/main/java/com/mindscapehq/raygun4java/webprovider/RaygunClient.java#L46-L51 |
106,976 | MindscapeHQ/raygun4java | core/src/main/java/com/mindscapehq/raygun4java/core/RaygunClientFactory.java | RaygunClientFactory.withData | public RaygunClientFactory withData(Object key, Object value) {
factoryData.put(key, value);
return this;
} | java | public RaygunClientFactory withData(Object key, Object value) {
factoryData.put(key, value);
return this;
} | [
"public",
"RaygunClientFactory",
"withData",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"factoryData",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | This data will be added to every error sent
@param key
@param value
@return factory | [
"This",
"data",
"will",
"be",
"added",
"to",
"every",
"error",
"sent"
] | 284a818446cfc6f0c2f83b5365514bc1bfc129b0 | https://github.com/MindscapeHQ/raygun4java/blob/284a818446cfc6f0c2f83b5365514bc1bfc129b0/core/src/main/java/com/mindscapehq/raygun4java/core/RaygunClientFactory.java#L178-L181 |
106,977 | MindscapeHQ/raygun4java | core/src/main/java/com/mindscapehq/raygun4java/core/RaygunClient.java | RaygunClient.withData | public RaygunClient withData(Object key, Object value) {
clientData.put(key, value);
return this;
} | java | public RaygunClient withData(Object key, Object value) {
clientData.put(key, value);
return this;
} | [
"public",
"RaygunClient",
"withData",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"clientData",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | This data will be added to all errors sent from this instance of the client
@param key
@param value
@return | [
"This",
"data",
"will",
"be",
"added",
"to",
"all",
"errors",
"sent",
"from",
"this",
"instance",
"of",
"the",
"client"
] | 284a818446cfc6f0c2f83b5365514bc1bfc129b0 | https://github.com/MindscapeHQ/raygun4java/blob/284a818446cfc6f0c2f83b5365514bc1bfc129b0/core/src/main/java/com/mindscapehq/raygun4java/core/RaygunClient.java#L310-L313 |
106,978 | MindscapeHQ/raygun4java | core/src/main/java/com/mindscapehq/raygun4java/core/handlers/requestfilters/RaygunDuplicateErrorFilterFactory.java | RaygunDuplicateErrorFilterFactory.create | public RaygunDuplicateErrorFilter create() {
RaygunDuplicateErrorFilter filter = instance.get();
if (filter == null) {
filter = new RaygunDuplicateErrorFilter();
instance.set(filter);
return filter;
} else {
instance.remove();
return fi... | java | public RaygunDuplicateErrorFilter create() {
RaygunDuplicateErrorFilter filter = instance.get();
if (filter == null) {
filter = new RaygunDuplicateErrorFilter();
instance.set(filter);
return filter;
} else {
instance.remove();
return fi... | [
"public",
"RaygunDuplicateErrorFilter",
"create",
"(",
")",
"{",
"RaygunDuplicateErrorFilter",
"filter",
"=",
"instance",
".",
"get",
"(",
")",
";",
"if",
"(",
"filter",
"==",
"null",
")",
"{",
"filter",
"=",
"new",
"RaygunDuplicateErrorFilter",
"(",
")",
";",... | this will haunt me for eternity | [
"this",
"will",
"haunt",
"me",
"for",
"eternity"
] | 284a818446cfc6f0c2f83b5365514bc1bfc129b0 | https://github.com/MindscapeHQ/raygun4java/blob/284a818446cfc6f0c2f83b5365514bc1bfc129b0/core/src/main/java/com/mindscapehq/raygun4java/core/handlers/requestfilters/RaygunDuplicateErrorFilterFactory.java#L24-L34 |
106,979 | MindscapeHQ/raygun4java | sampleapp/src/main/java/com/mindscapehq/raygun4java/sampleapp/SampleApp.java | SampleApp.main | public static void main(String[] args) throws Throwable {
final Exception exceptionToThrowLater = new Exception("Raygun4Java test exception");
// sets the global unhandled exception handler
Thread.setDefaultUncaughtExceptionHandler(MyExceptionHandler.instance());
MyExceptionHandler.ge... | java | public static void main(String[] args) throws Throwable {
final Exception exceptionToThrowLater = new Exception("Raygun4Java test exception");
// sets the global unhandled exception handler
Thread.setDefaultUncaughtExceptionHandler(MyExceptionHandler.instance());
MyExceptionHandler.ge... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"final",
"Exception",
"exceptionToThrowLater",
"=",
"new",
"Exception",
"(",
"\"Raygun4Java test exception\"",
")",
";",
"// sets the global unhandled exception handler... | An example of how to use Raygun4Java | [
"An",
"example",
"of",
"how",
"to",
"use",
"Raygun4Java"
] | 284a818446cfc6f0c2f83b5365514bc1bfc129b0 | https://github.com/MindscapeHQ/raygun4java/blob/284a818446cfc6f0c2f83b5365514bc1bfc129b0/sampleapp/src/main/java/com/mindscapehq/raygun4java/sampleapp/SampleApp.java#L32-L93 |
106,980 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policyparser/Parser.java | Parser.parse | public ParsedPolicy parse(File file) throws Exception {
if (file == null || !file.exists()) {
if (debug) {
if (file == null) {
ProGradePolicyDebugger.log("Given File is null");
} else {
if (!file.exists()) {
... | java | public ParsedPolicy parse(File file) throws Exception {
if (file == null || !file.exists()) {
if (debug) {
if (file == null) {
ProGradePolicyDebugger.log("Given File is null");
} else {
if (!file.exists()) {
... | [
"public",
"ParsedPolicy",
"parse",
"(",
"File",
"file",
")",
"throws",
"Exception",
"{",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"debug",
")",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{... | Parse content of text policy file to ParsedPolicy object which represent this policy.
@param file text file with policy file
@return parsed policy file which is represented by ParsedPolicy
@throws throw Exception when any problem occurred during parsing file (file doesn't exist, incompatible policy file etc.) | [
"Parse",
"content",
"of",
"text",
"policy",
"file",
"to",
"ParsedPolicy",
"object",
"which",
"represent",
"this",
"policy",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policyparser/Parser.java#L73-L97 |
106,981 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policyparser/Parser.java | Parser.parsePrincipal | private ParsedPrincipal parsePrincipal() throws Exception {
lookahead = st.nextToken();
switch (lookahead) {
case '*':
lookahead = st.nextToken();
if (lookahead == '*') {
return new ParsedPrincipal(null, null);
} else {
... | java | private ParsedPrincipal parsePrincipal() throws Exception {
lookahead = st.nextToken();
switch (lookahead) {
case '*':
lookahead = st.nextToken();
if (lookahead == '*') {
return new ParsedPrincipal(null, null);
} else {
... | [
"private",
"ParsedPrincipal",
"parsePrincipal",
"(",
")",
"throws",
"Exception",
"{",
"lookahead",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"switch",
"(",
"lookahead",
")",
"{",
"case",
"'",
"'",
":",
"lookahead",
"=",
"st",
".",
"nextToken",
"(",
")"... | Private method for parsing principal part of policy entry.
@return parsed principal part of policy entry
@throws throws Exception when any problem occurred during parsing principal | [
"Private",
"method",
"for",
"parsing",
"principal",
"part",
"of",
"policy",
"entry",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policyparser/Parser.java#L281-L307 |
106,982 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policyparser/Parser.java | Parser.parsePermission | private ParsedPermission parsePermission() throws Exception {
ParsedPermission permission = new ParsedPermission();
lookahead = st.nextToken();
if (lookahead == StreamTokenizer.TT_WORD) {
permission.setPermissionType(st.sval);
} else {
throw new Exception("ER021: ... | java | private ParsedPermission parsePermission() throws Exception {
ParsedPermission permission = new ParsedPermission();
lookahead = st.nextToken();
if (lookahead == StreamTokenizer.TT_WORD) {
permission.setPermissionType(st.sval);
} else {
throw new Exception("ER021: ... | [
"private",
"ParsedPermission",
"parsePermission",
"(",
")",
"throws",
"Exception",
"{",
"ParsedPermission",
"permission",
"=",
"new",
"ParsedPermission",
"(",
")",
";",
"lookahead",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"lookahead",
"==",
"Str... | Private method for parsing permission part of policy entry.
@return parsed permission part of policy entry
@throws throws Exception when any problem occurred during parsing permission | [
"Private",
"method",
"for",
"parsing",
"permission",
"part",
"of",
"policy",
"entry",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policyparser/Parser.java#L315-L382 |
106,983 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policyparser/Parser.java | Parser.parseKeystore | private void parseKeystore() throws Exception {
String tempKeystoreURL = null;
String tempKeystoreType = null;
String tempKeystoreProvider = null;
lookahead = st.nextToken();
if (lookahead == '\"') {
tempKeystoreURL = st.sval;
} else {
throw new Ex... | java | private void parseKeystore() throws Exception {
String tempKeystoreURL = null;
String tempKeystoreType = null;
String tempKeystoreProvider = null;
lookahead = st.nextToken();
if (lookahead == '\"') {
tempKeystoreURL = st.sval;
} else {
throw new Ex... | [
"private",
"void",
"parseKeystore",
"(",
")",
"throws",
"Exception",
"{",
"String",
"tempKeystoreURL",
"=",
"null",
";",
"String",
"tempKeystoreType",
"=",
"null",
";",
"String",
"tempKeystoreProvider",
"=",
"null",
";",
"lookahead",
"=",
"st",
".",
"nextToken",... | Private method for parsing keystore entry.
@throws throws Exception when any problem occurred during parsing keystore entry | [
"Private",
"method",
"for",
"parsing",
"keystore",
"entry",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policyparser/Parser.java#L389-L427 |
106,984 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policyparser/Parser.java | Parser.parseKeystorePassword | private void parseKeystorePassword() throws Exception {
lookahead = st.nextToken();
if (lookahead == '\"') {
if (keystorePasswordURL == null) {
keystorePasswordURL = st.sval;
}
} else {
throw new Exception("ER033: [\"keystore_password\"] expect... | java | private void parseKeystorePassword() throws Exception {
lookahead = st.nextToken();
if (lookahead == '\"') {
if (keystorePasswordURL == null) {
keystorePasswordURL = st.sval;
}
} else {
throw new Exception("ER033: [\"keystore_password\"] expect... | [
"private",
"void",
"parseKeystorePassword",
"(",
")",
"throws",
"Exception",
"{",
"lookahead",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"lookahead",
"==",
"'",
"'",
")",
"{",
"if",
"(",
"keystorePasswordURL",
"==",
"null",
")",
"{",
"keysto... | Private method for parsing keystorePasswordURL entry.
@throws throws Exception when any problem occurred during parsing keystorePasswordURL entry | [
"Private",
"method",
"for",
"parsing",
"keystorePasswordURL",
"entry",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policyparser/Parser.java#L434-L449 |
106,985 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policyparser/Parser.java | Parser.parsePriority | private void parsePriority() throws Exception {
lookahead = st.nextToken();
if (lookahead == '\"') {
if (priority == null) {
String pr = st.sval;
if (pr.toLowerCase().equals("grant")) {
priority = Priority.GRANT;
} else {
... | java | private void parsePriority() throws Exception {
lookahead = st.nextToken();
if (lookahead == '\"') {
if (priority == null) {
String pr = st.sval;
if (pr.toLowerCase().equals("grant")) {
priority = Priority.GRANT;
} else {
... | [
"private",
"void",
"parsePriority",
"(",
")",
"throws",
"Exception",
"{",
"lookahead",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"lookahead",
"==",
"'",
"'",
")",
"{",
"if",
"(",
"priority",
"==",
"null",
")",
"{",
"String",
"pr",
"=",
... | Private method for parsing priority entry.
@throws throws Exception when any problem occurred during parsing priority entry | [
"Private",
"method",
"for",
"parsing",
"priority",
"entry",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policyparser/Parser.java#L456-L480 |
106,986 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/generator/SecurityActions.java | SecurityActions.getPolicy | static Policy getPolicy() {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
return AccessController.doPrivileged(new PrivilegedAction<Policy>() {
public Policy run() {
return Policy.getPolicy();
}
});
... | java | static Policy getPolicy() {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
return AccessController.doPrivileged(new PrivilegedAction<Policy>() {
public Policy run() {
return Policy.getPolicy();
}
});
... | [
"static",
"Policy",
"getPolicy",
"(",
")",
"{",
"final",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"!=",
"null",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedActi... | Returns the installed policy object.
@return | [
"Returns",
"the",
"installed",
"policy",
"object",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/generator/SecurityActions.java#L58-L70 |
106,987 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.refresh | @Override
public void refresh() {
FileReader fr = null;
if (file != null) {
try {
fr = new FileReader(file);
} catch (Exception e) {
System.err.println("Unable to read policy file " + file + ": " + e.getMessage());
}
}
... | java | @Override
public void refresh() {
FileReader fr = null;
if (file != null) {
try {
fr = new FileReader(file);
} catch (Exception e) {
System.err.println("Unable to read policy file " + file + ": " + e.getMessage());
}
}
... | [
"@",
"Override",
"public",
"void",
"refresh",
"(",
")",
"{",
"FileReader",
"fr",
"=",
"null",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"try",
"{",
"fr",
"=",
"new",
"FileReader",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
... | Method which loads policy data from policy file. | [
"Method",
"which",
"loads",
"policy",
"data",
"from",
"policy",
"file",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L123-L134 |
106,988 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.addParsedPolicyEntries | private void addParsedPolicyEntries(List<ParsedPolicyEntry> parsedEntries, List<ProGradePolicyEntry> entries,
KeyStore keystore, boolean grant) throws Exception {
for (ParsedPolicyEntry p : parsedEntries) {
try {
entries.add(initializePolicyEntry(p, keystore, grant));
... | java | private void addParsedPolicyEntries(List<ParsedPolicyEntry> parsedEntries, List<ProGradePolicyEntry> entries,
KeyStore keystore, boolean grant) throws Exception {
for (ParsedPolicyEntry p : parsedEntries) {
try {
entries.add(initializePolicyEntry(p, keystore, grant));
... | [
"private",
"void",
"addParsedPolicyEntries",
"(",
"List",
"<",
"ParsedPolicyEntry",
">",
"parsedEntries",
",",
"List",
"<",
"ProGradePolicyEntry",
">",
"entries",
",",
"KeyStore",
"keystore",
",",
"boolean",
"grant",
")",
"throws",
"Exception",
"{",
"for",
"(",
... | Private method which adds parsedEntries to entries.
@param parsedEntries parsed entries from policy file which will be added to entries
@param entries entries will add parsed entries to themselves
@param keystore KeyStore which is used by this policy file
@param grant true for priority grant, false for priority deny
@... | [
"Private",
"method",
"which",
"adds",
"parsedEntries",
"to",
"entries",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L223-L232 |
106,989 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.initializePolicyEntry | private ProGradePolicyEntry initializePolicyEntry(ParsedPolicyEntry parsedEntry, KeyStore keystore, boolean grant)
throws Exception {
ProGradePolicyEntry entry = new ProGradePolicyEntry(grant, debug);
// codesource
if (parsedEntry.getCodebase() != null || parsedEntry.getSignedBy() !... | java | private ProGradePolicyEntry initializePolicyEntry(ParsedPolicyEntry parsedEntry, KeyStore keystore, boolean grant)
throws Exception {
ProGradePolicyEntry entry = new ProGradePolicyEntry(grant, debug);
// codesource
if (parsedEntry.getCodebase() != null || parsedEntry.getSignedBy() !... | [
"private",
"ProGradePolicyEntry",
"initializePolicyEntry",
"(",
"ParsedPolicyEntry",
"parsedEntry",
",",
"KeyStore",
"keystore",
",",
"boolean",
"grant",
")",
"throws",
"Exception",
"{",
"ProGradePolicyEntry",
"entry",
"=",
"new",
"ProGradePolicyEntry",
"(",
"grant",
",... | Private method for initializing one policy entry.
@param parsedEntry parsed entry using for creating new entry ProgradePolicyEntry
@param keystore KeyStore which is used by this policy file
@param grant true for priority grant, false for priority deny
@return ProgradePolicyEntry which represents this parsedEntry
@thro... | [
"Private",
"method",
"for",
"initializing",
"one",
"policy",
"entry",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L243-L287 |
106,990 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.entriesImplyPermission | private boolean entriesImplyPermission(List<ProGradePolicyEntry> policyEntriesList, ProtectionDomain domain,
Permission permission) {
for (ProGradePolicyEntry entry : policyEntriesList) {
if (entry.implies(domain, permission)) {
return true;
}
}
... | java | private boolean entriesImplyPermission(List<ProGradePolicyEntry> policyEntriesList, ProtectionDomain domain,
Permission permission) {
for (ProGradePolicyEntry entry : policyEntriesList) {
if (entry.implies(domain, permission)) {
return true;
}
}
... | [
"private",
"boolean",
"entriesImplyPermission",
"(",
"List",
"<",
"ProGradePolicyEntry",
">",
"policyEntriesList",
",",
"ProtectionDomain",
"domain",
",",
"Permission",
"permission",
")",
"{",
"for",
"(",
"ProGradePolicyEntry",
"entry",
":",
"policyEntriesList",
")",
... | Private method for determining whether grant or deny entries of ProgradePolicyFile imply given Permission.
@param domain active ProtectionDomain to test
@param permission Permission which need to be determined
@return true if grant or deny entries of this ProgradePolicyFile imply given Permission, false otherwise | [
"Private",
"method",
"for",
"determining",
"whether",
"grant",
"or",
"deny",
"entries",
"of",
"ProgradePolicyFile",
"imply",
"given",
"Permission",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L388-L396 |
106,991 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.expandStringWithProperty | private String expandStringWithProperty(String s) throws Exception {
// if expandProperties is false, don't expand property
if (!expandProperties) {
return s;
}
// if string doesn't contain property, returns original string
if (s == null || s.indexOf("${") == -1) {
... | java | private String expandStringWithProperty(String s) throws Exception {
// if expandProperties is false, don't expand property
if (!expandProperties) {
return s;
}
// if string doesn't contain property, returns original string
if (s == null || s.indexOf("${") == -1) {
... | [
"private",
"String",
"expandStringWithProperty",
"(",
"String",
"s",
")",
"throws",
"Exception",
"{",
"// if expandProperties is false, don't expand property",
"if",
"(",
"!",
"expandProperties",
")",
"{",
"return",
"s",
";",
"}",
"// if string doesn't contain property, ret... | Private method for expanding String which contains any property.
@param s String for expanding
@return expanded String
@throws Exception when any ends without '}' or contains inner property expansion | [
"Private",
"method",
"for",
"expanding",
"String",
"which",
"contains",
"any",
"property",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L514-L548 |
106,992 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.createCodeSource | private CodeSource createCodeSource(ParsedPolicyEntry parsedEntry, KeyStore keystore) throws Exception {
String parsedCodebase = expandStringWithProperty(parsedEntry.getCodebase());
String parsedCertificates = expandStringWithProperty(parsedEntry.getSignedBy());
String[] splitCertificates = new ... | java | private CodeSource createCodeSource(ParsedPolicyEntry parsedEntry, KeyStore keystore) throws Exception {
String parsedCodebase = expandStringWithProperty(parsedEntry.getCodebase());
String parsedCertificates = expandStringWithProperty(parsedEntry.getSignedBy());
String[] splitCertificates = new ... | [
"private",
"CodeSource",
"createCodeSource",
"(",
"ParsedPolicyEntry",
"parsedEntry",
",",
"KeyStore",
"keystore",
")",
"throws",
"Exception",
"{",
"String",
"parsedCodebase",
"=",
"expandStringWithProperty",
"(",
"parsedEntry",
".",
"getCodebase",
"(",
")",
")",
";",... | Private method for creating new CodeSource object from ParsedEntry.
@param parsedEntry ParsedEntry with informations about CodeSource
@param keystore KeyStore which is used by this policy file
@return new created CodeSource
@throws Exception when there was any problem during creating CodeSource | [
"Private",
"method",
"for",
"creating",
"new",
"CodeSource",
"object",
"from",
"ParsedEntry",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L558-L596 |
106,993 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.adaptURL | private URL adaptURL(URL url) throws Exception {
if (url != null && url.getProtocol().equals("file")) {
url = new URL(fixEncodedURI(url.toURI().toASCIIString()));
}
return url;
} | java | private URL adaptURL(URL url) throws Exception {
if (url != null && url.getProtocol().equals("file")) {
url = new URL(fixEncodedURI(url.toURI().toASCIIString()));
}
return url;
} | [
"private",
"URL",
"adaptURL",
"(",
"URL",
"url",
")",
"throws",
"Exception",
"{",
"if",
"(",
"url",
"!=",
"null",
"&&",
"url",
".",
"getProtocol",
"(",
")",
".",
"equals",
"(",
"\"file\"",
")",
")",
"{",
"url",
"=",
"new",
"URL",
"(",
"fixEncodedURI"... | Private method for adapting URL for using of this ProgradePolicyFile.
@param url URL for adapting
@return adapted URL
@throws Exception when there was any problem during adapting URL | [
"Private",
"method",
"for",
"adapting",
"URL",
"for",
"using",
"of",
"this",
"ProgradePolicyFile",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L605-L610 |
106,994 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.createKeystore | private KeyStore createKeystore(ParsedKeystoreEntry parsedKeystoreEntry, String keystorePasswordURL, File policyFile)
throws Exception {
if (parsedKeystoreEntry == null) {
return null;
}
KeyStore toReturn;
String keystoreURL = expandStringWithProperty(parsedKeysto... | java | private KeyStore createKeystore(ParsedKeystoreEntry parsedKeystoreEntry, String keystorePasswordURL, File policyFile)
throws Exception {
if (parsedKeystoreEntry == null) {
return null;
}
KeyStore toReturn;
String keystoreURL = expandStringWithProperty(parsedKeysto... | [
"private",
"KeyStore",
"createKeystore",
"(",
"ParsedKeystoreEntry",
"parsedKeystoreEntry",
",",
"String",
"keystorePasswordURL",
",",
"File",
"policyFile",
")",
"throws",
"Exception",
"{",
"if",
"(",
"parsedKeystoreEntry",
"==",
"null",
")",
"{",
"return",
"null",
... | Private method for creating KeyStore object from ParsedKeystoreEntry and other information from policy file.
@param parsedKeystoreEntry parsedKeystoreEntry containing information about keystore
@param keystorePasswordURL URL to file which contain password for given keystore
@param policyFile used policy file
@return n... | [
"Private",
"method",
"for",
"creating",
"KeyStore",
"object",
"from",
"ParsedKeystoreEntry",
"and",
"other",
"information",
"from",
"policy",
"file",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L621-L675 |
106,995 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.readKeystorePassword | private char[] readKeystorePassword(String keystorePasswordURL, File policyFile) throws Exception {
// try relative path to policy file
File f = new File(getPolicyFileHome(policyFile), keystorePasswordURL);
if (!f.exists()) {
// try absoluth path
f = new File(keystorePass... | java | private char[] readKeystorePassword(String keystorePasswordURL, File policyFile) throws Exception {
// try relative path to policy file
File f = new File(getPolicyFileHome(policyFile), keystorePasswordURL);
if (!f.exists()) {
// try absoluth path
f = new File(keystorePass... | [
"private",
"char",
"[",
"]",
"readKeystorePassword",
"(",
"String",
"keystorePasswordURL",
",",
"File",
"policyFile",
")",
"throws",
"Exception",
"{",
"// try relative path to policy file",
"File",
"f",
"=",
"new",
"File",
"(",
"getPolicyFileHome",
"(",
"policyFile",
... | Private method for reading password for keystore from file.
@param keystorePasswordURL URL to file which contain password for keystore
@param policyFile used policy file
@return password for keystore
@throws Exception when there was any problem during reading keystore password | [
"Private",
"method",
"for",
"reading",
"password",
"for",
"keystore",
"from",
"file",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L685-L704 |
106,996 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.gainPrincipalFromAlias | private String gainPrincipalFromAlias(String alias, KeyStore keystore) throws Exception {
if (keystore == null) {
return null;
}
if (!keystore.containsAlias(alias)) {
return null;
}
Certificate certificate = keystore.getCertificate(alias);
if (cer... | java | private String gainPrincipalFromAlias(String alias, KeyStore keystore) throws Exception {
if (keystore == null) {
return null;
}
if (!keystore.containsAlias(alias)) {
return null;
}
Certificate certificate = keystore.getCertificate(alias);
if (cer... | [
"private",
"String",
"gainPrincipalFromAlias",
"(",
"String",
"alias",
",",
"KeyStore",
"keystore",
")",
"throws",
"Exception",
"{",
"if",
"(",
"keystore",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"keystore",
".",
"containsAlias",
... | Private method for gaining X500Principal from keystore according its alias.
@param alias alias of principal
@param keystore KeyStore which is used by this policy file
@return name of gained X500Principal
@throws Exception when there was any problem during gaining Principal | [
"Private",
"method",
"for",
"gaining",
"X500Principal",
"from",
"keystore",
"according",
"its",
"alias",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L714-L730 |
106,997 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.getPolicyFileHome | private String getPolicyFileHome(File file) {
if (file == null || !file.exists()) {
return null;
}
return file.getAbsoluteFile().getParent();
} | java | private String getPolicyFileHome(File file) {
if (file == null || !file.exists()) {
return null;
}
return file.getAbsoluteFile().getParent();
} | [
"private",
"String",
"getPolicyFileHome",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"file",
".",
"getAbsoluteFile",
"(",
")",
".",
"getP... | Private method for gaining absolute path of folder with policy file .
@param file file with policy
@return absolute path for folder with policy file or null if file doesn't exist | [
"Private",
"method",
"for",
"gaining",
"absolute",
"path",
"of",
"folder",
"with",
"policy",
"file",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L738-L743 |
106,998 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.getJavaPolicies | private List<ParsedPolicy> getJavaPolicies() {
List<ParsedPolicy> list = new ArrayList<ParsedPolicy>();
int counter = 1;
String policyUrl = null;
while ((policyUrl = SecurityActions.getSecurityProperty("policy.url." + counter)) != null) {
try {
policyUrl = ex... | java | private List<ParsedPolicy> getJavaPolicies() {
List<ParsedPolicy> list = new ArrayList<ParsedPolicy>();
int counter = 1;
String policyUrl = null;
while ((policyUrl = SecurityActions.getSecurityProperty("policy.url." + counter)) != null) {
try {
policyUrl = ex... | [
"private",
"List",
"<",
"ParsedPolicy",
">",
"getJavaPolicies",
"(",
")",
"{",
"List",
"<",
"ParsedPolicy",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"ParsedPolicy",
">",
"(",
")",
";",
"int",
"counter",
"=",
"1",
";",
"String",
"policyUrl",
"=",
"null"... | Private method for gaining and parsing all policies defined in java.security file.
@return Parsed policies in list of ParsedPolicy | [
"Private",
"method",
"for",
"gaining",
"and",
"parsing",
"all",
"policies",
"defined",
"in",
"java",
".",
"security",
"file",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L750-L790 |
106,999 | pro-grade/pro-grade | src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java | ProGradePolicy.initializeStaticPolicy | private void initializeStaticPolicy(List<ProGradePolicyEntry> grantEntriesList) throws Exception {
// grant codeBase "file:${{java.ext.dirs}}/*" {
// permission java.security.AllPermission;
// };
ProGradePolicyEntry p1 = new ProGradePolicyEntry(true, debug);
Certificate[] certif... | java | private void initializeStaticPolicy(List<ProGradePolicyEntry> grantEntriesList) throws Exception {
// grant codeBase "file:${{java.ext.dirs}}/*" {
// permission java.security.AllPermission;
// };
ProGradePolicyEntry p1 = new ProGradePolicyEntry(true, debug);
Certificate[] certif... | [
"private",
"void",
"initializeStaticPolicy",
"(",
"List",
"<",
"ProGradePolicyEntry",
">",
"grantEntriesList",
")",
"throws",
"Exception",
"{",
"// grant codeBase \"file:${{java.ext.dirs}}/*\" {",
"// permission java.security.AllPermission;",
"// };",
"ProGradePolicyEntry",
"p1",
... | Private method for initializing static policy.
@throws Exception when there was any problem during initializing static policy | [
"Private",
"method",
"for",
"initializing",
"static",
"policy",
"."
] | 371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab | https://github.com/pro-grade/pro-grade/blob/371b0d1349c37bd048a06206d3fa1b0c3c1cd9ab/src/main/java/net/sourceforge/prograde/policy/ProGradePolicy.java#L797-L857 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.