public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); }
@Override public NumericNode numberNode(BigInteger v) { return v != null ? new BigIntegerNode(v) : null; }
public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); }
public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); }
public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); }
public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); }
public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); }
public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); }
@Override public Object parseValue(Object input) { if (input instanceof Number || input instanceof String) { return new BigIntegerNode(new BigInteger(input.toString())); } if (input instanceof BigIntegerNode) { return input; } throw valueParsingException(input, Number.class, String.class, BigIntegerNode.class); }
private BigIntegerNode decodeBigInteger(int size) { byte[] bytes = this.getByteArray(size); return new BigIntegerNode(new BigInteger(1, bytes)); }
private BigIntegerNode decodeBigInteger(int size) { byte[] bytes = this.getByteArray(size); return new BigIntegerNode(new BigInteger(1, bytes)); }
private BigIntegerNode decodeBigInteger(int size) { byte[] bytes = this.getByteArray(size); return new BigIntegerNode(new BigInteger(1, bytes)); }
@Override public Object parseLiteral(Object input) { if (input instanceof IntValue) { return new BigIntegerNode(((IntValue) input).getValue()); } else { throw new CoercingParseLiteralException(errorMessage(input, IntValue.class)); } } });
@Override public ObjectNode serializeDisk(final CatalogDisk d) { NullCheck.notNull(d); final ObjectMapper jom = new ObjectMapper(); final ObjectNode jd = jom.createObjectNode(); final ObjectNode jfs = CatalogJSONSerializer.serializeDirectory( jom, d.getFilesystemGraph(), d.getFilesystemRoot(), "/"); jd.put("type", "disk"); final CatalogDiskMetadata meta = d.getMeta(); jd.put("disk-name", meta.getDiskName().getValue()); jd.set("disk-size", new BigIntegerNode(meta.getSize())); jd.set("disk-id", new BigIntegerNode(meta.getDiskID().getValue())); jd.put("disk-filesystem-type", meta.getFilesystemType()); jd.set("disk-filesystem-root", jfs); return jd; } }
private static ObjectNode serializeFile( final ObjectMapper jom, final UnmodifiableGraph<CatalogNodeType, CatalogDirectoryEntry> g, final CatalogFileNode node, final String name) { final Instant atime = node.getAccessTime(); final Instant mtime = node.getModificationTime(); final Instant ctime = node.getCreationTime(); final ObjectNode jout = jom.createObjectNode(); jout.put("type", "file"); jout.put("name", name); jout.set("size", new BigIntegerNode(node.getSize())); jout.put("owner", node.getOwner()); jout.put("group", node.getGroup()); jout.put("access-time", atime.toString()); jout.put("modification-time", mtime.toString()); jout.put("creation-time", ctime.toString()); jout.set("inode", new BigIntegerNode(node.getID())); jout.put( "permissions", PosixFilePermissions.toString(node.getPermissions())); final Optional<CatalogFileHash> hash_opt = node.getHash(); if (hash_opt.isPresent()) { final ObjectNode jhash = CatalogJSONSerializer.serializeHash(jom, hash_opt.get()); jout.set("hash", jhash); } return jout; }
private static ObjectNode serializeDirectory( final ObjectMapper jom, final UnmodifiableGraph<CatalogNodeType, CatalogDirectoryEntry> g, final CatalogDirectoryNode node, final String name) { final Instant atime = node.getAccessTime(); final Instant mtime = node.getModificationTime(); final Instant ctime = node.getCreationTime(); final ObjectNode jout = jom.createObjectNode(); jout.put("type", "directory"); jout.put("name", name); jout.put("owner", node.getOwner()); jout.put("group", node.getGroup()); jout.put("access-time", atime.toString()); jout.put("modification-time", mtime.toString()); jout.put("creation-time", ctime.toString()); jout.set("inode", new BigIntegerNode(node.getID())); jout.put( "permissions", PosixFilePermissions.toString(node.getPermissions())); final ArrayNode ee = jom.createArrayNode(); final Set<CatalogDirectoryEntry> oe = g.outgoingEdgesOf(node); for (final CatalogDirectoryEntry edge : oe) { final String e_name = edge.getName(); final CatalogNodeType e_node = edge.getTarget(); ee.add(CatalogJSONSerializer.serializeNode(jom, g, e_node, e_name)); } jout.set("entries", ee); return jout; }
@Test public void testIsIntegerFunction() { // check that is-integer still works if input // is a BigIntegerNode not just IntNode Expression expr = Parser.compileString("is-integer(.)"); JsonNode context = new BigIntegerNode(BigInteger.ONE); JsonNode actual = expr.apply(context); assertTrue(actual.isBoolean()); assertTrue(actual.booleanValue()); }