AttributeType findType(Class binding) {
      for (Schema schema : typeMappingProfiles) {
        for (Map.Entry<Name, AttributeType> e : schema.entrySet()) {
          AttributeType at = e.getValue();
          if (at.getBinding() != null && at.getBinding().equals(binding)) {
            return at;
          }
        }

        for (AttributeType at : schema.values()) {
          if (binding.isAssignableFrom(at.getBinding())) {
            return at;
          }
        }
      }
      return null;
    }
Esempio n. 2
0
 @SuppressWarnings("unchecked")
 protected void importSchema(Schema schema) {
   for (Iterator it = schema.entrySet().iterator(); it.hasNext(); ) {
     Map.Entry entry = (Entry) it.next();
     Name key = (Name) entry.getKey();
     Object value = entry.getValue();
     if (typeRegistry.containsKey(key)) {
       LOGGER.finer(
           "Ignoring " + key + " as it already exists. type " + value.getClass().getName());
     } else {
       LOGGER.finer("Importing " + key + " of type " + value.getClass().getName());
       if (value instanceof AttributeType) {
         AttributeType type = (AttributeType) value;
         register(type, false);
       } else if (value instanceof AttributeDescriptor) {
         AttributeDescriptor descriptor = (AttributeDescriptor) value;
         register(descriptor);
       }
     }
   }
   LOGGER.fine("Schema " + schema.getURI() + " imported successfully");
 }
 /**
  * Specifies a number of attribute type bindings.
  *
  * @param schema The schema containing the attribute types.
  * @see {@link #addBinding(AttributeType)}.
  */
 public void addBindings(Schema schema) {
   for (Iterator<AttributeType> itr = schema.values().iterator(); itr.hasNext(); ) {
     AttributeType type = itr.next();
     addBinding(type);
   }
 }