code: private <T extends XSString> T createXSString(Class<T> clazz, String value) {
      if (value == null) {
        return null;
      }
      QName elementName = null;
      String localName = null;
      try {
        elementName = (QName) clazz.getDeclaredField("DEFAULT_ELEMENT_NAME").get(null);
        localName = (String) clazz.getDeclaredField("DEFAULT_ELEMENT_LOCAL_NAME").get(null);
      }
      catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) {
        throw new RuntimeException(e);
      }
      XMLObjectBuilder<? extends XMLObject> builder = XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(elementName);
      Object object = builder.buildObject(new QName(this.getElementQName().getNamespaceURI(), localName, this.getElementQName().getPrefix()));
      T xsstring = clazz.cast(object);
      xsstring.setValue(value);
      return xsstring;
    }
docs: Utility method for creating an OpenSAML object given its type and assigns the value.
  
  @param clazz
  the class to create
  @param value
  the string value to assign
  @return the XML object or {@code null} if value is {@code null}