本文整理了Java中org.n52.svalbard.decode.XmlNamespaceDecoderKey
类的一些代码示例,展示了XmlNamespaceDecoderKey
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlNamespaceDecoderKey
类的具体详情如下:
包路径:org.n52.svalbard.decode.XmlNamespaceDecoderKey
类名称:XmlNamespaceDecoderKey
[英]NamespaceDecoderKey implementation for XML namespace and Class.
[中]XML命名空间和类的NamespaceDecoderKey实现。
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
public AbstractSoapDecoder(String namespace) {
this.decoderKeys = Collections.<DecoderKey> singleton(new XmlNamespaceDecoderKey(namespace, XmlObject.class));
}
代码示例来源:origin: org.n52.svalbard/svalbard
@Override
public int getSimilarity(DecoderKey key) {
return getSimilarity(key, Object.class);
}
代码示例来源:origin: org.n52.svalbard/svalbard
@Override
protected String getTypeName() {
return getType().getSimpleName();
}
代码示例来源:origin: org.n52.svalbard/svalbard
@Override
protected int getSimilarity(DecoderKey key, Class<?> t) {
if (key != null && key.getClass() == getClass()) {
NamespaceDecoderKey<?> xmlKey = (NamespaceDecoderKey<?>) key;
if (Objects.equal(getNamespace(), xmlKey.getNamespace()) && xmlKey.getType() instanceof Class<?>) {
return ClassHelper.getSimiliarity(getType() != null ? getType() : t,
xmlKey.getType() != null ? (Class<?>) xmlKey.getType() : t);
} else {
return -1;
}
} else {
return -1;
}
}
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
@Override
protected int getSimilarity(DecoderKey key, Class<?> t) {
if (key != null && key.getClass() == getClass()) {
NamespaceDecoderKey<?> xmlKey = (NamespaceDecoderKey<?>) key;
if (Objects.equal(getNamespace(), xmlKey.getNamespace()) && xmlKey.getType() instanceof Class<?>) {
return ClassHelper.getSimiliarity(getType() != null ? getType() : t,
xmlKey.getType() != null ? (Class<?>) xmlKey.getType() : t);
} else {
return -1;
}
} else {
return -1;
}
}
}
代码示例来源:origin: org.n52.svalbard/svalbard
public static Set<DecoderKey> decoderKeysForElements(String namespace, Class<?>... elements) {
HashSet<DecoderKey> keys = new HashSet<>(elements.length);
for (Class<?> x : elements) {
keys.add(new XmlNamespaceDecoderKey(namespace, x));
}
return keys;
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
@Override
public int getSimilarity(DecoderKey key) {
return getSimilarity(key, Object.class);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
@Override
protected String getTypeName() {
return getType().getSimpleName();
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
public static Set<DecoderKey> decoderKeysForElements(String namespace, Class<?>... elements) {
HashSet<DecoderKey> keys = new HashSet<>(elements.length);
for (Class<?> x : elements) {
keys.add(new XmlNamespaceDecoderKey(namespace, x));
}
return keys;
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json
protected Decoder<?, XmlObject> getProcedureDescriptionDecoder(String pdf, XmlObject xb) {
return getDecoder(new XmlNamespaceDecoderKey(pdf, xb.getClass()));
}
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
public static DecoderKey getDecoderKey(final XmlObject doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc), doc.getClass());
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
public static <T extends XmlObject> DecoderKey getDecoderKey(T[] doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc[0]), doc.getClass());
}
代码示例来源:origin: org.n52.svalbard/svalbard
public static DecoderKey getDecoderKey(final XmlObject doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc), doc.getClass());
}
代码示例来源:origin: org.n52.svalbard/svalbard
public static <T extends XmlObject> DecoderKey getDecoderKey(T[] doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc[0]), doc.getClass());
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
public DecoderKey getDecoderKey(XmlObject doc) {
Node domNode = doc.getDomNode();
String namespaceURI = domNode.getNamespaceURI();
if (namespaceURI == null && domNode.getFirstChild() != null) {
namespaceURI = domNode.getFirstChild().getNamespaceURI();
}
/*
* if document starts with a comment, get next sibling (and ignore
* initial comment)
*/
if (namespaceURI == null &&
domNode.getFirstChild() != null &&
domNode.getFirstChild().getNextSibling() != null) {
namespaceURI = domNode.getFirstChild().getNextSibling().getNamespaceURI();
}
return new XmlNamespaceDecoderKey(namespaceURI, doc.getClass());
}
代码示例来源:origin: 52North/SOS
private DecoderKey getDecoderKey(XmlObject doc) {
Node domNode = doc.getDomNode();
String namespaceURI = domNode.getNamespaceURI();
if (namespaceURI == null && domNode.getFirstChild() != null) {
namespaceURI = domNode.getFirstChild().getNamespaceURI();
}
/*
* if document starts with a comment, get next sibling (and ignore
* initial comment)
*/
if (namespaceURI == null &&
domNode.getFirstChild() != null &&
domNode.getFirstChild().getNextSibling() != null) {
namespaceURI = domNode.getFirstChild().getNextSibling().getNamespaceURI();
}
return new XmlNamespaceDecoderKey(namespaceURI, doc.getClass());
}
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
try {
Decoder<?, List<SOAPHeaderElement>> decoder =
getDecoder(new XmlNamespaceDecoderKey(namespace, SOAPHeaderElement.class));
if (decoder != null) {
Object object = decoder.decode(headersByNamespace.get(namespace));
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
@Override
public OwsServiceCommunicationObject decode(XmlObject objectToDecode) throws DecodingException {
DecoderKey key = new XmlNamespaceDecoderKey(XmlHelper.getNamespace(objectToDecode), XmlObject.class);
Decoder<OwsServiceCommunicationObject, XmlObject> decoder = this.decoderRepository.getDecoder(key);
return decoder.decode(objectToDecode);
}
代码示例来源:origin: org.n52.sensorweb.sos/hibernate-common
private <T> T decodeXmlObject(XmlObject xbObject)
throws DecodingException {
DecoderKey key = CodingHelper.getDecoderKey(xbObject);
Decoder<T, XmlObject> decoder = decoderRepository.getDecoder(key);
if (decoder == null) {
DecoderKey schemaTypeKey = new XmlNamespaceDecoderKey(xbObject.schemaType().getName().getNamespaceURI(),
xbObject.getClass());
decoder = decoderRepository.getDecoder(schemaTypeKey);
}
if (decoder == null) {
throw new NoDecoderForKeyException(key);
}
return decoder.decode(xbObject);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json
private SosProcedureDescription<?> parseProcedureDesciption(String xml, String pdf)
throws DecodingException {
try {
final XmlObject xb = XmlObject.Factory.parse(xml);
Decoder<?, XmlObject> decoder = getDecoder(new XmlNamespaceDecoderKey(pdf, xb.getClass()));
if (decoder == null) {
throw new DecodingException(JSONConstants.PROCEDURE_DESCRIPTION_FORMAT,
"The requested %s is not supported!", JSONConstants.PROCEDURE_DESCRIPTION_FORMAT);
}
Object decode = decoder.decode(xb);
if (decode instanceof SosProcedureDescription<?>) {
return (SosProcedureDescription<?>) decode;
} else if (decode instanceof AbstractFeature) {
return new SosProcedureDescription<AbstractFeature>((AbstractFeature) decode);
} else {
throw new DecodingException("The decoded element {} is not of type {}!", decode.getClass().getName(),
AbstractFeature.class.getName());
}
} catch (XmlException xmle) {
throw new DecodingException("Error while parsing procedure description of InsertSensor request!", xmle);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!