View Javadoc
1 /* 2 * Copyright (C) 2002 Carsten Krebs (Team-Konzept GmbH & Co.KG) 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 package com.teamkonzept.dom4jb.dom; 19 20 import com.teamkonzept.dom4jb.schema.TextDescriptor; 21 22 public class Text extends CharacterData implements org.w3c.dom.Text { 23 24 private final TextDescriptor descriptor; 25 private final Object bean; 26 private String text; 27 private boolean isInitialized; 28 29 /*** Creates new Text */ 30 public Text( 31 final Document document, 32 final TextDescriptor descriptor, 33 final Object bean) { 34 super(document); 35 this.descriptor = descriptor; 36 this.bean = bean; 37 this.isInitialized = false; 38 } 39 40 public final short getNodeType() { 41 return TEXT_NODE; 42 } 43 44 public String getNodeName() { 45 return "#text"; 46 } 47 48 public String getData() { 49 if (!isInitialized) { 50 text = descriptor.getValue(bean); 51 isInitialized = true; 52 } 53 return text; 54 } 55 56 /*** 57 * Breaks this node into two nodes at the specified <code>offset</code>, 58 * keeping both in the tree as siblings. After being split, this node 59 * will contain all the content up to the <code>offset</code> point. A 60 * new node of the same type, which contains all the content at and 61 * after the <code>offset</code> point, is returned. If the original 62 * node had a parent node, the new node is inserted as the next sibling 63 * of the original node. When the <code>offset</code> is equal to the 64 * length of this node, the new node has no data. 65 * @param offset The 16-bit unit offset at which to split, starting from 66 * <code>0</code>. 67 * @return The new node, of the same type as this node. 68 */ 69 public org.w3c.dom.Text splitText(final int offset) { 70 throw new UnsupportedOperationException( 71 "Method splitText(" + "int) not yet implemented."); 72 } 73 74 public boolean accept(final Filter filter) { 75 return filter.match((Text) this); 76 } 77 }

This page was automatically generated by Maven