KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > expr > TreatExpression


1 package net.sf.saxon.expr;
2 import net.sf.saxon.value.SequenceType;
3
4 /**
5 * Treat Expression: implements "treat as data-type ( expression )". This is a factory class only.
6 */

7
8 public abstract class TreatExpression {
9
10     /**
11     * Make a treat expression
12     * @return the expression
13     */

14
15     public static Expression make(Expression sequence, SequenceType type) {
16         RoleLocator role = new RoleLocator(RoleLocator.TYPE_OP, "treat as", 0, null);
17         role.setErrorCode("XTTE0570");
18         Expression e = CardinalityChecker.makeCardinalityChecker(sequence, type.getCardinality(), role);
19         ItemChecker checker = new ItemChecker(e, type.getPrimaryType(), role);
20         //role.setErrorCode("XP0050");
21
return checker;
22     }
23
24 }
25
26 //
27
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
28
// you may not use this file except in compliance with the License. You may obtain a copy of the
29
// License at http://www.mozilla.org/MPL/
30
//
31
// Software distributed under the License is distributed on an "AS IS" basis,
32
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
33
// See the License for the specific language governing rights and limitations under the License.
34
//
35
// The Original Code is: all this file.
36
//
37
// The Initial Developer of the Original Code is Michael H. Kay
38
//
39
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
40
//
41
// Contributor(s): none.
42
//
43
Popular Tags