/** * Creates the configuration node pointer for the current position. * * @param position the current position in the iteration * @return the node pointer */ @Override protected NodePointer createNodePointer(final int position) { return new ConfigurationNodePointer<>(getParent(), subNodes .get(position), getNodeHandler()); }
/** * Creates a node pointer for the specified bean. If the bean is a * configuration node (indicated by a wrapper object), a corresponding * pointer is returned. * * @param name the name of the node * @param bean the bean * @param locale the locale * @return a pointer for a configuration node if the bean is such a node */ @Override @SuppressWarnings("unchecked") /* Type casts are safe here; because of the way the NodeWrapper was constructed the node handler must be compatible with the node. */ public NodePointer createNodePointer(final QName name, final Object bean, final Locale locale) { if (bean instanceof NodeWrapper) { final NodeWrapper<?> wrapper = (NodeWrapper<?>) bean; return new ConfigurationNodePointer(wrapper.getNode(), locale, wrapper.getNodeHandler()); } return null; }
/** * Creates a node pointer for the specified bean. If the bean is a * configuration node, a corresponding pointer is returned. * * @param parent the parent node * @param name the name * @param bean the bean * @return a pointer for a configuration node if the bean is such a node */ @Override @SuppressWarnings("unchecked") /* Type casts are safe here, see above. Also, the hierarchy of node pointers is consistent, so a parent is compatible to a child. */ public NodePointer createNodePointer(final NodePointer parent, final QName name, final Object bean) { if (bean instanceof NodeWrapper) { final NodeWrapper<?> wrapper = (NodeWrapper<?>) bean; return new ConfigurationNodePointer((ConfigurationNodePointer) parent, wrapper.getNode(), wrapper.getNodeHandler()); } return null; }