code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Override
public void read(final File filename) {
filePath = filename;
//clear the history on global metadata table
globalMeta.clear();
super.read(filename);
} | java |
private void removeIndexTermRecursive(final Element parent) {
if (parent == null) {
return;
}
final NodeList children = parent.getChildNodes();
Element child;
for (int i = children.getLength() - 1; i >= 0; i--) {
if (children.item(i).getNodeType() == Node.... | java |
private Map<String, Element> cloneElementMap(final Map<String, Element> current) {
final Map<String, Element> topicMetaTable = new HashMap<>(16);
for (final Entry<String, Element> topicMetaItem: current.entrySet()) {
topicMetaTable.put(topicMetaItem.getKey(), (Element) resultDoc.importNode(t... | java |
public Processor setProperty(final String name, final String value) {
args.put(name, value);
return this;
} | java |
private void findTargets(final IndexTerm term) {
final List<IndexTerm> subTerms = term.getSubTerms();
List<IndexTermTarget> subTargets = null;
if (subTerms != null && ! subTerms.isEmpty()){
for (final IndexTerm subTerm : subTerms) {
subTargets = subTerm.getTargetList(... | java |
public void setBaseTempDir(final File tmp) {
if (!tmp.isAbsolute()) {
throw new IllegalArgumentException("Temporary directory must be absolute");
}
args.put("base.temp.dir", tmp.getAbsolutePath());
} | java |
public Processor newProcessor(final String transtype) {
if (ditaDir == null) {
throw new IllegalStateException();
}
if (!Configuration.transtypes.contains(transtype)) {
throw new IllegalArgumentException("Transtype " + transtype + " not supported");
}
retu... | java |
public static List<String> getInstalledPlugins() {
final List<Element> plugins = toList(getPluginConfiguration().getElementsByTagName("plugin"));
return plugins.stream()
.map((Element elem) -> elem.getAttributeNode("id"))
.filter(Objects::nonNull)
.map(Att... | java |
public static Document getPluginConfiguration() {
try (final InputStream in = Plugins.class.getClassLoader().getResourceAsStream(PLUGIN_CONF)) {
return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
} catch (final ParserConfigurationException | SAXException | IOExceptio... | java |
public final void addFeature(final String id, final Element elem) {
boolean isFile;
String value = elem.getAttribute("file");
if (!value.isEmpty()) {
isFile = true;
} else {
value = elem.getAttribute("value");
isFile = "file".equals(elem.getAttribute("... | java |
public void close() throws IOException {
if (outStream == null && outWriter == null) {
throw new IllegalStateException();
}
if (outStream != null) {
outStream.close();
}
if (outWriter != null) {
outWriter.close();
}
} | java |
public void writeStartElement(final String uri, final String qName) throws SAXException {
processStartElement();
final QName res = new QName(uri, qName);
addNamespace(res.uri, res.prefix, res);
elementStack.addFirst(res); // push
openStartElement = true;
} | java |
public void writeNamespace(final String prefix, final String uri) {
if (!openStartElement) {
throw new IllegalStateException("Current state does not allow Namespace writing");
}
final QName qName = elementStack.getFirst(); // peek
for (final NamespaceMapping p: qName.mappings... | java |
public void writeEndElement() throws SAXException {
processStartElement();
final QName qName = elementStack.remove(); // pop
transformer.endElement(qName.uri, qName.localName, qName.qName);
for (final NamespaceMapping p: qName.mappings) {
if (p.newMapping) {
t... | java |
public void writeProcessingInstruction(final String target, final String data) throws SAXException {
processStartElement();
transformer.processingInstruction(target, data != null ? data : "");
} | java |
public void writeComment(final String data) throws SAXException {
processStartElement();
final char[] ch = data.toCharArray();
transformer.comment(ch, 0, ch.length);
} | java |
@Deprecated
public static boolean isHTMLFile(final String lcasefn) {
for (final String ext: supportedHTMLExtensions) {
if (lcasefn.endsWith(ext)) {
return true;
}
}
return false;
} | java |
@Deprecated
public static boolean isResourceFile(final String lcasefn) {
for (final String ext: supportedResourceExtensions) {
if (lcasefn.endsWith(ext)) {
return true;
}
}
return false;
} | java |
@Deprecated
public static boolean isSupportedImageFile(final String lcasefn) {
for (final String ext: supportedImageExtensions) {
if (lcasefn.endsWith(ext)) {
return true;
}
}
return false;
} | java |
private static String normalizePath(final String path, final String separator) {
final String p = path.replace(WINDOWS_SEPARATOR, separator).replace(UNIX_SEPARATOR, separator);
// remove "." from the directory.
final List<String> dirs = new LinkedList<>();
final StringTokenizer tokenizer... | java |
public static boolean isAbsolutePath (final String path) {
if (path == null || path.trim().length() == 0) {
return false;
}
if (File.separator.equals(UNIX_SEPARATOR)) {
return path.startsWith(UNIX_SEPARATOR);
} else
if (File.separator.equals(WINDOWS_SEPA... | java |
public static String getExtension(final String file) {
final int index = file.indexOf(SHARP);
if (file.startsWith(SHARP)) {
return null;
} else if (index != -1) {
final String fileName = file.substring(0, index);
final int fileExtIndex = fileName.lastIndexOf(... | java |
public static String getName(final String aURLString) {
int pathnameEndIndex;
if (isWindows()) {
if (aURLString.contains(SHARP)) {
pathnameEndIndex = aURLString.lastIndexOf(SHARP);
} else {
pathnameEndIndex = aURLString.lastIndexOf(WINDOWS_SEPARATO... | java |
public static String getFullPathNoEndSeparator(final String aURLString) {
final int pathnameStartIndex = aURLString.indexOf(UNIX_SEPARATOR);
final int pathnameEndIndex = aURLString.lastIndexOf(UNIX_SEPARATOR);
String aPath = aURLString.substring(0, pathnameEndIndex);
return aPath;
} | java |
@Deprecated
public static String stripFragment(final String path) {
final int i = path.indexOf(SHARP);
if (i != -1) {
return path.substring(0, i);
} else {
return path;
}
} | java |
@Deprecated
public static String getFragment(final String path, final String defaultValue) {
final int i = path.indexOf(SHARP);
if (i != -1) {
return path.substring(i + 1);
} else {
return defaultValue;
}
} | java |
private static SchemaWrapper wrapPattern2(Pattern start, SchemaPatternBuilder spb, PropertyMap properties)
throws SAXException, IncorrectSchemaException {
if (properties.contains(RngProperty.FEASIBLE)) {
//Use a feasible transform
start = FeasibleTransform.transform(spb, start);
}
//Get... | java |
@Override
public AbstractPipelineOutput execute(final AbstractPipelineInput input)
throws DITAOTException {
final Collection<FileInfo> fis = job.getFileInfo(fileInfoFilter);
for (final FileInfo f: fis) {
final URI file = job.tempDirURI.resolve(f.uri);
logger.info(... | java |
public static void writeMapToXML(final Map<URI, Set<URI>> m, final File outputFile) throws IOException {
if (m == null) {
return;
}
final Properties prop = new Properties();
for (final Map.Entry<URI, Set<URI>> entry: m.entrySet()) {
final URI key = entry.getKey();... | java |
public void loadSubjectScheme(final File scheme) {
assert scheme.isAbsolute();
if (!scheme.exists()) {
throw new IllegalStateException();
}
logger.debug("Load subject scheme " + scheme);
try {
final DocumentBuilder builder = XMLUtils.getDocumentBuilder();... | java |
private void putValuePairsIntoMap(final Element subtree, final String elementName, final QName attName, final String category) {
if (subtree == null || attName == null) {
return;
}
Map<String, Set<String>> valueMap = validValuesMap.get(attName);
if (valueMap == null) {
... | java |
private void processMap() throws DITAOTException {
final URI in = job.tempDirURI.resolve(job.getFileInfo(fi -> fi.isInput).iterator().next().uri);
final List<XMLFilter> pipe = getProcessingPipe(in);
xmlUtils.transform(in, pipe);
} | java |
private List<XMLFilter> getProcessingPipe(final URI fileToParse) {
final List<XMLFilter> pipe = new ArrayList<>();
if (forceUnique) {
forceUniqueFilter = new ForceUniqueFilter();
forceUniqueFilter.setLogger(logger);
forceUniqueFilter.setJob(job);
forceUni... | java |
private Map<FileInfo, FileInfo> getCopyToMap() {
final Map<FileInfo, FileInfo> copyToMap = new HashMap<>();
if (forceUnique) {
forceUniqueFilter.copyToMap.forEach((dstFi, srcFi) -> {
job.add(dstFi);
copyToMap.put(dstFi, srcFi);
});
}
... | java |
private void performCopytoTask(final Map<FileInfo, FileInfo> copyToMap) {
for (final Map.Entry<FileInfo, FileInfo> entry : copyToMap.entrySet()) {
final URI copytoTarget = entry.getKey().uri;
final URI copytoSource = entry.getValue().uri;
final URI srcFile = job.tempDirURI.re... | java |
private void copyFileWithPIReplaced(final URI src, final URI target, final URI copytoTargetFilename, final URI inputMapInTemp) {
assert src.isAbsolute();
assert target.isAbsolute();
assert !copytoTargetFilename.isAbsolute();
assert inputMapInTemp.isAbsolute();
final File workdir ... | java |
public static File getPathtoRootmap(final URI traceFilename, final URI inputMap) {
assert traceFilename.isAbsolute();
assert inputMap.isAbsolute();
return toFile(getRelativePath(traceFilename, inputMap)).getParentFile();
} | java |
public void read(final File filename, final File tmpDir) {
tempdir = tmpDir != null ? tmpDir : filename.getParentFile();
try {
final TransformerHandler s = stf.newTransformerHandler();
s.getTransformer().setOutputProperty(OMIT_XML_DECLARATION, "yes");
s.setResult(new ... | java |
void initXMLReader(final File ditaDir, final boolean validate) throws SAXException {
reader = XMLUtils.getXMLReader();
reader.setFeature(FEATURE_NAMESPACE, true);
reader.setFeature(FEATURE_NAMESPACE_PREFIX, true);
if (validate) {
reader.setFeature(FEATURE_VALIDATION, true);
... | java |
void processParseResult(final URI currentFile) {
// Category non-copyto result
for (final Reference file: listFilter.getNonCopytoResult()) {
categorizeReferenceFile(file);
}
for (final Map.Entry<URI, URI> e : listFilter.getCopytoMap().entrySet()) {
final URI sourc... | java |
void addToWaitList(final Reference ref) {
final URI file = ref.filename;
assert file.isAbsolute() && file.getFragment() == null;
if (doneList.contains(file) || waitList.contains(ref) || file.equals(currentFile)) {
return;
}
waitList.add(ref);
} | java |
private FilterUtils parseFilterFile() {
final FilterUtils filterUtils;
if (ditavalFile != null) {
final DitaValReader ditaValReader = new DitaValReader();
ditaValReader.setLogger(logger);
ditaValReader.setJob(job);
ditaValReader.read(ditavalFile.toURI());
... | java |
private String getAttributeValue(final String elemQName, final QName attQName, final String value) {
if (StringUtils.isEmptyString(value) && !defaultValueMap.isEmpty()) {
final Map<String, String> defaultMap = defaultValueMap.get(attQName);
if (defaultMap != null) {
final... | java |
private URI replaceHREF(final QName attName, final Attributes atts) {
URI attValue = toURI(atts.getValue(attName.getNamespaceURI(), attName.getLocalPart()));
if (attValue != null) {
final String fragment = attValue.getFragment();
if (fragment != null) {
attValue =... | java |
public Alphabet getAlphabetForChar(final char theChar) {
Alphabet result = null;
for (final Alphabet alphabet : this.alphabets) {
if (alphabet.isContain(theChar)) {
result = alphabet;
break;
}
}
return result;
} | java |
public static URL correct(final File file) throws MalformedURLException {
if (file == null) {
throw new MalformedURLException("The url is null");
}
return new URL(correct(file.toURI().toString(), true));
} | java |
public static URL correct(final URL url) throws MalformedURLException {
if (url == null) {
throw new MalformedURLException("The url is null");
}
return new URL(correct(url.toString(), false));
} | java |
public static File getCanonicalFileFromFileUrl(final URL url) {
File file = null;
if (url == null) {
throw new NullPointerException("The URL cannot be null.");
}
if ("file".equals(url.getProtocol())) {
final String fileName = url.getFile();
final Strin... | java |
private static String correct(String url, final boolean forceCorrection) {
if (url == null) {
return null;
}
final String initialUrl = url;
// If there is a % that means the URL was already corrected.
if (!forceCorrection && url.contains("%")) {
return i... | java |
public static String getURL(final String fileName) {
if (fileName.startsWith("file:/")) {
return fileName;
} else {
final File file = new File(fileName);
return file.toURI().toString();
}
} | java |
public static boolean isAbsolute(final URI uri) {
final String p = uri.getPath();
return p != null && p.startsWith(URI_SEPARATOR);
} | java |
public static File toFile(final URI filename) {
if (filename == null) {
return null;
}
final URI f = stripFragment(filename);
if ("file".equals(f.getScheme()) && f.getPath() != null && f.isAbsolute()) {
return new File(f);
} else {
return toFil... | java |
public static File toFile(final String filename) {
if (filename == null) {
return null;
}
String f;
try {
f = URLDecoder.decode(filename, UTF8);
} catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
f... | java |
public static URI toURI(final String file) {
if (file == null) {
return null;
}
if (File.separatorChar == '\\' && file.indexOf('\\') != -1) {
return toURI(new File(file));
}
try {
return new URI(file);
} catch (final URISyntaxException ... | java |
public static URI setFragment(final URI path, final String fragment) {
try {
if (path.getPath() != null) {
return new URI(path.getScheme(), path.getUserInfo(), path.getHost(), path.getPort(), path.getPath(), path.getQuery(), fragment);
} else {
return new ... | java |
public static URI setPath(final URI orig, final String path) {
try {
return new URI(orig.getScheme(), orig.getUserInfo(), orig.getHost(), orig.getPort(), path, orig.getQuery(), orig.getFragment());
} catch (final URISyntaxException e) {
throw new RuntimeException(e.getMessage(), ... | java |
public static URI setScheme(final URI orig, final String scheme) {
try {
return new URI(scheme, orig.getUserInfo(), orig.getHost(), orig.getPort(), orig.getPath(), orig.getQuery(), orig.getFragment());
} catch (final URISyntaxException e) {
throw new RuntimeException(e.getMessage... | java |
public static URI getRelativePath(final URI base, final URI ref) {
final String baseScheme = base.getScheme();
final String refScheme = ref.getScheme();
final String baseAuth = base.getAuthority();
final String refAuth = ref.getAuthority();
if (!(((baseScheme == null && refScheme... | java |
public static URI setElementID(final URI relativePath, final String id) {
String topic = getTopicID(relativePath);
if (topic != null) {
return setFragment(relativePath, topic + (id != null ? SLASH + id : ""));
} else if (id == null) {
return stripFragment(relativePath);
... | java |
public static String getElementID(final String relativePath) {
final String fragment = FileUtils.getFragment(relativePath);
if (fragment != null) {
if (fragment.lastIndexOf(SLASH) != -1) {
final String id = fragment.substring(fragment.lastIndexOf(SLASH) + 1);
... | java |
public static String getTopicID(final URI relativePath) {
final String fragment = relativePath.getFragment();
if (fragment != null) {
final String id = fragment.lastIndexOf(SLASH) != -1
? fragment.substring(0, fragment.lastIndexOf(SLASH))
... | java |
@SuppressWarnings("rawtypes")
public static String join(final Collection coll, final String delim) {
final StringBuilder buff = new StringBuilder(256);
Iterator iter;
if ((coll == null) || coll.isEmpty()) {
return "";
}
iter = coll.iterator();
while (ite... | java |
@SuppressWarnings({ "rawtypes", "unchecked" })
public static String join(final Map value, final String delim) {
if (value == null || value.isEmpty()) {
return "";
}
final StringBuilder buf = new StringBuilder();
for (final Iterator<Map.Entry<String, String>> i = value.ent... | java |
public static String replaceAll(final String input,
final String pattern, final String replacement) {
final StringBuilder result = new StringBuilder();
int startIndex = 0;
int newIndex;
while ((newIndex = input.indexOf(pattern, startIndex)) >= 0) {
result.append(... | java |
public static String setOrAppend(final String target, final String value, final boolean withSpace) {
if (target == null) {
return value;
}if(value == null) {
return target;
} else {
if (withSpace && !target.endsWith(STRING_BLANK)) {
return targ... | java |
public static Locale getLocale(final String anEncoding) {
Locale aLocale = null;
String country = null;
String language = null;
String variant;
//Tokenize the string using "-" as the token string as per IETF RFC4646 (superceeds RFC3066).
final StringTokenizer tokenizer ... | java |
public static String escapeRegExp(final String value) {
final StringBuilder buff = new StringBuilder();
if (value == null || value.length() == 0) {
return "";
}
int index = 0;
// $( )+.[^{\
while (index < value.length()) {
final char current = valu... | java |
public static void normalizeAndCollapseWhitespace(final StringBuilder strBuffer) {
WhiteSpaceState currentState = WhiteSpaceState.WORD;
for (int i = strBuffer.length() - 1; i >= 0; i--) {
final char currentChar = strBuffer.charAt(i);
if (Character.isWhitespace(currentChar)) {
... | java |
public static Collection<String> split(final String value) {
if (value == null) {
return Collections.emptyList();
}
final String[] tokens = value.trim().split("\\s+");
return asList(tokens);
} | java |
@Override
public AbstractPipelineOutput execute(final AbstractPipelineInput input)
throws DITAOTException {
if (logger == null) {
throw new IllegalStateException("Logger not set");
}
final Collection<FileInfo> images = job.getFileInfo(f -> ATTR_FORMAT_VALUE_IMAGE.equa... | java |
public static final String idFromName(String name) {
Transliterator tr = Transliterator.getInstance("Any-Latin; Latin-ASCII"); //$NON-NLS-1$
return removeNonWord(tr.transliterate(name));
} | java |
private HttpEngine getResponse() throws IOException {
initHttpEngine();
if (httpEngine.hasResponse()) {
return httpEngine;
}
while (true) {
if (!execute(true)) {
continue;
}
Response response = httpEngine.getResponse();
Request followUp = httpEngine.followUpReque... | java |
private boolean execute(boolean readResponse) throws IOException {
try {
httpEngine.sendRequest();
route = httpEngine.getRoute();
handshake = httpEngine.getConnection() != null
? httpEngine.getConnection().getHandshake()
: null;
if (readResponse) {
httpEngine.read... | java |
@Override
public void close(IAsyncResultHandler<Void> result) {
vertx.executeBlocking(blocking -> {
super.close(result);
}, res -> {
if (res.failed())
result.handle(AsyncResultImpl.create(res.cause()));
});
} | java |
public static void reloadData(IAsyncHandler<Void> doneHandler) {
synchronized(URILoadingRegistry.class) {
if (instance == null) {
doneHandler.handle((Void) null);
return;
}
Map<URILoadingRegistry, IAsyncResultHandler<Void>> regs = instance.hand... | java |
protected void doQuotaExceededFailure(final IPolicyContext context, final TransferQuotaConfig config,
final IPolicyChain<?> chain, RateLimitResponse rtr) {
Map<String, String> responseHeaders = RateLimitingPolicy.responseHeaders(config, rtr,
defaultLimitHeader(), defaultRemainingHead... | java |
public static boolean isConstraintViolation(Exception e) {
Throwable cause = e;
while (cause != cause.getCause() && cause.getCause() != null) {
if (cause.getClass().getSimpleName().equals("ConstraintViolationException")) //$NON-NLS-1$
return true;
cause = cause.ge... | java |
public static void rollbackQuietly(EntityManager entityManager) {
if (entityManager.getTransaction().isActive()/* && entityManager.getTransaction().getRollbackOnly()*/) {
try {
entityManager.getTransaction().rollback();
} catch (Exception e) {
logger.error... | java |
public String getConfigProperty(String propertyName, String defaultValue) {
return getConfig().getString(propertyName, defaultValue);
} | java |
private IndexedPermissions loadPermissions() {
String userId = getCurrentUser();
try {
return new IndexedPermissions(getQuery().getPermissions(userId));
} catch (StorageException e) {
logger.error(Messages.getString("AbstractSecurityContext.ErrorLoadingPermissions") + use... | java |
@SuppressWarnings("nls")
protected DataSource datasourceFromConfig(JdbcOptionsBean config) {
Properties props = new Properties();
props.putAll(config.getDsProperties());
setConfigProperty(props, "jdbcUrl", config.getJdbcUrl());
setConfigProperty(props, "username", config.getUsername(... | java |
private void setConfigProperty(Properties props, String propName, Object value) {
if (value != null) {
props.setProperty(propName, String.valueOf(value));
}
} | java |
private ResourceBundle getBundle() {
String bundleKey = getBundleKey();
if (bundles.containsKey(bundleKey)) {
return bundles.get(bundleKey);
} else {
ResourceBundle bundle = loadBundle();
bundles.put(bundleKey, bundle);
return bundle;
}
... | java |
private ResourceBundle loadBundle() {
String pkg = clazz.getPackage().getName();
Locale locale = getLocale();
return PropertyResourceBundle.getBundle(pkg + ".messages", locale, clazz.getClassLoader(), new ResourceBundle.Control() { //$NON-NLS-1$
@Override
public List<Stri... | java |
public String format(String key, Object ... params) {
ResourceBundle bundle = getBundle();
if (bundle.containsKey(key)) {
String msg = bundle.getString(key);
return MessageFormat.format(msg, params);
} else {
return MessageFormat.format("!!{0}!!", key); //$NON... | java |
@SuppressWarnings("nls")
public void listDatabases(final IAsyncResultHandler<List<String>> handler) {
IHttpClientRequest request = httpClient.request(queryUrl.toString(), HttpMethod.GET,
result -> {
try {
if (result.isError() || result.getResult()... | java |
@SuppressWarnings("unchecked")
private static <T> T createCustomComponent(Class<T> componentType, Class<?> componentClass,
Map<String, String> configProperties) throws Exception {
if (componentClass == null) {
throw new IllegalArgumentException("Invalid component spec (class not foun... | java |
private static DataSource lookupDS(String dsJndiLocation) {
DataSource ds;
try {
InitialContext ctx = new InitialContext();
ds = (DataSource) ctx.lookup(dsJndiLocation);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (ds == null) ... | java |
protected File createWorkDir(File pluginArtifactFile) throws IOException {
File tempDir = File.createTempFile(pluginArtifactFile.getName(), "");
tempDir.delete();
tempDir.mkdirs();
return tempDir;
} | java |
private void indexPluginArtifact() throws IOException {
dependencyZips = new ArrayList<>();
Enumeration<? extends ZipEntry> entries = this.pluginArtifactZip.entries();
while (entries.hasMoreElements()) {
ZipEntry zipEntry = entries.nextElement();
if (zipEntry.getName().st... | java |
protected InputStream findClassContent(String className) throws IOException {
String primaryArtifactEntryName = "WEB-INF/classes/" + className.replace('.', '/') + ".class";
String dependencyEntryName = className.replace('.', '/') + ".class";
ZipEntry entry = this.pluginArtifactZip.getEntry(prima... | java |
public void close() throws IOException {
if (closed) { return; }
this.pluginArtifactZip.close();
for (ZipFile zipFile : this.dependencyZips) {
zipFile.close();
}
closed = true;
} | java |
protected PluginClassLoader createPluginClassLoader(final File pluginFile) throws IOException {
return new PluginClassLoader(pluginFile, Thread.currentThread().getContextClassLoader()) {
@Override
protected File createWorkDir(File pluginArtifactFile) throws IOException {
... | java |
protected Client getClientInternal(String idx) {
Client client;
synchronized (mutex) {
client = (Client) getMap().get(idx);
}
return client;
} | java |
private String getClientIndex(Client client) {
return getClientIndex(client.getOrganizationId(), client.getClientId(), client.getVersion());
} | java |
protected List<ContractSummaryBean> getClientContractsInternal(String organizationId, String clientId,
String version) throws StorageException {
List<ContractSummaryBean> rval = new ArrayList<>();
EntityManager entityManager = getActiveEntityManager();
String jpql =
"... | java |
public static void main(String[] args) {
File from;
File to;
if (args.length < 2) {
System.out.println("Usage: DataMigrator <pathToSourceFile> <pathToDestFile>"); //$NON-NLS-1$
return;
}
String frompath = args[0];
String topath =... | java |
public static Object readPrimitive(Class<?> clazz, String value) throws Exception {
if (clazz == String.class) {
return value;
} else if (clazz == Long.class) {
return Long.parseLong(value);
} else if (clazz == Integer.class) {
return Integer.parseInt(value);
... | java |
protected Object readPrimitive(JestResult result) throws Exception {
PrimitiveBean pb = result.getSourceAsObject(PrimitiveBean.class);
String value = pb.getValue();
Class<?> c = Class.forName(pb.getType());
return BackingStoreUtil.readPrimitive(c, value);
} | java |
private void connect() {
try {
URL url = new URL(this.endpoint);
connection = (HttpURLConnection) url.openConnection();
connection.setReadTimeout(this.readTimeoutMs);
connection.setConnectTimeout(this.connectTimeoutMs);
connection.setRequestMethod(this... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.