Changeset 85 for java/main/src/main/java/com/framsticks/parsers/Schema.java
- Timestamp:
- 06/24/13 13:38:40 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/parsers/Schema.java
r84 r85 26 26 * classes definitions that can be used in f0 representation). Definitions are 27 27 * loaded from XML stream. 28 * 28 * 29 29 * @author Jarek Szymczak <name.surname@gmail.com> 30 30 * (please replace name and surname with my personal data) … … 46 46 /** 47 47 * Instantiates a new schema. 48 * 48 * 49 49 * @param inputStream 50 50 * the xml stream with schema … … 104 104 } 105 105 106 } catch (IOException e) { 107 logger.fatal("unexpected exception occurred: ", e); 108 throw e; 109 } catch (ParserConfigurationException e) { 110 logger.fatal("unexpected exception occurred: ", e); 111 throw e; 112 } catch (SAXException e) { 106 } catch (IOException | ParserConfigurationException | SAXException e) { 113 107 logger.fatal("unexpected exception occurred: ", e); 114 108 throw e; … … 121 115 * node under certain attribute getName. If value is not present or is other 122 116 * getType than integer 0 is returned. 123 * 117 * 124 118 * @return attribute value if value exists and it's integer (0 otherwise) 125 * 119 * 126 120 */ 127 121 private static int getIntAttribute(NamedNodeMap attributes, String name) { … … 152 146 * Method used for convenience, it retrieves the value stored in node under 153 147 * certain attribute getName. If value is not present method returns null. 154 * 148 * 155 149 * @param attributeName 156 150 * the attribute getName … … 158 152 * the node 159 153 * @return attribute value if value exists (null otherwise) 160 * 154 * 161 155 */ 162 156 private static String getAttributeFromNode(String attributeName, Node node) { … … 169 163 /** 170 164 * In this method analysis of single class is performed. 171 * 165 * 172 166 * @param classNode 173 167 * the class node … … 228 222 /** 229 223 * It analyses the single property within the class 230 * 224 * 231 225 * @param attributes 232 226 * the attributes of property … … 267 261 } 268 262 269 ParamBuilder builder = new ParamBuilder();270 builder. setId(id).setName(name).setHelp(description).setGroup(group).setFlags(flags);271 272 builder. setType(type);263 ParamBuilder builder = Param.build(); 264 builder.id(id).name(name).help(description).group(group).flags(flags); 265 266 builder.type(type); 273 267 274 268 if ("d".equals(type)) { 275 builder. setMin(extractAttribute(attributes, "MIN", Integer.class));276 builder. setMax(extractAttribute(attributes, "MAX", Integer.class));277 builder. setDef(extractAttribute(attributes, "DEF", Integer.class));269 builder.min(extractAttribute(attributes, "MIN", Integer.class)); 270 builder.max(extractAttribute(attributes, "MAX", Integer.class)); 271 builder.def(extractAttribute(attributes, "DEF", Integer.class)); 278 272 } else if ("f".equals(type)) { 279 builder. setMin(extractAttribute(attributes, "MIN", Double.class));280 builder. setMax(extractAttribute(attributes, "MAX", Double.class));281 builder. setDef(extractAttribute(attributes, "DEF", Double.class));273 builder.min(extractAttribute(attributes, "MIN", Double.class)); 274 builder.max(extractAttribute(attributes, "MAX", Double.class)); 275 builder.def(extractAttribute(attributes, "DEF", Double.class)); 282 276 } else if ("s".equals(type)) { 283 builder. setMin(extractAttribute(attributes, "MIN", Integer.class));284 builder. setMax(extractAttribute(attributes, "MAX", Integer.class));285 builder. setDef(extractAttribute(attributes, "DEF", Integer.class));286 builder. setDef(getAttribute(attributes, "DEF"));277 builder.min(extractAttribute(attributes, "MIN", Integer.class)); 278 builder.max(extractAttribute(attributes, "MAX", Integer.class)); 279 builder.def(extractAttribute(attributes, "DEF", Integer.class)); 280 builder.def(getAttribute(attributes, "DEF")); 287 281 } else { 288 builder. setType(type);289 } 290 return builder. build();282 builder.type(type); 283 } 284 return builder.finish(); 291 285 } 292 286
Note: See TracChangeset
for help on using the changeset viewer.