Beispiel #1
0
 private void makePatternMap(List<String> patternPairs) throws IllegalArgumentException {
   if (patternPairs != null) {
     patternMap = new LinkedMap();
     for (String pair : patternPairs) {
       // Find the last occurrence of comma to avoid regexp quoting
       int pos = pair.lastIndexOf(',');
       if (pos < 0) {
         throw new IllegalArgumentException("Marformed pattern,int pair; no comma: " + pair);
       }
       String regexp = pair.substring(0, pos);
       String pristr = pair.substring(pos + 1);
       int pri;
       Pattern pat;
       try {
         pri = Integer.parseInt(pristr);
         int flags = Perl5Compiler.READ_ONLY_MASK;
         pat = RegexpUtil.getCompiler().compile(regexp, flags);
         patternMap.put(pat, pri);
       } catch (NumberFormatException e) {
         throw new IllegalArgumentException("Illegal priority: " + pristr);
       } catch (MalformedPatternException e) {
         throw new IllegalArgumentException("Illegal regexp: " + regexp);
       }
     }
   }
 }
 public void addPropertyMapping(PropertyMapping propertyMapping) throws XavaException {
   propertyMappings.put(propertyMapping.getProperty(), propertyMapping);
   modelProperties.add(propertyMapping.getProperty());
   // To keep order
   tableColumns.add(propertyMapping.getColumn());
   if (propertyMapping.hasFormula() && !getMetaModel().isAnnotatedEJB3()) {
     propertyMapping.getMetaProperty().setReadOnly(true);
   }
 }
 public void addReferenceMapping(ReferenceMapping referenceMapping) throws XavaException {
   if (referenceMappings == null) referenceMappings = new HashMap();
   referenceMappings.put(referenceMapping.getReference(), referenceMapping);
   referenceMapping.setContainer(this);
 }