protected Object readResolve() throws InvalidObjectException { // return the singleton instead of deserialized object. try { // backward compatibility with JDK1.3. we can't rely on the // order of inner classes if( this.getClass()==backwardCompatibiliyHook1.getClass() ) return thePreserve; if( this.getClass()==backwardCompatibiliyHook2.getClass() ) return theCollapse; if( this.getClass()==backwardCompatibiliyHook3.getClass() ) return theReplace; return get(getName()); } catch (DatatypeException bte) { throw new InvalidObjectException("Unknown Processing Mode"); } }
WhiteSpaceFacet( String nsUri, String typeName, XSDatatypeImpl baseType, TypeIncubator facets ) throws DatatypeException { this(nsUri,typeName, baseType, WhiteSpaceProcessor.get( (String)facets.getFacet(FACET_WHITESPACE)), facets.isFixed(FACET_WHITESPACE) ); }
protected Object readResolve() throws InvalidObjectException { // return the singleton instead of deserialized object. try { // backward compatibility with JDK1.3. we can't rely on the // order of inner classes if( this.getClass()==backwardCompatibiliyHook1.getClass() ) return thePreserve; if( this.getClass()==backwardCompatibiliyHook2.getClass() ) return theCollapse; if( this.getClass()==backwardCompatibiliyHook3.getClass() ) return theReplace; return get(getName()); } catch (DatatypeException bte) { throw new InvalidObjectException("Unknown Processing Mode"); } }
WhiteSpaceFacet( String nsUri, String typeName, XSDatatypeImpl baseType, TypeIncubator facets ) throws DatatypeException { this(nsUri,typeName, baseType, WhiteSpaceProcessor.get( (String)facets.getFacet(FACET_WHITESPACE)), facets.isFixed(FACET_WHITESPACE) ); }
protected Object readResolve() throws InvalidObjectException { // return the singleton instead of deserialized object. try { // backward compatibility with JDK1.3. we can't rely on the // order of inner classes if( this.getClass()==backwardCompatibiliyHook1.getClass() ) return thePreserve; if( this.getClass()==backwardCompatibiliyHook2.getClass() ) return theCollapse; if( this.getClass()==backwardCompatibiliyHook3.getClass() ) return theReplace; return get(getName()); } catch (DatatypeException bte) { throw new InvalidObjectException("Unknown Processing Mode"); } }
WhiteSpaceFacet( String nsUri, String typeName, XSDatatypeImpl baseType, TypeIncubator facets ) throws DatatypeException { this(nsUri,typeName, baseType, WhiteSpaceProcessor.get( (String)facets.getFacet(FACET_WHITESPACE)), facets.isFixed(FACET_WHITESPACE) ); }
protected Object readResolve() throws InvalidObjectException { // return the singleton instead of deserialized object. try { // backward compatibility with JDK1.3. we can't rely on the // order of inner classes if( this.getClass()==backwardCompatibiliyHook1.getClass() ) return thePreserve; if( this.getClass()==backwardCompatibiliyHook2.getClass() ) return theCollapse; if( this.getClass()==backwardCompatibiliyHook3.getClass() ) return theReplace; return get(getName()); } catch (DatatypeException bte) { throw new InvalidObjectException("Unknown Processing Mode"); } }
WhiteSpaceFacet( String nsUri, String typeName, XSDatatypeImpl baseType, TypeIncubator facets ) throws DatatypeException { this(nsUri,typeName, baseType, WhiteSpaceProcessor.get( (String)facets.getFacet(FACET_WHITESPACE)), facets.isFixed(FACET_WHITESPACE) ); }
protected Object readResolve() throws InvalidObjectException { // return the singleton instead of deserialized object. try { // backward compatibility with JDK1.3. we can't rely on the // order of inner classes if( this.getClass()==backwardCompatibiliyHook1.getClass() ) return thePreserve; if( this.getClass()==backwardCompatibiliyHook2.getClass() ) return theCollapse; if( this.getClass()==backwardCompatibiliyHook3.getClass() ) return theReplace; return get(getName()); } catch (DatatypeException bte) { throw new InvalidObjectException("Unknown Processing Mode"); } }
WhiteSpaceFacet( String nsUri, String typeName, XSDatatypeImpl baseType, TypeIncubator facets ) throws DatatypeException { this(nsUri,typeName, baseType, WhiteSpaceProcessor.get( (String)facets.getFacet(FACET_WHITESPACE)), facets.isFixed(FACET_WHITESPACE) ); }
/** test get method */ public void testGet() throws DatatypeException { assertSame( "whitespace in parameter must be allowed", WhiteSpaceProcessor.get("preserve"), WhiteSpaceProcessor.get("preserve \t \n \r ") ); assertSame( WhiteSpaceProcessor.get("collapse"), WhiteSpaceProcessor.get(" \r\n collapse \t ") ); assertSame( WhiteSpaceProcessor.get("replace"), WhiteSpaceProcessor.get(" \r\n\r\nreplace") ); try { WhiteSpaceProcessor.get("unknown"); fail("should throw exception"); }catch(DatatypeException e){;} }
/** test behavior of preserve */ public void testPreserve() throws DatatypeException { WhiteSpaceProcessor target = WhiteSpaceProcessor.get("preserve"); String[] tests = new String[] { "test", " a b c ", "\r\n \ta bb \t\t c \r\r\n\r " }; for( int i=0; i<tests.length; i++ ) assertEquals( tests[i], target.process(tests[i]) ); }
/** tests behavior of replace */ public void testReplace() throws DatatypeException { WhiteSpaceProcessor target = WhiteSpaceProcessor.get("replace"); assertEquals( target.process( "test"), "test"); assertEquals( target.process( " a b c "), " a b c "); assertEquals( target.process( "\r\n \ta bb \t\t c \r\r\n\r "), " a bb c "); }
/** tests behavior of collapse */ public void testCollapse() throws DatatypeException { WhiteSpaceProcessor target = WhiteSpaceProcessor.get("collapse"); assertEquals( target.process( "test"), "test"); assertEquals( target.process( " a b c "), "a b c"); assertEquals( target.process( "\r\n \ta bb \t\t c \r\r\n\r "), "a bb c"); assertEquals( target.process( "abc "), "abc"); assertEquals( target.process( "abc "), "abc"); }