@SuppressWarnings("static-method") public <T extends LeafSetEntryNode<?>> @NonNull T intern(final @NonNull T sample) { if (!sample.getAttributes().isEmpty()) { // Non-empty attributes, do not intern return sample; } /* * We do not perform type checks here as they are implied by #forSchema(LeafListSchemaNode). Any misuse can * result in inappropriate candidates being interned, but the alternative would be quite a bit slower. */ @SuppressWarnings("unchecked") final T ret = (T) INTERNER.intern(sample); LOG.trace("Interned object {} to {}", sample, ret); return ret; }
@SuppressWarnings("static-method") public <T extends LeafSetEntryNode<?>> @NonNull T intern(final @NonNull T sample) { if (!sample.getAttributes().isEmpty()) { // Non-empty attributes, do not intern return sample; } /* * We do not perform type checks here as they are implied by #forSchema(LeafListSchemaNode). Any misuse can * result in inappropriate candidates being interned, but the alternative would be quite a bit slower. */ @SuppressWarnings("unchecked") final T ret = (T) INTERNER.intern(sample); LOG.trace("Interned object {} to {}", sample, ret); return ret; }
private boolean wasProcessAsSimpleNode(final NormalizedNode<?, ?> node) throws IOException { if (node instanceof LeafSetEntryNode) { final LeafSetEntryNode<?> nodeAsLeafList = (LeafSetEntryNode<?>)node; if(writer instanceof NormalizedNodeStreamAttributeWriter) { ((NormalizedNodeStreamAttributeWriter) writer).leafSetEntryNode(nodeAsLeafList.getValue(), nodeAsLeafList.getAttributes()); } else { writer.leafSetEntryNode(nodeAsLeafList.getValue()); } return true; } else if (node instanceof LeafNode) { final LeafNode<?> nodeAsLeaf = (LeafNode<?>)node; if(writer instanceof NormalizedNodeStreamAttributeWriter) { ((NormalizedNodeStreamAttributeWriter) writer).leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue(), nodeAsLeaf.getAttributes()); } else { writer.leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue()); } return true; } else if (node instanceof AnyXmlNode) { final AnyXmlNode anyXmlNode = (AnyXmlNode)node; writer.anyxmlNode(anyXmlNode.getIdentifier(), anyXmlNode.getValue()); return true; } return false; }
private boolean wasProcessAsSimpleNode(final NormalizedNode<?, ?> node) throws IOException { if (node instanceof LeafSetEntryNode) { if (currentDepth < maxDepth) { final LeafSetEntryNode<?> nodeAsLeafList = (LeafSetEntryNode<?>) node; if (writer instanceof NormalizedNodeStreamAttributeWriter) { ((NormalizedNodeStreamAttributeWriter) writer).leafSetEntryNode(nodeAsLeafList.getValue(), nodeAsLeafList.getAttributes()); } else { writer.leafSetEntryNode(nodeAsLeafList.getValue()); } } return true; } else if (node instanceof LeafNode) { final LeafNode<?> nodeAsLeaf = (LeafNode<?>)node; if(writer instanceof NormalizedNodeStreamAttributeWriter) { ((NormalizedNodeStreamAttributeWriter) writer).leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue(), nodeAsLeaf.getAttributes()); } else { writer.leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue()); } return true; } else if (node instanceof AnyXmlNode) { final AnyXmlNode anyXmlNode = (AnyXmlNode)node; writer.anyxmlNode(anyXmlNode.getIdentifier(), anyXmlNode.getValue()); return true; } return false; }
protected boolean wasProcessAsSimpleNode(final NormalizedNode<?, ?> node) throws IOException { if (node instanceof LeafSetEntryNode) { final LeafSetEntryNode<?> nodeAsLeafList = (LeafSetEntryNode<?>)node; final QName name = nodeAsLeafList.getIdentifier().getNodeType(); if (writer instanceof NormalizedNodeStreamAttributeWriter) { ((NormalizedNodeStreamAttributeWriter) writer).leafSetEntryNode(name, nodeAsLeafList.getValue(), nodeAsLeafList.getAttributes()); } else { writer.leafSetEntryNode(name, nodeAsLeafList.getValue()); } return true; } else if (node instanceof LeafNode) { final LeafNode<?> nodeAsLeaf = (LeafNode<?>)node; if (writer instanceof NormalizedNodeStreamAttributeWriter) { ((NormalizedNodeStreamAttributeWriter) writer).leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue(), nodeAsLeaf.getAttributes()); } else { writer.leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue()); } return true; } else if (node instanceof AnyXmlNode) { final AnyXmlNode anyXmlNode = (AnyXmlNode)node; writer.anyxmlNode(anyXmlNode.getIdentifier(), anyXmlNode.getValue()); return true; } return false; }
protected boolean wasProcessAsSimpleNode(final NormalizedNode<?, ?> node) throws IOException { if (node instanceof LeafSetEntryNode) { final LeafSetEntryNode<?> nodeAsLeafList = (LeafSetEntryNode<?>)node; final QName name = nodeAsLeafList.getIdentifier().getNodeType(); if (writer instanceof NormalizedNodeStreamAttributeWriter) { ((NormalizedNodeStreamAttributeWriter) writer).leafSetEntryNode(name, nodeAsLeafList.getValue(), nodeAsLeafList.getAttributes()); } else { writer.leafSetEntryNode(name, nodeAsLeafList.getValue()); } return true; } else if (node instanceof LeafNode) { final LeafNode<?> nodeAsLeaf = (LeafNode<?>)node; if (writer instanceof NormalizedNodeStreamAttributeWriter) { ((NormalizedNodeStreamAttributeWriter) writer).leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue(), nodeAsLeaf.getAttributes()); } else { writer.leafNode(nodeAsLeaf.getIdentifier(), nodeAsLeaf.getValue()); } return true; } else if (node instanceof AnyXmlNode) { final AnyXmlNode anyXmlNode = (AnyXmlNode)node; writer.anyxmlNode(anyXmlNode.getIdentifier(), anyXmlNode.getValue()); return true; } return false; }