org.simpleframework.xml.Root类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(158)

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

Root介绍

暂无

代码示例

代码示例来源:origin: syncany/syncany

@Root(strict = false)
public abstract class Request extends Message {
  @Element(required = true)
  private int id;	
  
  public Request() {
    this.id = Math.abs(new Random().nextInt());
  }

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }
}

代码示例来源:origin: wmixvideo/nfe

@Root(name = "retCancNFe")
public class NFRetornoCancelamento extends DFBase {
  private static final long serialVersionUID = 93128697872980852L;

  @Attribute(name = "versao", required = false)
  private String versao;

  @Element(name = "infCanc")
  private NFRetornoInfoCancelamento infoCancelamento;

  public NFRetornoInfoCancelamento getInfoCancelamento() {
    return this.infoCancelamento;
  }

  public void setInfoCancelamento(final NFRetornoInfoCancelamento infoCancelamento) {
    this.infoCancelamento = infoCancelamento;
  }

  public String getVersao() {
    return this.versao;
  }

  public void setVersao(final String versao) {
    this.versao = versao;
  }
}

代码示例来源:origin: syncany/syncany

@Root(name = "appInfoResponse")
public class AppInfoResponse {
  @Element(name = "code", required = true)
  private int code;
  @Element(name = "message", required = true)
  private String message;
  @ElementList(name = "appInfoList", required = true)
  private ArrayList<AppInfo> appInfoList;

代码示例来源:origin: openpnp/openpnp

/**
   * Used to provide a fixed root for the Parts when serializing.
   */
  @Root(name = "openpnp-parts")
  public static class PartsConfigurationHolder {
    @ElementList(inline = true, entry = "part", required = false)
    private ArrayList<Part> parts = new ArrayList<>();
  }
}

代码示例来源:origin: randomizedtesting/randomizedtesting

@Root(name = "testcase")
public class TestCaseModel
{
  @Attribute(required = true)
  public String classname;

  @Attribute(required = true)
  public String name;

  @Attribute(required = true)
  public double time;

  @ElementList(inline = true, entry = "failure", required = false, type = FailureModel.class)
  public List<FailureModel> failures = new ArrayList<>();

  @ElementList(inline = true, entry = "error", required = false, type = FailureModel.class)
  public List<FailureModel> errors = new ArrayList<>();

  @NotAnt(extensionSource = "maven")
  @Element(name = "skipped", required = false)
  public String skipped;
}

代码示例来源:origin: jorabin/KeePassJava2

@Root(name="Value")
  public static class Value {
    @Attribute(name="Ref")
    String ref;
    public void setRef(String ref) {
      this.ref = ref;
    }
  }
}

代码示例来源:origin: gentics/mesh

@Root(name = "testsuite")
public class Testsuite {

  @Attribute(name = "name")
  private String name;

  @Attribute(name = "time")
  private String time;

  @ElementList(inline = true)
  private List<Testcase> testcases = new ArrayList<>();

  public Testsuite(Class<?> clazz, double time) {
    this.name = clazz.getName();
    this.time = String.valueOf(time);
  }

  public List<Testcase> getTestcases() {
    return testcases;
  }

  public void setTestcases(List<Testcase> testcases) {
    this.testcases = testcases;
  }

}

代码示例来源:origin: syncany/syncany

/**
 * A message is either a request or a response sent to 
 * or from the daemon. All messages must inherit from this
 * class. Messages can be serialized/deserialized using the
 * {@link MessageFactory}. 
 * 
 * @author Philipp C. Heckel <philipp.heckel@gmail.com>
 */
@Root(strict = false)
public abstract class Message {
  // Nothing here.
}

代码示例来源:origin: org.simpleframework/simple-xml

/**
* This is used to set the optional <code>Root</code> annotation for
* the class. The root can only be set once, so if a super type also
* has a root annotation define it must be ignored. 
*
* @param label this is the label used to define the root
*/    
private void root(Annotation label) {
 if(label != null) {
   Root value = (Root)label;
   String real = type.getSimpleName();
   String text = real;
   if(value != null) {
    text = value.name();
    if(isEmpty(text)) {
      text = Reflector.getName(real);
    }      
    strict = value.strict();
    root = value;
    name = text;  
   }
 }
}

代码示例来源:origin: org.simpleframework/simple-xml

/**
* This will acquire the name of the <code>Root</code> annotation
* for the specified class. This will traverse the inheritance
* hierarchy looking for the root annotation, when it is found it
* is used to acquire a name for the XML element it represents.
*  
* @param real the actual type of the object being searched
* @param type this is the type to acquire the root name with    
* 
* @return the root name for the specified type if it exists
*/
private String getRoot(Class<?> real, Class<?> type) {
 String name = type.getSimpleName();
 Root root = type.getAnnotation(Root.class);
 
 if(root != null) {
   String text = root.name();
   
   if(!isEmpty(text)) {
    return text;
   }
   return Reflector.getName(name);
 }
 return null;
}

代码示例来源:origin: wmixvideo/nfe

