當前位置: 首頁>>代碼示例>>Java>>正文


Java Serializer.validate方法代碼示例

本文整理匯總了Java中org.simpleframework.xml.Serializer.validate方法的典型用法代碼示例。如果您正苦於以下問題:Java Serializer.validate方法的具體用法?Java Serializer.validate怎麽用?Java Serializer.validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.simpleframework.xml.Serializer的用法示例。


在下文中一共展示了Serializer.validate方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testMix

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testMix() throws Exception {
   Serializer serializer = new Persister();
   MixExample example = new MixExample();
   StringWriter source = new StringWriter();
   
   example.setTime(new Date());
  // example.add("text");
  // example.add(1);
  // example.add(true);
  // example.add(new Entry("1", "example 1"));
  // example.add(new Entry("2", "example 2"));
  // example.put(new Entry("1", "key 1"), new Entry("1", "value 1"));
  // example.put("key 2", "value 2");
  // example.put("key 3", 3);
  // example.put("key 4", new Entry("4", "value 4"));
   
   serializer.write(example, System.out);
   serializer.write(example, source);   
   serializer.validate(MixExample.class, source.toString());
   
   MixExample other = serializer.read(MixExample.class, source.toString());
   
   serializer.write(other, System.out);
   
  // assertEquals(example.get(0), "text");
  // assertEquals(example.get(1), 1);      
  // assertEquals(example.get(2), true);
   
   validate(example, serializer);
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:31,代碼來源:MixTest.java

示例2: testVersionMissing

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testVersionMissing() throws Exception {
   Serializer persister = new Persister();
   boolean success = false;
   
   try {
      success = persister.validate(TextList.class, VERSION_MISSING);
   } catch(Exception e) {
      e.printStackTrace();
      success = true;
   }
   assertTrue(success);
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:13,代碼來源:ValidateTest.java

示例3: testNameMissing

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testNameMissing() throws Exception {
   Serializer persister = new Persister();
   boolean success = false;
   
   try {
      success = persister.validate(TextList.class, NAME_MISSING);
   } catch(Exception e) {
      e.printStackTrace();
      success = true;
   }
   assertTrue(success);
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:13,代碼來源:ValidateTest.java

示例4: testTextMissing

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testTextMissing() throws Exception {
   Serializer persister = new Persister();
   boolean success = false;
   
   try {
      success = persister.validate(TextList.class, TEXT_MISSING);
   } catch(Exception e) {
      e.printStackTrace();
      success = true;
   }
   assertTrue(success);
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:13,代碼來源:ValidateTest.java

示例5: testExtraElement

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testExtraElement() throws Exception {
   Serializer persister = new Persister();
   boolean success = false;
   
   try {
      success = persister.validate(TextList.class, EXTRA_ELEMENT);
   } catch(Exception e) {
      e.printStackTrace();
      success = true;
   }
   assertTrue(success);
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:13,代碼來源:ValidateTest.java

示例6: testEmptyCompositeValue

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testEmptyCompositeValue() throws Exception {
   Serializer serializer = new Persister();
   ComplexMap value = serializer.read(ComplexMap.class, EMPTY_COMPOSITE_VALUE);
   boolean valid = serializer.validate(ComplexMap.class, EMPTY_COMPOSITE_VALUE);
   
   assertTrue(valid);
   
   validate(value, serializer);
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:10,代碼來源:MapNullTest.java

示例7: testEmptyCompositeBlankValue

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testEmptyCompositeBlankValue() throws Exception {
   Serializer serializer = new Persister();
   ComplexMap value = serializer.read(ComplexMap.class, EMPTY_COMPOSITE_BLANK_VALUE);
   boolean valid = serializer.validate(ComplexMap.class, EMPTY_COMPOSITE_BLANK_VALUE);
   
   assertTrue(valid);
   
   validate(value, serializer);
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:10,代碼來源:MapNullTest.java

示例8: testEmptyCompositeKey

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testEmptyCompositeKey() throws Exception {
   Serializer serializer = new Persister();
   ComplexMap value = serializer.read(ComplexMap.class, EMPTY_COMPOSITE_KEY);
   boolean valid = serializer.validate(ComplexMap.class, EMPTY_COMPOSITE_KEY);
   
   assertTrue(valid);
   
   validate(value, serializer);      
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:10,代碼來源:MapNullTest.java

示例9: testEmptyCompositeBlankKey

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testEmptyCompositeBlankKey() throws Exception {
   Serializer serializer = new Persister();
   ComplexMap value = serializer.read(ComplexMap.class, EMPTY_COMPOSITE_BLANK_KEY);     
   boolean valid = serializer.validate(ComplexMap.class, EMPTY_COMPOSITE_BLANK_KEY);
   
   assertTrue(valid);
   
   validate(value, serializer);      
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:10,代碼來源:MapNullTest.java

示例10: testEmptyPrimitiveValue

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testEmptyPrimitiveValue() throws Exception {
   Serializer serializer = new Persister();
   PrimitiveMap value = serializer.read(PrimitiveMap.class, EMPTY_PRIMITIVE_VALUE);     
   boolean valid = serializer.validate(PrimitiveMap.class, EMPTY_PRIMITIVE_VALUE);
   
   assertTrue(valid);
   
   validate(value, serializer);      
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:10,代碼來源:MapNullTest.java

示例11: testEmptyPrimitiveBlankValue

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testEmptyPrimitiveBlankValue() throws Exception {
   Serializer serializer = new Persister();
   PrimitiveMap value = serializer.read(PrimitiveMap.class, EMPTY_PRIMITIVE_BLANK_VALUE);     
   boolean valid = serializer.validate(PrimitiveMap.class, EMPTY_PRIMITIVE_BLANK_VALUE);
   
   assertTrue(valid);
   
   validate(value, serializer);      
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:10,代碼來源:MapNullTest.java

示例12: testEmptyPrimitiveKey

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testEmptyPrimitiveKey() throws Exception {
   Serializer serializer = new Persister();
   PrimitiveMap value = serializer.read(PrimitiveMap.class, EMPTY_PRIMITIVE_KEY);     
   boolean valid = serializer.validate(PrimitiveMap.class, EMPTY_PRIMITIVE_KEY);
   
   assertTrue(valid);
   
   validate(value, serializer);      
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:10,代碼來源:MapNullTest.java

示例13: testEmptyPrimitiveBlankKey

import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void testEmptyPrimitiveBlankKey() throws Exception {
   Serializer serializer = new Persister();
   PrimitiveMap value = serializer.read(PrimitiveMap.class, EMPTY_PRIMITIVE_BLANK_KEY);     
   boolean valid = serializer.validate(PrimitiveMap.class, EMPTY_PRIMITIVE_BLANK_KEY);
   
   assertTrue(valid);
   
   validate(value, serializer);      
}
 
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:10,代碼來源:MapNullTest.java


注:本文中的org.simpleframework.xml.Serializer.validate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。