org.codehaus.modello.plugins.xml.metadata.XmlFieldMetadata类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中org.codehaus.modello.plugins.xml.metadata.XmlFieldMetadata类的一些代码示例,展示了XmlFieldMetadata类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlFieldMetadata类的具体详情如下:
包路径:org.codehaus.modello.plugins.xml.metadata.XmlFieldMetadata
类名称:XmlFieldMetadata

XmlFieldMetadata介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.modello/modello-plugin-xml

/**
 * Get the field which type is <code>Content</code> if any.
 *
 * @param modelFields the fields to check
 * @return the field, or <code>null</code> if no field is <code>Content</code>
 */
static ModelField getContentField( List<ModelField> modelFields )
{
  if ( modelFields == null )
  {
    return null;
  }
  for ( ModelField field : modelFields )
  {
    XmlFieldMetadata xmlFieldMetadata = (XmlFieldMetadata) field.getMetadata( XmlFieldMetadata.ID );
    if ( xmlFieldMetadata.isContent() )
    {
      return field;
    }
  }
  return null;
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-dom4j

if ( xmlFieldMetadata.isAttribute() )
if ( xmlFieldMetadata.isTrim() )
    + ( xmlFieldMetadata.getFormat() != null ? "\"" + xmlFieldMetadata.getFormat() + "\"" : "null" ) + ";" );
  sc.add( objectName + "." + setterName + "( getDateValue( " + parserGetter + ", \"" + tagName
    + "\", dateFormat ) );" );

代码示例来源:origin: org.codehaus.modello/modello-plugin-xml

/**
 * Resolve XML tag name for a field.
 *
 * @param modelField the model field
 * @param xmlFieldMetadata the XML metadata of the field
 * @return the XML tag name for the field
 */