@Root(name = "protNFe")
public class NFProtocolo extends DFBase {
  private static final long serialVersionUID = -784305871769382618L;

  @Attribute(name = "versao", required = true)
  private String versao;

  @Element(name = "infProt", required = true)
  private NFProtocoloInfo protocoloInfo;

  public void setVersao(final String versao) {
    this.versao = versao;
  }

  public void setProtocoloInfo(final NFProtocoloInfo protocoloInfo) {
    this.protocoloInfo = protocoloInfo;
  }

  public NFProtocoloInfo getProtocoloInfo() {
    return this.protocoloInfo;
  }

  public String getVersao() {
    return this.versao;
  }
}

代码示例来源:origin: syncany/syncany

@Root(name = "transaction", strict = false)
public class TransactionTO {
  @Element(name = "machineName")
  private String machineName;
  @ElementList(name = "actions", entry = "action")
  private ArrayList<ActionTO> actionTOs;

代码示例来源:origin: openpnp/openpnp

/**
 * This class is just a delegate wrapper around a list. 
 */
@Root
public static class BanksProperty {
  @ElementList
  IdentifiableList<Bank> banks = new IdentifiableList<>();
}

代码示例来源:origin: com.carrotsearch.randomizedtesting/junit4-ant

@Root(name = "testcase")
public class TestCaseModel
{
  @Attribute(required = true)
  public String classname;

  @Attribute(required = true)
  public String name;

  @Attribute(required = true)
  public double time;

  @ElementList(inline = true, entry = "failure", required = false, type = FailureModel.class)
  public List<FailureModel> failures = new ArrayList<>();

  @ElementList(inline = true, entry = "error", required = false, type = FailureModel.class)
  public List<FailureModel> errors = new ArrayList<>();

  @NotAnt(extensionSource = "maven")
  @Element(name = "skipped", required = false)
  public String skipped;
}

代码示例来源:origin: holodeck-b2b/Holodeck-B2B

/**
 * Represents the <code>pmode</code> element in the XML document for the pulling configuration
 */
@Root
static class PMode {
  @Attribute(required = true)
  private String id;
}

代码示例来源:origin: eroispaziali/ForceFlow

@Root(name="testcase")
public class TestCase {
  @Attribute
  private Double time;
  @Attribute
  private String name;
  @ElementList(inline=true, name="testfailures", required=false)
  private List<TestFailure> testFailures = new ArrayList<TestFailure>();

代码示例来源:origin: syncany/syncany

/**
 * Internal events are {@link Event}s meant for JVM-local consumers.
 *  
 * <p>In particular, they are not to be broadcasted to external subscribers,
 * such as GUIs connected via WS, but only to the local event bus.
 *  
 * @author Philipp C. Heckel <philipp.heckel@gmail.com>
 */
@Root
public abstract class InternalEvent extends Event {
  // Marker
}

代码示例来源:origin: org.restlet.lib/org.simpleframework.simple-xml

/**
* This is used to set the optional <code>Root</code> annotation for
* the class. The root can only be set once, so if a super type also
* has a root annotation define it must be ignored. 
*
* @param label this is the label used to define the root
*/    
private void root(Annotation label) {
 if(label != null) {
   Root value = (Root)label;
   String real = type.getSimpleName();
   String text = real;
   if(value != null) {
    text = value.name();
    if(isEmpty(text)) {
      text = Reflector.getName(real);
    }      
    strict = value.strict();
    root = value;
    name = text;  
   }
 }
}

代码示例来源:origin: org.restlet.lib/org.simpleframework.simple-xml

/**
* This will acquire the name of the <code>Root</code> annotation
* for the specified class. This will traverse the inheritance
* hierarchy looking for the root annotation, when it is found it
* is used to acquire a name for the XML element it represents.
*  
* @param real the actual type of the object being searched
* @param type this is the type to acquire the root name with    
* 
* @return the root name for the specified type if it exists
*/
private String getRoot(Class<?> real, Class<?> type) {
 String name = type.getSimpleName();
 Root root = type.getAnnotation(Root.class);
 
 if(root != null) {
   String text = root.name();
   
   if(!isEmpty(text)) {
    return text;
   }
   return Reflector.getName(name);
 }
 return null;
}

代码示例来源:origin: wmixvideo/nfe

@Root(name = "retCancNFe")
public class NFRetornoCancelamento extends DFBase {
  private static final long serialVersionUID = 93128697872980852L;

  @Attribute(name = "versao", required = false)
  private String versao;

  @Element(name = "infCanc")
  private NFRetornoInfoCancelamento infoCancelamento;

  public NFRetornoInfoCancelamento getInfoCancelamento() {
    return this.infoCancelamento;
  }

  public void setInfoCancelamento(final NFRetornoInfoCancelamento infoCancelamento) {
    this.infoCancelamento = infoCancelamento;
  }

  public String getVersao() {
    return this.versao;
  }

  public void setVersao(final String versao) {
    this.versao = versao;
  }
}

相关文章