本文整理汇总了Java中org.w3c.ddr.simple.exception.NameException类的典型用法代码示例。如果您正苦于以下问题:Java NameException类的具体用法?Java NameException怎么用?Java NameException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NameException类属于org.w3c.ddr.simple.exception包,在下文中一共展示了NameException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertProperties
import org.w3c.ddr.simple.exception.NameException; //导入依赖的package包/类
static void assertProperties(Properties expected, PropertyValues actual, PropertyRef [] refs) throws NameException, ValueException {
assertNotNull("Expecting non-null PropertyValues", actual);
assertFalse("Expected properties should not be empty", expected.isEmpty());
for(Object k : expected.keySet()) {
final String name = k.toString();
PropertyRef ref = null;
for(PropertyRef pr : refs) {
if(pr.getLocalPropertyName().equals(name)) {
ref = pr;
break;
}
}
assertNotNull("ref '" + name + "' should be found", ref);
final PropertyValue pv = actual.getValue(ref);
assertTrue("Expecting property '" + name + "' to be found for current device", pv.exists());
final String value = pv.getString();
final String expectedValue = expected.getProperty(name);
assertEquals("Expecting value " + expectedValue + " for "
+ name, expectedValue, value);
}
}
示例2: getValue
import org.w3c.ddr.simple.exception.NameException; //导入依赖的package包/类
public PropertyValue getValue(PropertyRef pr) throws NameException {
for (PropertyValue propertyValue : properties) {
if (propertyValue.getPropertyRef().equals(pr)) {
return propertyValue;
}
}
return null;
//throw new NameException(NameException.PROPERTY_NOT_RECOGNIZED, new IllegalArgumentException());
}
示例3: existProperty
import org.w3c.ddr.simple.exception.NameException; //导入依赖的package包/类
public VocabularyProperty existProperty(String propertyName, String aspect, String vocabularyIRI) throws NameException {
String realAspect = aspect;
VocabularyProperty vocabularyProperty = (VocabularyProperty) vocabularyPropertyCache.getCachedElement(propertyName + aspect + vocabularyIRI);
if (vocabularyProperty == null) {
if (vocabularies.get(vocabularyIRI) != null) {
Map<String, VocabularyProperty> propertyMap = vocabularies.get(vocabularyIRI).getProperties();
vocabularyProperty = propertyMap.get(propertyName);
if (vocabularyProperty != null) {
if (realAspect != null && realAspect.trim().length() > 0) {
if (ArrayUtils.contains(vocabularyProperty.getAspects(), realAspect)) {
vocabularyPropertyCache.setCachedElement(propertyName + aspect + vocabularyIRI, vocabularyProperty);
return vocabularyProperty;
} else {
throw new NameException(NameException.ASPECT_NOT_RECOGNIZED, "unknow \"" + realAspect + "\" aspect");
}
} else {
return vocabularyProperty;
}
} else {
throw new NameException(NameException.PROPERTY_NOT_RECOGNIZED, "unknow \"" + propertyName + "\" property");
}
} else {
throw new NameException(NameException.VOCABULARY_NOT_RECOGNIZED, "unknow \"" + vocabularyIRI + "\" vacabulary");
}
} else {
return vocabularyProperty;
}
}
示例4: getPropertyValues
import org.w3c.ddr.simple.exception.NameException; //导入依赖的package包/类
public PropertyValues getPropertyValues(Evidence evdnc, String localAspectName, String vocabularyIRI) throws NameException {
VocabularyProperty vocabularyProperty = vocabularyHolder.existProperty(localAspectName, null, vocabularyIRI);
PropertyName propertyName = new ODDRPropertyName(localAspectName, vocabularyIRI);
PropertyRef propertyRef = new ODDRPropertyRef(propertyName, vocabularyProperty.getDefaultAspect());
return getPropertyValues(evdnc, new PropertyRef[]{propertyRef});
}
示例5: existVocabulary
import org.w3c.ddr.simple.exception.NameException; //导入依赖的package包/类
public void existVocabulary(String vocabularyIRI) throws NameException {
if (vocabularies.get(vocabularyIRI) == null) {
throw new NameException(NameException.VOCABULARY_NOT_RECOGNIZED, "unknow \"" + vocabularyIRI + "\" vacabulary");
}
}
示例6: getPropertyValue
import org.w3c.ddr.simple.exception.NameException; //导入依赖的package包/类
public PropertyValue getPropertyValue(Evidence evdnc, PropertyRef pr) throws NameException {
return getPropertyValues(evdnc, new PropertyRef[]{pr}).getValue(pr);
}
示例7: newPropertyName
import org.w3c.ddr.simple.exception.NameException; //导入依赖的package包/类
public PropertyName newPropertyName(String localPropertyName, String vocabularyIRI) throws NameException {
vocabularyHolder.existProperty(localPropertyName, null, vocabularyIRI);
return new ODDRPropertyName(localPropertyName, vocabularyIRI);
}
示例8: newPropertyRef
import org.w3c.ddr.simple.exception.NameException; //导入依赖的package包/类
public PropertyRef newPropertyRef(PropertyName pn, String localAspectName) throws NameException {
vocabularyHolder.existProperty(pn.getLocalPropertyName(), localAspectName, pn.getNamespace());
return new ODDRPropertyRef(pn, localAspectName);
}