本文整理了Java中org.modeshape.schematic.document.Document.get()
方法的一些代码示例,展示了Document.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.get()
方法的具体详情如下:
包路径:org.modeshape.schematic.document.Document
类名称:Document
方法名:get
[英]Gets the value in this document for the given field name.
[中]获取此文档中给定字段名的值。
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public Object getIndexProperty( String propertyName ) {
return doc.get(name);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
public boolean hasProperty( Document document,
Name propertyName ) {
// Get the properties container ...
Document properties = document.getDocument(PROPERTIES);
if (properties == null) {
return false;
}
// Get the namespace container for the property name's namespace ...
Document urlProps = properties.getDocument(propertyName.getNamespaceUri());
if (urlProps == null) {
return false;
}
// Get the property ...
Object fieldValue = urlProps.get(propertyName.getLocalName());
return !Null.matches(fieldValue);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public LinkedHashMap<String, Name> getChildrenMap() {
LinkedHashMap<String, Name> children = new LinkedHashMap<String, Name>();
if (!federatedDocument.containsField(DocumentTranslator.CHILDREN)) {
return children;
}
List<?> childrenArray = federatedDocument.getArray(DocumentTranslator.CHILDREN);
for (Object child : childrenArray) {
assert child instanceof Document;
Document childDocument = (Document)child;
String childId = translator.getKey(childDocument);
Name childName = translator.getNameFactory().create(childDocument.get(DocumentTranslator.NAME));
children.put(childId, childName);
}
return children;
}
代码示例来源:origin: ModeShape/modeshape
@Override
public Object getIndexProperty( String propertyName ) {
return doc.get(name);
}
代码示例来源:origin: ModeShape/modeshape
public boolean hasProperty( Document document,
Name propertyName ) {
// Get the properties container ...
Document properties = document.getDocument(PROPERTIES);
if (properties == null) {
return false;
}
// Get the namespace container for the property name's namespace ...
Document urlProps = properties.getDocument(propertyName.getNamespaceUri());
if (urlProps == null) {
return false;
}
// Get the property ...
Object fieldValue = urlProps.get(propertyName.getLocalName());
return !Null.matches(fieldValue);
}
代码示例来源:origin: ModeShape/modeshape
private String propertyAsString(Document document, String fieldName, String defaultValue) {
Object value = document.get(fieldName);
return value == null ? defaultValue : value.toString();
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
public Property getProperty( Document document,
Name propertyName ) {
// Get the properties container ...
Document properties = document.getDocument(PROPERTIES);
if (properties == null) {
return null;
}
// Get the namespace container for the property name's namespace ...
Document urlProps = properties.getDocument(propertyName.getNamespaceUri());
if (urlProps == null) {
return null;
}
// Get the property ...
Object fieldValue = urlProps.get(propertyName.getLocalName());
return fieldValue == null ? null : propertyFor(propertyName, fieldValue);
}
代码示例来源:origin: ModeShape/modeshape
private boolean propertyAsBoolean(Document document, String propertyName, boolean defaultValue) {
Object value = document.get(propertyName);
if (value == null) {
return defaultValue;
} else if (value instanceof Boolean) {
return (Boolean) value;
} else {
return Boolean.valueOf(value.toString());
}
}
}
代码示例来源: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: ModeShape/modeshape
private int propertyAsInt(Document document, String propertyName, int defaultValue) {
Object value = document.get(propertyName);
if (value == null) {
return defaultValue;
} else if (value instanceof Number) {
return ((Number) value).intValue();
} else {
return Integer.valueOf(value.toString());
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@SuppressWarnings( "unchecked" )
private <Type> Type createJaasProvider() throws LoginException {
Object value = this.document.get(FieldName.JAAS_POLICY_NAME);
String policyName = value instanceof String ? value.toString() : Default.JAAS_POLICY_NAME;
return (Type)new JaasProvider(policyName);
}
代码示例来源:origin: ModeShape/modeshape
@SuppressWarnings( "unchecked" )
private <Type> Type createAnonymousProvider() {
Object roles = this.document.get(FieldName.ANONYMOUS_ROLES);
Set<String> roleNames = new HashSet<String>();
if (roles instanceof Array) {
Array roleValues = (Array)roles;
for (Object roleName : roleValues) {
if (roleName instanceof String) {
roleNames.add(roleName.toString());
}
}
}
Object usernameValue = this.document.get(FieldName.ANONYMOUS_USERNAME);
String username = usernameValue instanceof String ? usernameValue.toString() : Default.ANONYMOUS_USERNAME;
return (Type)new AnonymousProvider(username, roleNames);
}
代码示例来源:origin: ModeShape/modeshape
@SuppressWarnings( "unchecked" )
private <Type> Type createJaasProvider() throws LoginException {
Object value = this.document.get(FieldName.JAAS_POLICY_NAME);
String policyName = value instanceof String ? value.toString() : Default.JAAS_POLICY_NAME;
return (Type)new JaasProvider(policyName);
}
代码示例来源:origin: ModeShape/modeshape
/**
* Gets property value.
*
* @param name property name.
* @return property value.
*/
public Object get(String name) {
Object obj = document.get(name);
return (obj instanceof BasicArray) ? ((BasicArray)obj).toArray() : obj;
}
代码示例来源:origin: ModeShape/modeshape
@Override
public void run() {
try {
ByteArrayInputStream input = new ByteArrayInputStream(bsonBytes);
Document doc = bsonReader.read(input);
doc.get(key);
} catch (Exception t) {
error.compareAndSet(null, t);
}
}
});
代码示例来源:origin: ModeShape/modeshape
@Override
public void run() {
try {
Document doc = reader.read(testData, introspectStringValues);
if (getValue) doc.get(key);
} catch (Exception t) {
error.compareAndSet(null, t);
}
}
});
代码示例来源:origin: org.modeshape/modeshape-schematic
protected void addValidatorsForDisallowedTypes( Document parent,
Path parentPath,
Problems problems,
CompositeValidator validators ) {
Object disallowed = parent.get("disallowed");
if (Null.matches(disallowed)) return;
String requiredName = parentPath.getLast();
if (requiredName != null) {
EnumSet<Type> disallowedTypes = Type.typesWithNames(disallowed);
validators.add(new DisallowedTypesValidator(requiredName, disallowedTypes));
}
}
代码示例来源:origin: ModeShape/modeshape
protected void addValidatorsForDisallowedTypes( Document parent,
Path parentPath,
Problems problems,
CompositeValidator validators ) {
Object disallowed = parent.get("disallowed");
if (Null.matches(disallowed)) return;
String requiredName = parentPath.getLast();
if (requiredName != null) {
EnumSet<Type> disallowedTypes = Type.typesWithNames(disallowed);
validators.add(new DisallowedTypesValidator(requiredName, disallowedTypes));
}
}
代码示例来源:origin: ModeShape/modeshape
protected void assertField( String name,
Object value ) {
Object actual = doc.get(name);
if (value == null) {
assertNull(actual);
} else {
assertEquals(value, actual);
}
}
代码示例来源:origin: ModeShape/modeshape
protected void assertField( String name,
Object value ) {
Object actual = bson.get(name);
if (value == null) {
assertTrue(Null.matches(actual));
} else {
assertEquals(value, actual);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!