当前位置: 首页>>代码示例>>Java>>正文


Java NameException类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:22,代码来源:Util.java

示例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());
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:10,代码来源:ODDRPropertyValues.java

示例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;
    }
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:36,代码来源:VocabularyHolder.java

示例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});
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:9,代码来源:DDRService.java

示例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");
    }
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:6,代码来源:VocabularyHolder.java

示例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);
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:4,代码来源:DDRService.java

示例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);
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:5,代码来源:DDRService.java

示例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);
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:5,代码来源:DDRService.java


注:本文中的org.w3c.ddr.simple.exception.NameException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。