本文整理了Java中org.modeshape.schematic.document.Document.size()
方法的一些代码示例,展示了Document.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.size()
方法的具体详情如下:
包路径:org.modeshape.schematic.document.Document
类名称:Document
方法名:size
[英]Return the number of name-value pairs in this object.
[中]返回此对象中的名称-值对数。
代码示例来源:origin: org.fcrepo/modeshape-jcr
protected Bucket( BucketId id, Document bucketDoc, DocumentTranslator translator ) {
assert id != null;
assert bucketDoc != null;
this.id = id;
this.nameFactory = translator.getNameFactory();
this.stringValueFactory = translator.getStringFactory();
if (bucketDoc.isEmpty()) {
this.childNamesByKey = Collections.emptyMap();
this.childKeysByName = Collections.emptyMap();
} else {
int size = bucketDoc.size();
this.childNamesByKey = new LinkedHashMap<>(size);
this.childKeysByName = new HashMap<>(size);
for (Map.Entry<String, ?> entry : bucketDoc.toMap().entrySet()) {
NodeKey nodeKey = new NodeKey(entry.getKey());
String name = entry.getValue().toString();
childNamesByKey.put(nodeKey, name);
childKeysByName.put(name, nodeKey);
}
}
}
代码示例来源:origin: ModeShape/modeshape
protected Bucket( BucketId id, Document bucketDoc, DocumentTranslator translator ) {
assert id != null;
assert bucketDoc != null;
this.id = id;
this.nameFactory = translator.getNameFactory();
this.stringValueFactory = translator.getStringFactory();
if (bucketDoc.isEmpty()) {
this.childNamesByKey = Collections.emptyMap();
this.childKeysByName = Collections.emptyMap();
} else {
int size = bucketDoc.size();
this.childNamesByKey = new LinkedHashMap<>(size);
this.childKeysByName = new HashMap<>(size);
for (Map.Entry<String, ?> entry : bucketDoc.toMap().entrySet()) {
NodeKey nodeKey = new NodeKey(entry.getKey());
String name = entry.getValue().toString();
childNamesByKey.put(nodeKey, name);
childKeysByName.put(name, nodeKey);
}
}
}
代码示例来源:origin: org.modeshape/modeshape-schematic
@Override
protected void write(Document bson, Writer writer) throws IOException {
if (bson.size() == 0) {
writer.append("{ }");
return;
}
++depth;
writer.append('{').append('\n');
indent(writer);
Iterator<Field> iter = bson.fields().iterator();
if (iter.hasNext()) {
write(iter.next(), writer);
while (iter.hasNext()) {
writer.append(',').append('\n');
indent(writer);
write(iter.next(), writer);
}
}
writer.append('\n');
--depth;
indent(writer);
writer.append('}');
}
代码示例来源:origin: ModeShape/modeshape
@Override
protected void write(Document bson, Writer writer) throws IOException {
if (bson.size() == 0) {
writer.append("{ }");
return;
}
++depth;
writer.append('{').append('\n');
indent(writer);
Iterator<Field> iter = bson.fields().iterator();
if (iter.hasNext()) {
write(iter.next(), writer);
while (iter.hasNext()) {
writer.append(',').append('\n');
indent(writer);
write(iter.next(), writer);
}
}
writer.append('\n');
--depth;
indent(writer);
writer.append('}');
}
代码示例来源:origin: ModeShape/modeshape
/**
* Get the configuration information for the anonymous authentication provider.
*
* @return the anonymous provider configuration information; null if anonymous users are not allowed
*/
public AnonymousSecurity getAnonymous() {
Document anonymous = security.getDocument(FieldName.ANONYMOUS);
if (anonymous != null && anonymous.size() == 1) {
// Check the 'roleNames' field ...
List<?> roles = anonymous.getArray(FieldName.ANONYMOUS_ROLES);
if (roles != null && roles.isEmpty()) {
// Specified empty roles, so this is disabling anonymous logins ...
return null;
}
}
if (anonymous == null) anonymous = Schematic.newDocument();
return new AnonymousSecurity(anonymous);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
/**
* Get the configuration information for the anonymous authentication provider.
*
* @return the anonymous provider configuration information; null if anonymous users are not allowed
*/
public AnonymousSecurity getAnonymous() {
Document anonymous = security.getDocument(FieldName.ANONYMOUS);
if (anonymous != null && anonymous.size() == 1) {
// Check the 'roleNames' field ...
List<?> roles = anonymous.getArray(FieldName.ANONYMOUS_ROLES);
if (roles != null && roles.isEmpty()) {
// Specified empty roles, so this is disabling anonymous logins ...
return null;
}
}
if (anonymous == null) anonymous = Schematic.newDocument();
return new AnonymousSecurity(anonymous);
}
代码示例来源:origin: ModeShape/modeshape
if (value instanceof List<?>) return (List<?>)value;
Document doc = (Document)value;
BasicArray array = new BasicArray(doc.size());
final Iterator<String> indexIter = IndexSequence.infiniteSequence();
for (Document.Field field : doc.fields()) {
代码示例来源:origin: org.modeshape/modeshape-schematic
if (value instanceof List<?>) return (List<?>)value;
Document doc = (Document)value;
BasicArray array = new BasicArray(doc.size());
final Iterator<String> indexIter = IndexSequence.infiniteSequence();
for (Document.Field field : doc.fields()) {
代码示例来源:origin: ModeShape/modeshape
if (this.size() != that.size()) {
return false;
代码示例来源:origin: org.modeshape/modeshape-schematic
if (this.size() != that.size()) {
return false;
代码示例来源:origin: org.modeshape/modeshape-schematic
protected void addValidatorsForPatternProperties( Document parent,
Path parentPath,
Problems problems,
CompositeValidator validators ) {
Document properties = parent.getDocument("patternProperties");
if (properties != null && properties.size() != 0) {
for (Field field : properties.fields()) {
String name = field.getName();
Object value = field.getValue();
Path path = Paths.path(parentPath, "patternProperties", name);
if (!(value instanceof Document)) {
problems.recordError(path, "Expected a nested object");
}
Document propertySchema = (Document)value;
try {
Pattern namePattern = Pattern.compile(name);
Validator propertyValidator = create(propertySchema, path);
if (propertyValidator != null) {
validators.add(new PatternPropertyValidator(namePattern, propertyValidator));
}
} catch (PatternSyntaxException e) {
problems.recordError(path, "Expected the field name to be a regular expression");
}
}
}
}
代码示例来源:origin: ModeShape/modeshape
protected void addValidatorsForPatternProperties( Document parent,
Path parentPath,
Problems problems,
CompositeValidator validators ) {
Document properties = parent.getDocument("patternProperties");
if (properties != null && properties.size() != 0) {
for (Field field : properties.fields()) {
String name = field.getName();
Object value = field.getValue();
Path path = Paths.path(parentPath, "patternProperties", name);
if (!(value instanceof Document)) {
problems.recordError(path, "Expected a nested object");
}
Document propertySchema = (Document)value;
try {
Pattern namePattern = Pattern.compile(name);
Validator propertyValidator = create(propertySchema, path);
if (propertyValidator != null) {
validators.add(new PatternPropertyValidator(namePattern, propertyValidator));
}
} catch (PatternSyntaxException e) {
problems.recordError(path, "Expected the field name to be a regular expression");
}
}
}
}
代码示例来源:origin: ModeShape/modeshape
protected void assertMatch( Document doc1,
Document doc2 ) {
assertEquals(doc1.size(), doc2.size());
for (Document.Field field1 : doc1.fields()) {
if (field1.getValue() instanceof Document) {
assertMatch(field1.getValueAsDocument(), doc2.getDocument(field1.getName()));
} else {
Object value2 = doc2.get(field1.getName());
assertEquals(field1.getValue(), value2);
}
}
}
代码示例来源:origin: org.modeshape/modeshape-schematic
if (doc == null) return null;
Object value = null;
int numFields = doc.size();
if (numFields == 0) return doc;
try {
代码示例来源:origin: ModeShape/modeshape
if (doc == null) return null;
Object value = null;
int numFields = doc.size();
if (numFields == 0) return doc;
try {
代码示例来源:origin: ModeShape/modeshape
Document properties = parent.getDocument("properties");
Set<String> propertiesWithSchemas = new HashSet<>();
if (properties != null && properties.size() != 0) {
for (Field field : properties.fields()) {
String name = field.getName();
代码示例来源:origin: org.modeshape/modeshape-schematic
Document properties = parent.getDocument("properties");
Set<String> propertiesWithSchemas = new HashSet<>();
if (properties != null && properties.size() != 0) {
for (Field field : properties.fields()) {
String name = field.getName();
内容来源于网络,如有侵权,请联系作者删除!