1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 package org.apache.openoffice.ooxml.parser.attribute; 23 24 /** Store information about a single attribute (per state) that was read 25 * from the parse table. 26 * 27 * Note that an attribute that is defined for more than one state has one 28 * AttributeDescriptor object per state. 29 * 30 */ 31 public class AttributeDescriptor 32 { AttributeDescriptor( final int nPrefixId, final int nAttributeId, final boolean bCanBeUnqualified, final boolean bIsOptional, final String sDefaultValue, final String sAttributeName, final int nAttributeTypeId)33 public AttributeDescriptor ( 34 final int nPrefixId, 35 final int nAttributeId, 36 final boolean bCanBeUnqualified, 37 final boolean bIsOptional, 38 final String sDefaultValue, 39 final String sAttributeName, 40 final int nAttributeTypeId) 41 { 42 mnNamespaceId = nPrefixId; 43 mnAttributeId = nAttributeId; 44 mbCanBeUnqualified = bCanBeUnqualified; 45 mbIsOptional = bIsOptional; 46 msDefaultValue = sDefaultValue; 47 msAttributeName = sAttributeName; 48 mnAttributeTypeId = nAttributeTypeId; 49 } 50 51 52 53 GetTypeId()54 public int GetTypeId() 55 { 56 return mnAttributeTypeId; 57 } 58 59 60 61 GetNamespaceId()62 public int GetNamespaceId () 63 { 64 return mnNamespaceId; 65 } 66 67 68 69 GetNameId()70 public int GetNameId () 71 { 72 return mnAttributeId; 73 } 74 75 76 77 CanBeUnqualified()78 public boolean CanBeUnqualified () 79 { 80 return mbCanBeUnqualified; 81 } 82 83 84 85 IsOptional()86 public boolean IsOptional () 87 { 88 return mbIsOptional; 89 } 90 91 92 93 GetDefaultValue()94 public String GetDefaultValue () 95 { 96 return msDefaultValue; 97 } 98 99 100 101 GetName()102 public String GetName () 103 { 104 return msAttributeName; 105 } 106 107 108 109 110 @Override toString()111 public String toString () 112 { 113 return String.format( 114 "attribute %s(%d) of type %d", 115 msAttributeName, 116 mnAttributeId, 117 mnAttributeTypeId); 118 } 119 120 121 122 123 private final int mnNamespaceId; 124 private final int mnAttributeId; 125 private final boolean mbCanBeUnqualified; 126 private final boolean mbIsOptional; 127 private final String msDefaultValue; 128 private final String msAttributeName; 129 private final int mnAttributeTypeId; 130 } 131