Spring Framework Constants - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework Constants class.

This code example shows how to use the following methods:asNumber, getValues
	 */ 
	public final void setIsolationLevelName(String constantName) throws IllegalArgumentException {
		if (constantName == null || !constantName.startsWith(DefaultTransactionDefinition.PREFIX_ISOLATION)) {
			throw new IllegalArgumentException("Only isolation constants allowed");
		} 
		setIsolationLevel(constants.asNumber(constantName).intValue());
	} 
 
	/** 
	 * Specify the default isolation level to use for Connection retrieval, 
	 * according to the JDBC {@link java.sql.Connection} constants 
	 * (equivalent to the corresponding Spring 
	 * {@link org.springframework.transaction.TransactionDefinition} constants). 
	 * <p>If not specified, the target DataSource's default will be used. 
	 * Note that a transaction-specific isolation value will always override 
	 * any isolation setting specified at the DataSource level. 
	 * @see java.sql.Connection#TRANSACTION_READ_UNCOMMITTED 
	 * @see java.sql.Connection#TRANSACTION_READ_COMMITTED 
	 * @see java.sql.Connection#TRANSACTION_REPEATABLE_READ 
	 * @see java.sql.Connection#TRANSACTION_SERIALIZABLE 

6
CodeRank
This code example shows how to use the following methods:asNumber, getValues
	 */ 
	public final void setIsolationLevelName(String constantName) throws IllegalArgumentException {
		if (constantName == null || !constantName.startsWith(PREFIX_ISOLATION)) {
			throw new IllegalArgumentException("Only isolation constants allowed");
		} 
		setIsolationLevel(constants.asNumber(constantName).intValue());
	} 
 
	/** 
	 * Set the isolation level. Must be one of the isolation constants 
	 * in the TransactionDefinition interface. Default is ISOLATION_DEFAULT. 
	 * @exception IllegalArgumentException if the supplied value is not 
	 * one of the {@code ISOLATION_} constants 
	 * @see #ISOLATION_DEFAULT 
	 */ 
	public final void setIsolationLevel(int isolationLevel) {
		if (!constants.getValues(PREFIX_ISOLATION).contains(isolationLevel)) {
			throw new IllegalArgumentException("Only values of isolation constants allowed");
		} 
		this.isolationLevel = isolationLevel;

6
CodeRank
This code example shows how to use the following methods:asNumber
		else if (lookupKey instanceof String) {
			String constantName = (String) lookupKey;
			if (!constantName.startsWith(DefaultTransactionDefinition.PREFIX_ISOLATION)) {
				throw new IllegalArgumentException("Only isolation constants allowed");
			} 
			return constants.asNumber(constantName);
		} 
		else { 
			throw new IllegalArgumentException(
					"Invalid lookup key - needs to be isolation level Integer or isolation level name String: " + lookupKey);
		} 
	} 
 
	@Override 
	protected Object determineCurrentLookupKey() {
		return TransactionSynchronizationManager.getCurrentTransactionIsolationLevel(); 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:asNumber
	 * @see javax.jms.Session#CLIENT_ACKNOWLEDGE 
	 * @see javax.jms.Session#DUPS_OK_ACKNOWLEDGE 
	 * @see javax.jms.Connection#createSession(boolean, int) 
	 */ 
	public void setSessionAcknowledgeModeName(String constantName) {
		setSessionAcknowledgeMode(sessionConstants.asNumber(constantName).intValue());
	} 
 
	/** 
	 * Set the JMS acknowledgement mode that is used when creating a JMS 
	 * {@link Session} to send a message. 
	 * <p>Default is {@link Session#AUTO_ACKNOWLEDGE}. 
	 * <p>Vendor-specific extensions to the acknowledgment mode can be set here as well. 
	 * <p>Note that that inside an EJB, the parameters to the 
	 * {@code create(Queue/Topic)Session(boolean transacted, int acknowledgeMode)} method 
	 * are not taken into account. Depending on the transaction context in the EJB, 
	 * the container makes its own decisions on these values. See section 17.3.5 
	 * of the EJB spec. 
	 * @param sessionAcknowledgeMode the acknowledgement mode constant 
	 * @see javax.jms.Session#AUTO_ACKNOWLEDGE 
5
CodeRank
This code example shows how to use the following methods:asNumber
    } 
 
    @Override 
    public void setSystemPropertiesModeName(String constantName) throws IllegalArgumentException {
        super.setSystemPropertiesModeName(constantName);
        Constants constants = new Constants(PropertyPlaceholderConfigurer.class);
        this.systemPropertiesMode = constants.asNumber(constantName).intValue();
    } 
 
    @Override 
    public void setSystemPropertiesMode(int systemPropertiesMode) {
        super.setSystemPropertiesMode(systemPropertiesMode);
        this.systemPropertiesMode = systemPropertiesMode;
    } 
 
    @Override 
    public void setPlaceholderPrefix(String placeholderPrefix) {
        super.setPlaceholderPrefix(placeholderPrefix);
        this.configuredPlaceholderPrefix = placeholderPrefix;
    } 
5
CodeRank
This code example shows how to use the following methods:getValues
	private static final Pattern PATTERN = Pattern.compile("\\$\\[\\p{Alpha}+\\]"); 
 
	/** 
	 * The {@code Set} of allowed placeholders. 
	 */ 
	private static final Set<Object> ALLOWED_PLACEHOLDERS = 
			new Constants(CustomizableTraceInterceptor.class).getValues("PLACEHOLDER_"); 
 
 
	/** 
	 * The message for method entry. 
	 */ 
	private String enterMessage = DEFAULT_ENTER_MESSAGE; 
 
	/** 
	 * The message for method exit. 
	 */ 
	private String exitMessage = DEFAULT_EXIT_MESSAGE; 
 
	/** 
5
CodeRank
This code example shows how to use the following methods:asNumber
	 * @see javax.jms.Session#SESSION_TRANSACTED 
	 * @see StandardJmsActivationSpecFactory 
	 * @see DefaultJmsActivationSpecFactory 
	 */ 
	public void setAcknowledgeModeName(String constantName) {
		setAcknowledgeMode(sessionConstants.asNumber(constantName).intValue());
	} 
 
	/** 
	 * Set the JMS acknowledgement mode to use. 
	 * @see javax.jms.Session#AUTO_ACKNOWLEDGE 
	 * @see javax.jms.Session#CLIENT_ACKNOWLEDGE 
	 * @see javax.jms.Session#DUPS_OK_ACKNOWLEDGE 
	 * @see javax.jms.Session#SESSION_TRANSACTED 
	 */ 
	public void setAcknowledgeMode(int acknowledgeMode) {
		this.acknowledgeMode = acknowledgeMode;
	} 
 
	/** 
5
CodeRank
This code example shows how to use the following methods:asNumber
	 * @param constantName name of the constant 
	 * @throws java.lang.IllegalArgumentException if an invalid constant was specified 
	 * @see #setSystemPropertiesMode 
	 */ 
	public void setSystemPropertiesModeName(String constantName) throws IllegalArgumentException {
		this.systemPropertiesMode = constants.asNumber(constantName).intValue();
	} 
 
	/** 
	 * Set how to check system properties: as fallback, as override, or never. 
	 * For example, will resolve ${user.dir} to the "user.dir" system property. 
	 * <p>The default is "fallback": If not being able to resolve a placeholder 
	 * with the specified properties, a system property will be tried. 
	 * "override" will check for a system property first, before trying the 
	 * specified properties. "never" will not check system properties at all. 
	 * @see #SYSTEM_PROPERTIES_MODE_NEVER 
	 * @see #SYSTEM_PROPERTIES_MODE_FALLBACK 
	 * @see #SYSTEM_PROPERTIES_MODE_OVERRIDE 
	 * @see #setSystemPropertiesModeName 
	 */ 
5
CodeRank
This code example shows how to use the following methods:asNumber
	 * @see org.quartz.SimpleTrigger#MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT 
	 * @see org.quartz.SimpleTrigger#MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT 
	 * @see org.quartz.Trigger#MISFIRE_INSTRUCTION_SMART_POLICY 
	 */ 
	public void setMisfireInstructionName(String constantName) {
		this.misfireInstruction = constants.asNumber(constantName).intValue();
	} 
 
	/** 
	 * Associate a textual description with this trigger. 
	 */ 
	public void setDescription(String description) {
		this.description = description;
	} 
 
	@Override 
	public void setBeanName(String beanName) {
		this.beanName = beanName;
	} 
 
5
CodeRank
This code example shows how to use the following methods:asNumber
	 * @see org.quartz.CronTrigger#MISFIRE_INSTRUCTION_FIRE_ONCE_NOW 
	 * @see org.quartz.CronTrigger#MISFIRE_INSTRUCTION_DO_NOTHING 
	 * @see org.quartz.Trigger#MISFIRE_INSTRUCTION_SMART_POLICY 
	 */ 
	public void setMisfireInstructionName(String constantName) {
		this.misfireInstruction = constants.asNumber(constantName).intValue();
	} 
 
	/** 
	 * Associate a textual description with this trigger. 
	 */ 
	public void setDescription(String description) {
		this.description = description;
	} 
 
	@Override 
	public void setBeanName(String beanName) {
		this.beanName = beanName;
	} 
 
5
CodeRank
See Code Examples for Spring Framework Constants Methods: