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;
  }
예제 #3
0
 public String substitutionHeadName() {
   return core.substitutionHeadName();
 }
예제 #4
0
 public Class scope() {
   return core.scope();
 }
예제 #5
0
 public String defaultValue() {
   return core.defaultValue();
 }
예제 #6
0
 public String namespace() {
   return core.namespace();
 }