protected static String createMissingFactoryMethodMessage(Class<?> type, Class<?> objectFactory) {
    StringBuilder messageBuilder = new StringBuilder();
    Method[] factoryMethods = objectFactory.getDeclaredMethods();

    messageBuilder.append(
        TransformMessages.MESSAGES.noJAXBElementFactoryDefined(
            type.getName(), objectFactory.getName()));

    for (Method factoryMethod : factoryMethods) {
      XmlElementDecl xmlElementDecl = factoryMethod.getAnnotation(XmlElementDecl.class);
      if (xmlElementDecl != null) {
        Class<?>[] factoryParams = factoryMethod.getParameterTypes();

        if (factoryParams.length == 1) {
          QName qName = new QName(xmlElementDecl.namespace(), xmlElementDecl.name());
          Class<?> factoryParam = factoryParams[0];

          messageBuilder.append(
              "\n\t\t- Message QName: '"
                  + qName.toString()
                  + "'. Java Type: "
                  + factoryParam.getName());
        }
      }
    }

    return messageBuilder.toString();
  }
  private static QName getTypeXMLQName(Class<?> type, Class<?> objectFactory)
      throws SwitchYardException {
    Method[] factoryMethods = objectFactory.getDeclaredMethods();

    for (Method factoryMethod : factoryMethods) {
      XmlElementDecl xmlElementDecl = factoryMethod.getAnnotation(XmlElementDecl.class);
      if (xmlElementDecl != null) {
        Class<?>[] factoryParams = factoryMethod.getParameterTypes();

        if (factoryParams.length == 1) {
          QName qName = new QName(xmlElementDecl.namespace(), xmlElementDecl.name());
          Class<?> factoryParam = factoryParams[0];

          if (factoryParam == type) {
            // This is the factory method for the specified type...
            return qName;
          }
        }
      }
    }

    return null;
  }
Ejemplo n.º 3
0
 public String substitutionHeadName() {
   return core.substitutionHeadName();
 }
Ejemplo n.º 4
0
 public Class scope() {
   return core.scope();
 }
Ejemplo n.º 5
0
 public String defaultValue() {
   return core.defaultValue();
 }
Ejemplo n.º 6
0
 public String namespace() {
   return core.namespace();
 }