code
stringlengths
73
34.1k
label
stringclasses
1 value
public BoxFileUploadSession.Info getStatus() { URL statusURL = this.sessionInfo.getSessionEndpoints().getStatusEndpoint(); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), statusURL, HttpMethod.GET); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject jsonOb...
java
public void abort() { URL abortURL = this.sessionInfo.getSessionEndpoints().getAbortEndpoint(); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), abortURL, HttpMethod.DELETE); request.send(); }
java
public String getHeaderField(String fieldName) { // headers map is null for all regular response calls except when made as a batch request if (this.headers == null) { if (this.connection != null) { return this.connection.getHeaderField(fieldName); } else { ...
java
private InputStream getErrorStream() { InputStream errorStream = this.connection.getErrorStream(); if (errorStream != null) { final String contentEncoding = this.connection.getContentEncoding(); if (contentEncoding != null && contentEncoding.equalsIgnoreCase("gzip")) { ...
java
public void updateInfo(BoxWebLink.Info info) { URL url = WEB_LINK_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "PUT"); request.setBody(info.getPendingChanges()); String body = info.getPendingChanges(); ...
java
public static BoxStoragePolicyAssignment.Info create(BoxAPIConnection api, String policyID, String userID) { URL url = STORAGE_POLICY_ASSIGNMENT_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, HttpMethod.POST); JsonObject requestJSON = new JsonObject()...
java
public static BoxStoragePolicyAssignment.Info getAssignmentForTarget(final BoxAPIConnection api, String resolvedForType, String resolvedForID) { QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam("resolved_f...
java
public void delete() { URL url = STORAGE_POLICY_ASSIGNMENT_WITH_ID_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, HttpMethod.DELETE); request.send(); }
java
public static Iterable<BoxGroup.Info> getAllGroupsByName(final BoxAPIConnection api, String name) { final QueryStringBuilder builder = new QueryStringBuilder(); if (name == null || name.trim().isEmpty()) { throw new BoxAPIException("Searching groups by name requires a non NULL or non empty n...
java
public Collection<BoxGroupMembership.Info> getMemberships() { final BoxAPIConnection api = this.getAPI(); final String groupID = this.getID(); Iterable<BoxGroupMembership.Info> iter = new Iterable<BoxGroupMembership.Info>() { public Iterator<BoxGroupMembership.Info> iterator() { ...
java
public BoxGroupMembership.Info addMembership(BoxUser user, Role role) { BoxAPIConnection api = this.getAPI(); JsonObject requestJSON = new JsonObject(); requestJSON.add("user", new JsonObject().add("id", user.getID())); requestJSON.add("group", new JsonObject().add("id", this.getID()));...
java
public static BoxTermsOfService.Info create(BoxAPIConnection api, BoxTermsOfService.TermsOfServiceStatus termsOfServiceStatus, BoxTermsOfService.TermsOfServiceType termsOfServiceType, String text) { URL url = ALL_TER...
java
public static List<BoxTermsOfService.Info> getAllTermsOfServices(final BoxAPIConnection api, BoxTermsOfService.TermsOfServiceType termsOfServiceType) { QueryStringBui...
java
public static Map<String, Map<String, Metadata>> parseAndPopulateMetadataMap(JsonObject jsonObject) { Map<String, Map<String, Metadata>> metadataMap = new HashMap<String, Map<String, Metadata>>(); //Parse all templates for (JsonObject.Member templateMember : jsonObject) { if (templat...
java
public static List<Representation> parseRepresentations(JsonObject jsonObject) { List<Representation> representations = new ArrayList<Representation>(); for (JsonValue representationJson : jsonObject.get("entries").asArray()) { Representation representation = new Representation(representatio...
java
public void updateInfo(BoxTermsOfServiceUserStatus.Info info) { URL url = TERMS_OF_SERVICE_USER_STATUSES_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "PUT"); request.setBody(info.getPendingChanges()); BoxJSONRe...
java
public List<BoxAPIResponse> execute(List<BoxAPIRequest> requests) { this.prepareRequest(requests); BoxJSONResponse batchResponse = (BoxJSONResponse) send(); return this.parseResponse(batchResponse); }
java
protected void prepareRequest(List<BoxAPIRequest> requests) { JsonObject body = new JsonObject(); JsonArray requestsJSONArray = new JsonArray(); for (BoxAPIRequest request: requests) { JsonObject batchRequest = new JsonObject(); batchRequest.add("method", request.getMetho...
java
protected List<BoxAPIResponse> parseResponse(BoxJSONResponse batchResponse) { JsonObject responseJSON = JsonObject.readFrom(batchResponse.getJSON()); List<BoxAPIResponse> responses = new ArrayList<BoxAPIResponse>(); Iterator<JsonValue> responseIterator = responseJSON.get("responses").asArray().i...
java
private static void generateJson(CellScanner cellScanner, Function<Bytes, String> encoder, PrintStream out) throws JsonIOException { Gson gson = new GsonBuilder().serializeNulls().setDateFormat(DateFormat.LONG) .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).setVersion(1.0) ...
java
public static TxInfo getTransactionInfo(Environment env, Bytes prow, Column pcol, long startTs) { // TODO ensure primary is visible IteratorSetting is = new IteratorSetting(10, RollbackCheckIterator.class); RollbackCheckIterator.setLocktime(is, startTs); Entry<Key, Value> entry = ColumnUtil.checkColum...
java
public static boolean oracleExists(CuratorFramework curator) { boolean exists = false; try { exists = curator.checkExists().forPath(ZookeeperPath.ORACLE_SERVER) != null && !curator.getChildren().forPath(ZookeeperPath.ORACLE_SERVER).isEmpty(); } catch (Exception nne) { if (nne instanceo...
java
public void waitForAsyncFlush() { long numAdded = asyncBatchesAdded.get(); synchronized (this) { while (numAdded > asyncBatchesProcessed) { try { wait(); } catch (InterruptedException e) { throw new RuntimeException(e); } } } }
java
public static Span exact(Bytes row) { Objects.requireNonNull(row); return new Span(row, true, row, true); }
java
public static Span exact(CharSequence row) { Objects.requireNonNull(row); return exact(Bytes.of(row)); }
java
public static Span prefix(Bytes rowPrefix) { Objects.requireNonNull(rowPrefix); Bytes fp = followingPrefix(rowPrefix); return new Span(rowPrefix, true, fp == null ? Bytes.EMPTY : fp, false); }
java
public static Span prefix(CharSequence rowPrefix) { Objects.requireNonNull(rowPrefix); return prefix(Bytes.of(rowPrefix)); }
java
public void load(InputStream in) { try { PropertiesConfiguration config = new PropertiesConfiguration(); // disabled to prevent accumulo classpath value from being shortened config.setDelimiterParsingDisabled(true); config.load(in); ((CompositeConfiguration) internalConfig).addConfigur...
java
public void load(File file) { try { PropertiesConfiguration config = new PropertiesConfiguration(); // disabled to prevent accumulo classpath value from being shortened config.setDelimiterParsingDisabled(true); config.load(file); ((CompositeConfiguration) internalConfig).addConfigurati...
java
public static long getTxInfoCacheWeight(FluoConfiguration conf) { long size = conf.getLong(TX_INFO_CACHE_WEIGHT, TX_INFO_CACHE_WEIGHT_DEFAULT); if (size <= 0) { throw new IllegalArgumentException("Cache size must be positive for " + TX_INFO_CACHE_WEIGHT); } return size; }
java
public static long getVisibilityCacheWeight(FluoConfiguration conf) { long size = conf.getLong(VISIBILITY_CACHE_WEIGHT, VISIBILITY_CACHE_WEIGHT_DEFAULT); if (size <= 0) { throw new IllegalArgumentException( "Cache size must be positive for " + VISIBILITY_CACHE_WEIGHT); } return size; }
java
public static String parseServers(String zookeepers) { int slashIndex = zookeepers.indexOf("/"); if (slashIndex != -1) { return zookeepers.substring(0, slashIndex); } return zookeepers; }
java
public static String parseRoot(String zookeepers) { int slashIndex = zookeepers.indexOf("/"); if (slashIndex != -1) { return zookeepers.substring(slashIndex).trim(); } return "/"; }
java
public static long getGcTimestamp(String zookeepers) { ZooKeeper zk = null; try { zk = new ZooKeeper(zookeepers, 30000, null); // wait until zookeeper is connected long start = System.currentTimeMillis(); while (!zk.getState().isConnected() && System.currentTimeMillis() - start < 30000)...
java
public static Bytes toBytes(Text t) { return Bytes.of(t.getBytes(), 0, t.getLength()); }
java
public static void configure(Job conf, SimpleConfiguration config) { try { FluoConfiguration fconfig = new FluoConfiguration(config); try (Environment env = new Environment(fconfig)) { long ts = env.getSharedResources().getTimestampTracker().allocateTimestamp().getTxTimestamp(); ...
java
private void readUnread(CommitData cd, Consumer<Entry<Key, Value>> locksSeen) { // TODO make async // TODO need to keep track of ranges read (not ranges passed in, but actual data read... user // may not iterate over entire range Map<Bytes, Set<Column>> columnsToRead = new HashMap<>(); for (Entry<B...
java
public byte byteAt(int i) { if (i < 0) { throw new IndexOutOfBoundsException("i < 0, " + i); } if (i >= length) { throw new IndexOutOfBoundsException("i >= length, " + i + " >= " + length); } return data[offset + i]; }
java
public Bytes subSequence(int start, int end) { if (start > end || start < 0 || end > length) { throw new IndexOutOfBoundsException("Bad start and/end start = " + start + " end=" + end + " offset=" + offset + " length=" + length); } return new Bytes(data, offset + start, end - start); }
java
public byte[] toArray() { byte[] copy = new byte[length]; System.arraycopy(data, offset, copy, 0, length); return copy; }
java
public boolean contentEquals(byte[] bytes, int offset, int len) { Preconditions.checkArgument(len >= 0 && offset >= 0 && offset + len <= bytes.length); return contentEqualsUnchecked(bytes, offset, len); }
java
private boolean contentEqualsUnchecked(byte[] bytes, int offset, int len) { if (length != len) { return false; } return compareToUnchecked(bytes, offset, len) == 0; }
java
public static final Bytes of(byte[] array) { Objects.requireNonNull(array); if (array.length == 0) { return EMPTY; } byte[] copy = new byte[array.length]; System.arraycopy(array, 0, copy, 0, array.length); return new Bytes(copy); }
java
public static final Bytes of(byte[] data, int offset, int length) { Objects.requireNonNull(data); if (length == 0) { return EMPTY; } byte[] copy = new byte[length]; System.arraycopy(data, offset, copy, 0, length); return new Bytes(copy); }
java
public static final Bytes of(ByteBuffer bb) { Objects.requireNonNull(bb); if (bb.remaining() == 0) { return EMPTY; } byte[] data; if (bb.hasArray()) { data = Arrays.copyOfRange(bb.array(), bb.position() + bb.arrayOffset(), bb.limit() + bb.arrayOffset()); } else { data...
java
public static final Bytes of(CharSequence cs) { if (cs instanceof String) { return of((String) cs); } Objects.requireNonNull(cs); if (cs.length() == 0) { return EMPTY; } ByteBuffer bb = StandardCharsets.UTF_8.encode(CharBuffer.wrap(cs)); if (bb.hasArray()) { // this byte...
java
public static final Bytes of(String s) { Objects.requireNonNull(s); if (s.isEmpty()) { return EMPTY; } byte[] data = s.getBytes(StandardCharsets.UTF_8); return new Bytes(data, s); }
java
public static final Bytes of(String s, Charset c) { Objects.requireNonNull(s); Objects.requireNonNull(c); if (s.isEmpty()) { return EMPTY; } byte[] data = s.getBytes(c); return new Bytes(data); }
java
public boolean startsWith(Bytes prefix) { Objects.requireNonNull(prefix, "startWith(Bytes prefix) cannot have null parameter"); if (prefix.length > this.length) { return false; } else { int end = this.offset + prefix.length; for (int i = this.offset, j = prefix.offset; i < end; i++, j++) ...
java
public boolean endsWith(Bytes suffix) { Objects.requireNonNull(suffix, "endsWith(Bytes suffix) cannot have null parameter"); int startOffset = this.length - suffix.length; if (startOffset < 0) { return false; } else { int end = startOffset + this.offset + suffix.length; for (int i = s...
java
public void copyTo(int start, int end, byte[] dest, int destPos) { // this.subSequence(start, end).copyTo(dest, destPos) would allocate another Bytes object arraycopy(start, dest, destPos, end - start); }
java
public void copyTo(ColumnBuffer dest, LongPredicate timestampTest) { dest.clear(); if (key != null) { dest.key = new Key(key); } for (int i = 0; i < timeStamps.size(); i++) { long time = timeStamps.get(i); if (timestampTest.test(time)) { dest.add(time, values.get(i)); }...
java
public static AccumuloClient getClient(FluoConfiguration config) { return Accumulo.newClient().to(config.getAccumuloInstance(), config.getAccumuloZookeepers()) .as(config.getAccumuloUser(), config.getAccumuloPassword()).build(); }
java
public static byte[] encode(byte[] ba, int offset, long v) { ba[offset + 0] = (byte) (v >>> 56); ba[offset + 1] = (byte) (v >>> 48); ba[offset + 2] = (byte) (v >>> 40); ba[offset + 3] = (byte) (v >>> 32); ba[offset + 4] = (byte) (v >>> 24); ba[offset + 5] = (byte) (v >>> 16); ba[offset + 6] ...
java
public static long decodeLong(byte[] ba, int offset) { return ((((long) ba[offset + 0] << 56) + ((long) (ba[offset + 1] & 255) << 48) + ((long) (ba[offset + 2] & 255) << 40) + ((long) (ba[offset + 3] & 255) << 32) + ((long) (ba[offset + 4] & 255) << 24) + ((ba[offset + 5] & 255) << 16) + ((b...
java
public static byte[] concat(Bytes... listOfBytes) { int offset = 0; int size = 0; for (Bytes b : listOfBytes) { size += b.length() + checkVlen(b.length()); } byte[] data = new byte[size]; for (Bytes b : listOfBytes) { offset = writeVint(data, offset, b.length()); b.copyTo(0, ...
java
public static int writeVint(byte[] dest, int offset, int i) { if (i >= -112 && i <= 127) { dest[offset++] = (byte) i; } else { int len = -112; if (i < 0) { i ^= -1L; // take one's complement' len = -120; } long tmp = i; while (tmp != 0) { tmp = tmp >>...
java
public static int checkVlen(int i) { int count = 0; if (i >= -112 && i <= 127) { return 1; } else { int len = -112; if (i < 0) { i ^= -1L; // take one's complement' len = -120; } long tmp = i; while (tmp != 0) { tmp = tmp >> 8; len--; ...
java
private ResourceReport getResourceReport(TwillController controller, int maxWaitMs) { ResourceReport report = controller.getResourceReport(); int elapsed = 0; while (report == null) { report = controller.getResourceReport(); try { Thread.sleep(500); } catch (InterruptedException e)...
java
private void verifyApplicationName(String name) { if (name == null) { throw new IllegalArgumentException("Application name cannot be null"); } if (name.isEmpty()) { throw new IllegalArgumentException("Application name length must be > 0"); } String reason = null; char[] chars = name....
java
@Deprecated public FluoConfiguration addObservers(Iterable<ObserverSpecification> observers) { int next = getNextObserverId(); for (ObserverSpecification oconf : observers) { addObserver(oconf, next++); } return this; }
java
@Deprecated public FluoConfiguration clearObservers() { Iterator<String> iter1 = getKeys(OBSERVER_PREFIX.substring(0, OBSERVER_PREFIX.length() - 1)); while (iter1.hasNext()) { String key = iter1.next(); clearProperty(key); } return this; }
java
public void print() { Iterator<String> iter = getKeys(); while (iter.hasNext()) { String key = iter.next(); log.info(key + " = " + getRawString(key)); } }
java
public boolean hasRequiredClientProps() { boolean valid = true; valid &= verifyStringPropSet(CONNECTION_APPLICATION_NAME_PROP, CLIENT_APPLICATION_NAME_PROP); valid &= verifyStringPropSet(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP); valid &= verifyStringPropSet(ACCUMULO_PASSWORD_PROP, CLIENT_ACCUMULO_...
java
public boolean hasRequiredAdminProps() { boolean valid = true; valid &= hasRequiredClientProps(); valid &= verifyStringPropSet(ACCUMULO_TABLE_PROP, ADMIN_ACCUMULO_TABLE_PROP); return valid; }
java
public boolean hasRequiredMiniFluoProps() { boolean valid = true; if (getMiniStartAccumulo()) { // ensure that client properties are not set since we are using MiniAccumulo valid &= verifyStringPropNotSet(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP); valid &= verifyStringPropNotSet(ACCUMULO_...
java
public SimpleConfiguration getClientConfiguration() { SimpleConfiguration clientConfig = new SimpleConfiguration(); Iterator<String> iter = getKeys(); while (iter.hasNext()) { String key = iter.next(); if (key.startsWith(CONNECTION_PREFIX) || key.startsWith(ACCUMULO_PREFIX) || key.star...
java
public static void setDefaultConfiguration(SimpleConfiguration config) { config.setProperty(CONNECTION_ZOOKEEPERS_PROP, CONNECTION_ZOOKEEPERS_DEFAULT); config.setProperty(CONNECTION_ZOOKEEPER_TIMEOUT_PROP, CONNECTION_ZOOKEEPER_TIMEOUT_DEFAULT); config.setProperty(DFS_ROOT_PROP, DFS_ROOT_DEFAULT); config...
java
public static void configure(Job conf, SimpleConfiguration props) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); props.save(baos); conf.getConfiguration().set(PROPS_CONF_KEY, new String(baos.toByteArray(), StandardCharsets.UTF_8)); } catch (Exception e) { ...
java
public Stamp allocateTimestamp() { synchronized (this) { Preconditions.checkState(!closed, "tracker closed "); if (node == null) { Preconditions.checkState(allocationsInProgress == 0, "expected allocationsInProgress == 0 when node == null"); Preconditions.checkState(!updati...
java
private static boolean waitTillNoNotifications(Environment env, TableRange range) throws TableNotFoundException { boolean sawNotifications = false; long retryTime = MIN_SLEEP_MS; log.debug("Scanning tablet {} for notifications", range); long start = System.currentTimeMillis(); while (hasNoti...
java
private static void waitUntilFinished(FluoConfiguration config) { try (Environment env = new Environment(config)) { List<TableRange> ranges = getRanges(env); outer: while (true) { long ts1 = env.getSharedResources().getOracleClient().getStamp().getTxTimestamp(); for (TableRange range : ...
java
public static Range toRange(Span span) { return new Range(toKey(span.getStart()), span.isStartInclusive(), toKey(span.getEnd()), span.isEndInclusive()); }
java
public static Key toKey(RowColumn rc) { if ((rc == null) || (rc.getRow().equals(Bytes.EMPTY))) { return null; } Text row = ByteUtil.toText(rc.getRow()); if ((rc.getColumn().equals(Column.EMPTY)) || !rc.getColumn().isFamilySet()) { return new Key(row); } Text cf = ByteUtil.toText(rc.g...
java
public static Span toSpan(Range range) { return new Span(toRowColumn(range.getStartKey()), range.isStartKeyInclusive(), toRowColumn(range.getEndKey()), range.isEndKeyInclusive()); }
java
public static RowColumn toRowColumn(Key key) { if (key == null) { return RowColumn.EMPTY; } if ((key.getRow() == null) || key.getRow().getLength() == 0) { return RowColumn.EMPTY; } Bytes row = ByteUtil.toBytes(key.getRow()); if ((key.getColumnFamily() == null) || key.getColumnFamily(...
java
public FluoKeyValueGenerator set(RowColumnValue rcv) { setRow(rcv.getRow()); setColumn(rcv.getColumn()); setValue(rcv.getValue()); return this; }
java
public FluoKeyValue[] getKeyValues() { FluoKeyValue kv = keyVals[0]; kv.setKey(new Key(row, fam, qual, vis, ColumnType.WRITE.encode(1))); kv.getValue().set(WriteValue.encode(0, false, false)); kv = keyVals[1]; kv.setKey(new Key(row, fam, qual, vis, ColumnType.DATA.encode(0))); kv.getValue().set...
java
public RowColumn following() { if (row.equals(Bytes.EMPTY)) { return RowColumn.EMPTY; } else if (col.equals(Column.EMPTY)) { return new RowColumn(followingBytes(row)); } else if (!col.isQualifierSet()) { return new RowColumn(row, new Column(followingBytes(col.getFamily()))); } else if ...
java
public FluoMutationGenerator put(Column col, CharSequence value) { return put(col, value.toString().getBytes(StandardCharsets.UTF_8)); }
java
public static CuratorFramework newAppCurator(FluoConfiguration config) { return newCurator(config.getAppZookeepers(), config.getZookeeperTimeout(), config.getZookeeperSecret()); }
java
public static CuratorFramework newFluoCurator(FluoConfiguration config) { return newCurator(config.getInstanceZookeepers(), config.getZookeeperTimeout(), config.getZookeeperSecret()); }
java
public static CuratorFramework newCurator(String zookeepers, int timeout, String secret) { final ExponentialBackoffRetry retry = new ExponentialBackoffRetry(1000, 10); if (secret.isEmpty()) { return CuratorFrameworkFactory.newClient(zookeepers, timeout, timeout, retry); } else { return CuratorF...
java
public static void startAndWait(PersistentNode node, int maxWaitSec) { node.start(); int waitTime = 0; try { while (node.waitForInitialCreate(1, TimeUnit.SECONDS) == false) { waitTime += 1; log.info("Waited " + waitTime + " sec for ephemeral node to be created"); if (waitTime >...
java
public static NodeCache startAppIdWatcher(Environment env) { try { CuratorFramework curator = env.getSharedResources().getCurator(); byte[] uuidBytes = curator.getData().forPath(ZookeeperPath.CONFIG_FLUO_APPLICATION_ID); if (uuidBytes == null) { Halt.halt("Fluo Application UUID not found"...
java
private void readZookeeperConfig() { try (CuratorFramework curator = CuratorUtil.newAppCurator(config)) { curator.start(); accumuloInstance = new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_NAME), StandardCharsets.UTF_8); accumuloInstanceID = ...
java
@Override public void close() { status = TrStatus.CLOSED; try { node.close(); } catch (IOException e) { log.error("Failed to close ephemeral node"); throw new IllegalStateException(e); } }
java
private static Map<String, Set<String>> expand(Map<String, Set<String>> viewToPropNames) { Set<String> baseProps = viewToPropNames.get(PropertyView.BASE_VIEW); if (baseProps == null) { baseProps = ImmutableSet.of(); } if (!SquigglyConfig.isFilterImplicitlyIncludeBaseFields...
java
public List<SquigglyNode> parse(String filter) { filter = StringUtils.trim(filter); if (StringUtils.isEmpty(filter)) { return Collections.emptyList(); } // get it from the cache if we can List<SquigglyNode> cachedNodes = CACHE.getIfPresent(filter); if (cach...
java
public static <E> Collection<E> collectify(ObjectMapper mapper, Object source, Class<? extends Collection> targetCollectionType, Class<E> targetElementType) { CollectionType collectionType = mapper.getTypeFactory().constructCollectionType(targetCollectionType, targetElementType); return objectify(mapper...
java
public static List<Map<String, Object>> listify(ObjectMapper mapper, Object source) { return (List<Map<String, Object>>) collectify(mapper, source, List.class); }
java
public static <E> List<E> listify(ObjectMapper mapper, Object source, Class<E> targetElementType) { return (List<E>) collectify(mapper, source, List.class, targetElementType); }
java
public static Object objectify(ObjectMapper mapper, Object source) { return objectify(mapper, source, Object.class); }
java
public static <T> T objectify(ObjectMapper mapper, Object source, JavaType targetType) { try { return mapper.readValue(mapper.writeValueAsBytes(source), targetType); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e);...
java
public static Set<Map<String, Object>> setify(ObjectMapper mapper, Object source) { return (Set<Map<String, Object>>) collectify(mapper, source, Set.class); }
java
public static <E> Set<E> setify(ObjectMapper mapper, Object source, Class<E> targetElementType) { return (Set<E>) collectify(mapper, source, Set.class, targetElementType); }
java
public static String stringify(ObjectMapper mapper, Object object) { try { return mapper.writeValueAsString(object); } catch (JsonProcessingException e) { throw new IllegalArgumentException(e); } }
java
private Path getPath(PropertyWriter writer, JsonStreamContext sc) { LinkedList<PathElement> elements = new LinkedList<>(); if (sc != null) { elements.add(new PathElement(writer.getName(), sc.getCurrentValue())); sc = sc.getParent(); } while (sc != null) { ...
java
private boolean pathMatches(Path path, SquigglyContext context) { List<SquigglyNode> nodes = context.getNodes(); Set<String> viewStack = null; SquigglyNode viewNode = null; int pathSize = path.getElements().size(); int lastIdx = pathSize - 1; for (int i = 0; i < pathSiz...
java
public static SortedMap<String, Object> asMap() { SortedMap<String, Object> metrics = Maps.newTreeMap(); METRICS_SOURCE.applyMetrics(metrics); return metrics; }
java