01: package net.sf.saxon.expr;
02:
03: import net.sf.saxon.value.SequenceType;
04:
05: /**
06: * Treat Expression: implements "treat as data-type ( expression )". This is a factory class only.
07: */
08:
09: public abstract class TreatExpression {
10:
11: /**
12: * Make a treat expression
13: * @return the expression
14: */
15:
16: public static Expression make(Expression sequence, SequenceType type) {
17: RoleLocator role = new RoleLocator(RoleLocator.TYPE_OP,
18: "treat as", 0, null);
19: role.setErrorCode("XTTE0570");
20: Expression e = CardinalityChecker.makeCardinalityChecker(
21: sequence, type.getCardinality(), role);
22: ItemChecker checker = new ItemChecker(e, type.getPrimaryType(),
23: role);
24: //role.setErrorCode("XP0050");
25: return checker;
26: }
27:
28: }
29:
30: //
31: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
32: // you may not use this file except in compliance with the License. You may obtain a copy of the
33: // License at http://www.mozilla.org/MPL/
34: //
35: // Software distributed under the License is distributed on an "AS IS" basis,
36: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
37: // See the License for the specific language governing rights and limitations under the License.
38: //
39: // The Original Code is: all this file.
40: //
41: // The Initial Developer of the Original Code is Michael H. Kay
42: //
43: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
44: //
45: // Contributor(s): none.
46: //
|