本文整理汇总了Java中org.simpleframework.xml.core.Validate类的典型用法代码示例。如果您正苦于以下问题:Java Validate类的具体用法?Java Validate怎么用?Java Validate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Validate类属于org.simpleframework.xml.core包,在下文中一共展示了Validate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Validates the <code>KeyTransport</code> element included in this P-Mode.
* <p>When included the element must have at least one child. Also when the <i>RSA-OAEP</i> algorithm is specified
* an MGF algorithm must be specified.
*
* @throws PersistenceException If there is not at least one child element or when no MGF algorithm is specified in
* case <i>RSA-OAEP</i> is specified
*/
@Validate
public void validate() throws PersistenceException {
// Check at least one child element is included
if (Utils.getValue(algorithm, null) == null
&& Utils.getValue(MGFAlgorithm, null) == null
&& Utils.getValue(digestAlgorithm, null) == null
&& Utils.getValue(keyReferenceMethod.referenceMethod, null) == null)
throw new PersistenceException("KeyTransport MUST have at least one child element", null);
// Check if MGF is specified in case RSA-OAEP is kt algorithm
if (WSConstants.KEYTRANSPORT_RSAOEP_XENC11.equalsIgnoreCase(algorithm)
&& Utils.getValue(MGFAlgorithm, null) == null)
throw new PersistenceException("You MUST specify a MGF algorithm when specifying RSA-OAEP as "
+ "key transport algorithm", null);
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:26,代码来源:KeyTransport.java
示例2: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Validates the read XML data to ensure that there are at most two UsernameToken child elements and that each
* has its own target.
*
* @throws PersistenceException When the read XML document contains more than 2 UsernameToken elements or the
* specified UsernameToken elements have the same target
*/
@Validate
public void validate() throws PersistenceException {
if (usernameTokens == null)
return;
if (usernameTokens.size() > 2)
throw new PersistenceException("There may not be more than 2 UsernameToken elements", null);
else if (usernameTokens.size() == 2) {
// Compare the target attribute value of both elements
final int c = Utils.compareStrings(usernameTokens.get(0).target, usernameTokens.get(1).target);
if (c == -1 || c == 0)
// The targets are equal
throw new PersistenceException("You must specify separate targets for the UsernameToken elements!",
null);
}
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:23,代码来源:SecurityConfiguration.java
示例3: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Initialization method used by the Simple XML framework.
*/
@SuppressWarnings("unused")
@Validate
private void validate() {
/* Validate color. */
if (color != null) {
String[] rgb = this.color.split(",");
this.colorObject = new Color(
Integer.parseInt(rgb[0]),
Integer.parseInt(rgb[1]),
Integer.parseInt(rgb[2]));
}
/* Validate last part of name. */
validateName();
/* Create hash code. */
hashCodeValue = bitIdentifier.hashCode() ^ name.hashCode() ^ family.hashCode();
}
开发者ID:LaSEEB,项目名称:LAIS1,代码行数:20,代码来源:Substance.java
示例4: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Validation method for the read XML information.
*
* @see org.simpleframework.xml.load.Validate
*/
@Validate
public void validate() {
/* Validate color. */
String[] rgb = this.color.split(",");
this.colorObject = new Color(
Integer.parseInt(rgb[0]),
Integer.parseInt(rgb[1]),
Integer.parseInt(rgb[2]));
/* Validate states. */
if (states != null) {
stateStates = new HashMap<String, String[]>();
Iterator<String> iterStr = states.keySet().iterator();
while (iterStr.hasNext()) {
String nextStateType = iterStr.next();
String[] stateNames = states.get(nextStateType).split(",");
Arrays.sort(stateNames);
stateStates.put(nextStateType, stateNames);
}
}
}
开发者ID:LaSEEB,项目名称:LAIS1,代码行数:26,代码来源:AgentPrototype.java
示例5: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
@Validate
public void validate() throws ParseException {
this.company = ValidationUtils
.validateNotHavingUnderscore(ValidationUtils.validateCaseSensitiveNameAttribute(
ATTRIBUTE_PARENT_NAME, "company", company),
"The company parameter can't contain underscores. It is connected with the way the Version API reads companies. Underscores have been stripped.");
this.name = ValidationUtils
.validateCaseSensitiveNameAttribute(ATTRIBUTE_PARENT_NAME, "name", name);
this.project = ValidationUtils
.validateCaseSensitiveNameAttribute(ATTRIBUTE_PARENT_NAME, "project",
project);
}
开发者ID:Cognifide,项目名称:aet,代码行数:13,代码来源:TestSuite.java
示例6: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
@Validate
public void validate(Map session) throws IOException {
File file = new File(root);
if(!file.exists()) {
throw new FileNotFoundException("Root path '" +file+ "' does not exist");
}
session.put(identifier, file.getAbsolutePath());
}
开发者ID:ngallagher,项目名称:simplexml,代码行数:10,代码来源:TestContext.java
示例7: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
@Validate
public void validate() throws Exception {
if(getSeparatedKeys().length==0)
throw new Exception("Action must have at least one key: "+keys);
if(getNextScene()!=null && getNextDialog()!=null)
throw new Exception("An action cannot have both a next dialog and next scene...");
}
开发者ID:ericleib,项目名称:blindtale,代码行数:9,代码来源:Action.java
示例8: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
@Validate
public void validate() throws Exception {
if((text==null || text.trim().equals("")) && file==null)
throw new Exception("Audio must have either some text or a link to a file");
if((text!=null && (!text.trim().equals(""))) && file!=null)
throw new Exception("Audio cannot have both text and a link to a file");
}
开发者ID:ericleib,项目名称:blindtale,代码行数:9,代码来源:Audio.java
示例9: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
@Validate
public void validate() throws Exception {
if( ! (change.equals(INCREMENT) || change.equals(DECREMENT) || change.equals(SET_TRUE) || change.equals(SET_FALSE) || change.equals(SET_ZERO) || change.equals(SET_VALUE)) )
throw new Exception("Unknown state change: "+change);
if(change.equals(SET_VALUE) && getValue()==null)
throw new Exception("State-change 'set-value' must have a 'value' attribute");
}
开发者ID:ericleib,项目名称:blindtale,代码行数:8,代码来源:StateChange.java
示例10: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
@Validate
public void validate() throws Exception {
for(Voice v : getVoices())
if(!voiceMap.containsKey(v.getId()))
voiceMap.put(v.getId(), v);
else
throw new Exception("Duplicate voice: "+v.getId());
if(!voiceMap.containsKey(defaultVoiceId))
throw new Exception("Default voice id does not exist: "+defaultVoiceId);
}
开发者ID:ericleib,项目名称:blindtale,代码行数:12,代码来源:Tale.java
示例11: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Validates the read configuration. At the moment this validation only checks that each parameter is named.
*
* @throws PersistenceException When a parameter included in the XML document has no name.
*/
@Validate
public void validate() throws PersistenceException {
if (!Utils.isNullOrEmpty(parameters)) {
for (final String name : parameters.keySet())
if (Utils.isNullOrEmpty(name))
throw new PersistenceException("Each parameter in the configuration must be named!");
}
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:14,代码来源:ConfigXmlFile.java
示例12: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Validates the data read from the XML document by checking that when <code>MaxRetries</code> is supplied
* <code>RetryInterval</code> contains positive non zero value;</li></ol>
*
* @throws Exception When the read XML is not valid
*/
@Validate
public void validate() throws Exception {
if (maxRetries > -1)
if (retryIntervalDuration <= 0)
throw new ValueRequiredException("ReceptionAwareness/RetryInterval must have positive non zero value");
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:13,代码来源:ReceptionAwareness.java
示例13: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Validates the read XML data to ensure that there is at most one UsernameToken child element. This only element
* should have no <code>target</code> attribute specified or with value <i>"ebms"</i> because the sub-channel
* authentication and authorization can only use the security header targeted to this role.
*
* @throws PersistenceException When the read XML document contains more than 1 UsernameToken element
*/
@Override
@Validate
public void validate() throws PersistenceException {
if (usernameTokens == null)
return;
else if (usernameTokens.size() > 1)
throw new PersistenceException("There shall be only one UsernameToken element for PullRequestFlow", null);
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:16,代码来源:PullSecurityConfiguration.java
示例14: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Validates the data read from the XML document. The validation for now only checks whether an URL is specified
* when the response pattern is set to CALLBACK
*
* @throws PersistenceException When no URL is provided when the reply pattern is set to CALLBACK
*/
@Validate
public void validate() throws PersistenceException {
if (getPattern() == ReplyPattern.CALLBACK && (to == null || to.isEmpty()))
throw new PersistenceException("You must specify the URL where to sent errors when setting"
+ " reply pattern to CALLBACK", null);
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:13,代码来源:ErrorHandling.java
示例15: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Performs additional checks to ensure that the read XML document is valid according to the XSD.
* <p>Because a general definition is used for reading both the default and specific pullers there is no check
* on the number of P-Modes referenced by the pullers when the XML is deserialized. Therefor this method performs
* checks:<ol>
* <li>There are no referenced P-Modes for the default puller</li>
* <li>There is at least one reference P-Mode for each specific puller</li>
* </ol>
*
* @throws PersistenceException When the read XML fails one of the checks
*/
@Validate
private void validate() throws PersistenceException {
// Default puller should have no PModes associated with it
if(defaultPuller.pmodes != null && !defaultPuller.pmodes.isEmpty())
throw new PersistenceException("The default puller should not specify specific PModes!");
// A specific puller must specifiy at least one PMode
if(pullers != null) {
for(final PullerConfig p : pullers)
if(p.pmodes == null || p.pmodes.isEmpty())
throw new PersistenceException("Specific puller must reference at least one PMode!");
}
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:25,代码来源:PullConfiguration.java
示例16: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Called after XML setup of SubstanceManager.
* Creates a backup of the SubstanceManager initial state.
*/
@Validate
void validate() {
familiesBak = new HashSet<SubstanceFamily>();
familiesBak.addAll(families);
substancesBak = new HashSet<Substance>();
substancesBak.addAll(substances);
subFamilyMergeRulesBak = new Vector<SubFamilyMergeRule>();
subFamilyMergeRulesBak.addAll(subFamilyMergeRules);
}
开发者ID:LaSEEB,项目名称:LAIS1,代码行数:14,代码来源:SubstanceManager.java
示例17: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* Post-XML read validation. Used to determine the color from the separate RGB components.
*/
@SuppressWarnings("unused")
@Validate
private void validate() {
/* Validate color. */
if (color != null) {
String[] rgb = this.color.split(",");
this.colorObject = new Color(
Integer.parseInt(rgb[0]),
Integer.parseInt(rgb[1]),
Integer.parseInt(rgb[2]));
} else {
this.colorObject = new Color(0, 0, 0);
}
}
开发者ID:LaSEEB,项目名称:LAIS1,代码行数:18,代码来源:SubstanceFamily.java
示例18: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
/**
* This method initializes the agent names.
*/
@Validate
public void validate() {
Iterator<String> iterAgName = agentMap.keySet().iterator();
while (iterAgName.hasNext()) {
String agName = iterAgName.next();
AgentPrototype ap = agentMap.get(agName);
ap.setName(agName);
}
}
开发者ID:LaSEEB,项目名称:LAIS1,代码行数:13,代码来源:AgentManager.java
示例19: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
@SuppressWarnings("unused")
@Validate
private void validate() {
if (conditions == null)
conditions = new ArrayList<AgentCondition>();
if (actions == null)
actions = new ArrayList<AgentAction>();
}
开发者ID:LaSEEB,项目名称:LAIS1,代码行数:9,代码来源:Gene.java
示例20: validate
import org.simpleframework.xml.core.Validate; //导入依赖的package包/类
@Validate
public void validate() throws PersistenceException {
if(filenameBackgroundProgram != null) {
if(!filenameBackgroundProgram.exists()) {
String dir = Angerona.getInstance().getActualSimulation().getDirectory();
filenameBackgroundProgram = new File(dir + "/" + filenameBackgroundProgram.getPath());
if(!filenameBackgroundProgram.exists())
throw new PersistenceException("Cannot find background program in '" + filenameBackgroundProgram + "'");
}
}
}
开发者ID:Angerona,项目名称:angerona-framework,代码行数:13,代码来源:Situation.java
注:本文中的org.simpleframework.xml.core.Validate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论