static String resolveTagName( ModelField modelField, XmlFieldMetadata xmlFieldMetadata )
{
  String tagName;
  if ( ( xmlFieldMetadata == null ) || ( xmlFieldMetadata.getTagName() == null ) )
  {
    tagName = modelField.getName();
  }
  else
  {
    // tag name is overridden by xml.tagName attribute
    tagName = xmlFieldMetadata.getTagName();
  }
  return tagName;
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-xml

if ( xmlFieldMetadata.isTransient() )
if ( xmlFieldMetadata.getInsertParentFieldsUpTo() != null )
    found = parentField.getName().equals( xmlFieldMetadata.getInsertParentFieldsUpTo() );
    throw new ModelloRuntimeException( "parent field not found: class " + modelClass.getName() + " xml.insertParentFieldUpTo='" + xmlFieldMetadata.getInsertParentFieldsUpTo() + "'" );

代码示例来源:origin: org.codehaus.modello/modello-plugin-stax

/**
 * Add code to parse fields of a model class that are XML attributes.
 *
 * @param modelClass the model class
 * @param uncapClassName
 * @param sc the source code to add to
 * @throws ModelloException
 */
private void writeAttributes( ModelClass modelClass, String uncapClassName, JSourceCode sc )
  throws ModelloException
{
  for ( ModelField field : modelClass.getAllFields( getGeneratedVersion(), true ) )
  {
    XmlFieldMetadata xmlFieldMetadata = (XmlFieldMetadata) field.getMetadata( XmlFieldMetadata.ID );
    if ( xmlFieldMetadata.isAttribute() && !xmlFieldMetadata.isTransient() )
    {
      writePrimitiveField( field, field.getType(), uncapClassName, "set" + capitalise( field.getName() ),
                 sc );
    }
  }
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-xpp3

if ( xmlFieldMetadata.isAttribute() )
if ( xmlFieldMetadata.isContent() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-dom4j

if ( xmlFieldMetadata.isAttribute() )
  String tagName = xmlFieldMetadata.getTagName();
  if ( tagName == null )
if ( xmlFieldMetadata.isContent() )
  if ( !xmlFieldMetadata.isAttribute() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-xsd

if ( "Date".equals( field.getType() ) && "long".equals( xmlFieldMetadata.getFormat() ) )
if ( xmlFieldMetadata.isContent() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-xml

/**
 * Gets all fields that are not marked as XML attribute.
 *
 * @param modelFields The collection of model fields from which to extract the XML attributes, must not be
 *            <code>null</code>.
 * @return The list of XML attributes fields, can be empty but never <code>null</code>.
 */
static List<ModelField> getXmlAttributeFields( List<ModelField> modelFields )
{
  List<ModelField> xmlAttributeFields = new ArrayList<ModelField>();
  for ( ModelField field : modelFields )
  {
    XmlFieldMetadata xmlFieldMetadata = (XmlFieldMetadata) field.getMetadata( XmlFieldMetadata.ID );
    if ( xmlFieldMetadata.isAttribute() )
    {
      xmlAttributeFields.add( field );
    }
  }
  return xmlAttributeFields;
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-jackson

if ( xmlFieldMetadata.isTrim() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-xml

protected String getValue( String type, String initialValue, XmlFieldMetadata xmlFieldMetadata )
{
  String textValue = initialValue;
  if ( "Date".equals( type ) )
  {
    String dateFormat = xmlFieldMetadata.getFormat();
    if ( xmlFieldMetadata.getFormat() == null )
    {
      dateFormat = DEFAULT_DATE_FORMAT;
    }
    if ( "long".equals( dateFormat ) )
    {
      textValue = "String.valueOf( " + textValue + ".getTime() )";
    }
    else
    {
      textValue =
        "new java.text.SimpleDateFormat( \"" + dateFormat + "\", java.util.Locale.US ).format( " + textValue + " )";
    }
  }
  else if ( !"String".equals( type ) )
  {
    textValue = "String.valueOf( " + textValue + " )";
  }
  return textValue;
}

代码示例来源:origin: org.codehaus.modello/modello-plugin-dom4j

if ( xmlFieldMetadata.isContent() )
if ( xmlFieldMetadata.isAttribute() )
if ( xmlFieldMetadata.isContent() )
if ( !xmlFieldMetadata.isAttribute() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-stax

if ( !xmlFieldMetadata.isAttribute() && !xmlFieldMetadata.isTransient() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-jdom

if ( xmlFieldMetadata.isAttribute() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-xpp3

sc.indent();
writeNewLocation( LOCATION_VAR, sc );
sc.add( "value = parser.nextText()" + ( xmlFieldMetadata.isTrim() ? ".trim()" : "" ) + ";" );
sc.unindent();
sc.add( "}" );
  "String value = parser.nextText()" + ( xmlFieldMetadata.isTrim() ? ".trim()" : "" ) + ";" );

代码示例来源:origin: org.codehaus.modello/modello-plugin-xpp3

if ( xmlFieldMetadata.isContent() )
if ( xmlFieldMetadata.isAttribute() )
if ( xmlFieldMetadata.isContent() )
if ( xmlFieldMetadata.isAttribute() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-stax

if ( xmlFieldMetadata.isAttribute() )
if ( xmlFieldMetadata.isTrim() )
    + ( xmlFieldMetadata.getFormat() != null ? "\"" + xmlFieldMetadata.getFormat() + "\"" : "null" ) + ";" );
  sc.add( objectName + "." + setterName + "( getDateValue( " + parserGetter + ", \"" + tagName
    + "\", dateFormat, xmlStreamReader ) );" );
  sc.add( objectName + "." + setterName + "( buildDom( xmlStreamReader, " + xmlFieldMetadata.isTrim() + " ) );" );

代码示例来源:origin: org.codehaus.modello/modello-plugin-xpp3

if ( !xmlFieldMetadata.isAttribute() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-xdoc

if ( xmlFieldMetadata.isContent() )

代码示例来源:origin: org.codehaus.modello/modello-plugin-jackson

if ( xmlFieldMetadata.isTrim() )
if ( xmlFieldMetadata.isTrim() )
  "String value = parser.nextTextValue()" + ( xmlFieldMetadata.isTrim() ? ".trim()" : "" ) + ";" );

相关文章