< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/AttributePSVImpl.java

Print this page


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.impl.xs;
  22 


  64     /** error codes and error messages */
  65     protected String[] fErrors = null;
  66 
  67     /** validation context: could be QName or XPath expression*/
  68     protected String fValidationContext = null;
  69 
  70     /** true if this object is immutable **/
  71     protected boolean fIsConstant;
  72 
  73     public AttributePSVImpl() {}
  74 
  75     public AttributePSVImpl(boolean isConstant, AttributePSVI attrPSVI) {
  76         fDeclaration = attrPSVI.getAttributeDeclaration();
  77         fTypeDecl = attrPSVI.getTypeDefinition();
  78         fSpecified = attrPSVI.getIsSchemaSpecified();
  79         fValue.copyFrom(attrPSVI.getSchemaValue());
  80         fValidationAttempted = attrPSVI.getValidationAttempted();
  81         fValidity = attrPSVI.getValidity();
  82         if (attrPSVI instanceof AttributePSVImpl) {
  83             final AttributePSVImpl attrPSVIImpl = (AttributePSVImpl) attrPSVI;
  84             fErrors = (attrPSVIImpl.fErrors != null) ?
  85                     (String[]) attrPSVIImpl.fErrors.clone() : null;
  86         }
  87         else {
  88             final StringList errorCodes = attrPSVI.getErrorCodes();
  89             final int length = errorCodes.getLength();
  90             if (length > 0) {
  91                 final StringList errorMessages = attrPSVI.getErrorMessages();
  92                 final String[] errors = new String[length << 1];
  93                 for (int i = 0, j = 0; i < length; ++i) {
  94                     errors[j++] = errorCodes.item(i);
  95                     errors[j++] = errorMessages.item(i);
  96                 }
  97                 fErrors = errors;
  98             }
  99         }
 100         fValidationContext = attrPSVI.getValidationContext();
 101         fIsConstant = isConstant;
 102     }
 103 
 104     //
 105     // AttributePSVI methods


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Nov 2017
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xerces.internal.impl.xs;
  23 


  65     /** error codes and error messages */
  66     protected String[] fErrors = null;
  67 
  68     /** validation context: could be QName or XPath expression*/
  69     protected String fValidationContext = null;
  70 
  71     /** true if this object is immutable **/
  72     protected boolean fIsConstant;
  73 
  74     public AttributePSVImpl() {}
  75 
  76     public AttributePSVImpl(boolean isConstant, AttributePSVI attrPSVI) {
  77         fDeclaration = attrPSVI.getAttributeDeclaration();
  78         fTypeDecl = attrPSVI.getTypeDefinition();
  79         fSpecified = attrPSVI.getIsSchemaSpecified();
  80         fValue.copyFrom(attrPSVI.getSchemaValue());
  81         fValidationAttempted = attrPSVI.getValidationAttempted();
  82         fValidity = attrPSVI.getValidity();
  83         if (attrPSVI instanceof AttributePSVImpl) {
  84             final AttributePSVImpl attrPSVIImpl = (AttributePSVImpl) attrPSVI;
  85             fErrors = (attrPSVIImpl.fErrors != null) ? attrPSVIImpl.fErrors.clone() : null;

  86         }
  87         else {
  88             final StringList errorCodes = attrPSVI.getErrorCodes();
  89             final int length = errorCodes.getLength();
  90             if (length > 0) {
  91                 final StringList errorMessages = attrPSVI.getErrorMessages();
  92                 final String[] errors = new String[length << 1];
  93                 for (int i = 0, j = 0; i < length; ++i) {
  94                     errors[j++] = errorCodes.item(i);
  95                     errors[j++] = errorMessages.item(i);
  96                 }
  97                 fErrors = errors;
  98             }
  99         }
 100         fValidationContext = attrPSVI.getValidationContext();
 101         fIsConstant = isConstant;
 102     }
 103 
 104     //
 105     // AttributePSVI methods


< prev index next >