KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > validate > rng > RngProperty


1 package com.thaiopensource.validate.rng;
2
3 import com.thaiopensource.util.PropertyId;
4 import com.thaiopensource.util.PropertyMap;
5 import com.thaiopensource.util.PropertyMapBuilder;
6 import com.thaiopensource.validate.FlagPropertyId;
7 import com.thaiopensource.validate.Option;
8 import com.thaiopensource.validate.FlagOption;
9 import com.thaiopensource.validate.SchemaReader;
10 import org.relaxng.datatype.DatatypeLibraryFactory;
11
12 public class RngProperty {
13
14   private RngProperty() { }
15
16   public static class DatatypeLibraryFactoryPropertyId extends PropertyId {
17     public DatatypeLibraryFactoryPropertyId(String JavaDoc name) {
18       super(name, DatatypeLibraryFactory.class);
19     }
20
21     public DatatypeLibraryFactory get(PropertyMap properties) {
22       return (DatatypeLibraryFactory)properties.get(this);
23     }
24
25     public DatatypeLibraryFactory put(PropertyMapBuilder builder, DatatypeLibraryFactory value) {
26       return (DatatypeLibraryFactory)builder.put(this, value);
27     }
28   }
29
30   public static final DatatypeLibraryFactoryPropertyId DATATYPE_LIBRARY_FACTORY
31           = new DatatypeLibraryFactoryPropertyId("DATATYPE_LIBRARY_FACTORY");
32   public static final FlagPropertyId CHECK_ID_IDREF = new FlagPropertyId("CHECK_ID_IDREF");
33   public static final FlagPropertyId FEASIBLE = new FlagPropertyId("FEASIBLE");
34
35   public static Option getOption(String JavaDoc uri) {
36     if (!uri.startsWith(SchemaReader.BASE_URI))
37       return null;
38     uri = uri.substring(SchemaReader.BASE_URI.length());
39     if (uri.equals("feasible"))
40       return new FlagOption(FEASIBLE);
41     if (uri.equals("check-id-idref"))
42       return new FlagOption(CHECK_ID_IDREF);
43     return null;
44   }
45 }
46
Popular Tags