コード例 #1
0
  /**
   * Prevalidate attributes of element in isolation. Note that this adds the format information to
   * the context, which is necessary because the string attributes for values need to have access to
   * the format information for their own prevalidation. This is the only type of registration which
   * is done during the prevalidation pass.
   *
   * @param vctx validation context
   */
  public void prevalidate(ValidationContext vctx) {

    // prevalidate this format
    if (m_typeName != null) {
      m_type = vctx.getClassInfo(m_typeName);
      if (m_type != null) {
        m_stringAttrs.setType(m_type);
        m_stringAttrs.prevalidate(vctx);
      } else {
        vctx.addFatal("Unable to find type " + m_typeName);
      }
    } else {
      vctx.addFatal("Missing required type name");
    }

    // now try adding to context (except when run during setup) - kludgy
    if (vctx.getParentElement() != null) {
      vctx.getFormatDefinitions().addFormat(this, vctx);
    }
    super.prevalidate(vctx);
  }
コード例 #2
0
 /* (non-Javadoc)
  * @see org.jibx.binding.model.ElementBase#validate(org.jibx.binding.model.ValidationContext)
  */
 public void validate(ValidationContext vctx) {
   m_stringAttrs.validate(vctx);
   super.validate(vctx);
 }
コード例 #3
0
 /**
  * Set deserializer method name.
  *
  * @param fully qualified class and method name for deserializer
  */
 public void setDeserializerName(String name) {
   m_stringAttrs.setDeserializerName(name);
 }
コード例 #4
0
 /**
  * Get base format information. This method is only usable after a call to {@link #validate}.
  *
  * @return base format element (or <code>null</code> if none)
  */
 public FormatElement getBaseFormat() {
   return m_stringAttrs.getBaseFormat();
 }
コード例 #5
0
 /**
  * Get deserializer method information. This call is only meaningful after validation.
  *
  * @return deserializer information (or <code>null</code> if none)
  */
 public IClassItem getDeserializer() {
   return m_stringAttrs.getDeserializer();
 }
コード例 #6
0
 /**
  * Get deserializer name.
  *
  * @return fully qualified class and method name for deserializer (or <code>null</code> if none)
  */
 public String getDeserializerName() {
   return m_stringAttrs.getDeserializerName();
 }
コード例 #7
0
 /**
  * Set default value text.
  *
  * @param value default value text
  */
 public void setDefaultText(String value) {
   m_stringAttrs.setDefaultText(value);
 }
コード例 #8
0
 /**
  * Get default value. This call is only meaningful after validation.
  *
  * @return default value object
  */
 public Object getDefault() {
   return m_stringAttrs.getDefault();
 }
コード例 #9
0
 /**
  * Get default value text.
  *
  * @return default value text
  */
 public String getDefaultText() {
   return m_stringAttrs.getDefaultText();
 }