本文整理汇总了Java中org.springframework.core.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.springframework.core包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertAllModifiersCovered
import org.springframework.core.Constants; //导入依赖的package包/类
private void assertAllModifiersCovered() {
Set<String> coveredModifiers = Sets.newHashSet("NONE",
"DIRTY_READ",
"EXCLUSIVE_READ_LOCK",
"FIFO_GROUPING_POLL",
"FIFO",
"IF_EXISTS",
"IGNORE_PARTIAL_FAILURE",
"MEMORY_ONLY_SEARCH",
"READ_COMMITTED",
"REPEATABLE_READ");
Set<String> actualModifiers = new Constants(ReadModifiers.class).getNames("");
Assert.assertEquals("Missing modifier should be added to openspaces-core.xsd!",
coveredModifiers, actualModifiers);
}
示例2: nullSafeToString
import org.springframework.core.Constants; //导入依赖的package包/类
/**
* Returns a String representation of the given <code>ServiceReference</code>.
*
* @param reference OSGi service reference (can be <code>null</code>)
* @return String representation of the given service reference
*/
public static String nullSafeToString(ServiceReference reference) {
if (reference == null)
return NULL_STRING;
StringBuilder buf = new StringBuilder();
Bundle owningBundle = reference.getBundle();
buf.append("ServiceReference [").append(OsgiStringUtils.nullSafeSymbolicName(owningBundle)).append("] ");
String clazzes[] = (String[]) reference.getProperty(org.osgi.framework.Constants.OBJECTCLASS);
buf.append(ObjectUtils.nullSafeToString(clazzes));
buf.append("={");
String[] keys = reference.getPropertyKeys();
for (int i = 0; i < keys.length; i++) {
if (!org.osgi.framework.Constants.OBJECTCLASS.equals(keys[i])) {
buf.append(keys[i]).append('=').append(reference.getProperty(keys[i]));
if (i < keys.length - 1) {
buf.append(',');
}
}
}
buf.append('}');
return buf.toString();
}
示例3: nullSafeNameAndSymName
import org.springframework.core.Constants; //导入依赖的package包/类
/**
* Returns the bundle name and symbolic name - useful when logging bundle info.
*
* @param bundle OSGi bundle (can be null)
* @return the bundle name and symbolic name
*/
public static String nullSafeNameAndSymName(Bundle bundle) {
if (bundle == null)
return NULL_STRING;
Dictionary dict = bundle.getHeaders();
if (dict == null)
return NULL_STRING;
StringBuilder buf = new StringBuilder();
String name = (String) dict.get(org.osgi.framework.Constants.BUNDLE_NAME);
if (name == null)
buf.append(NULL_STRING);
else
buf.append(name);
buf.append(" (");
String sname = (String) dict.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME);
if (sname == null)
buf.append(NULL_STRING);
else
buf.append(sname);
buf.append(")");
return buf.toString();
}
示例4: setModifierName
import org.springframework.core.Constants; //导入依赖的package包/类
/**
* @param modifierName The modifier constant name as defined in the relevant Modifiers class.
* @see {@link WriteModifiers}, {@link ReadModifiers}, {@link TakeModifiers},
* {@link CoutModifiers}, {@link ClearModifiers}, {@link ChangeModifiers}
*/
@SuppressWarnings("unchecked")
public void setModifierName(String modifierName) {
Constants constants = getConstants();
if (!constants.getNames("").contains(modifierName)) {
throw new IllegalArgumentException("Unknown modifier: " + modifierName + " for type: " + getObjectType());
}
modifier = (T) constants.asObject(modifierName);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:17,代码来源:AbstractSpaceProxyOperationModifierFactoryBean.java
示例5: assertAllModifiersCovered
import org.springframework.core.Constants; //导入依赖的package包/类
private void assertAllModifiersCovered() {
Set<String> coveredModifiers = Sets.newHashSet("NONE",
"DIRTY_READ",
"EXCLUSIVE_READ_LOCK",
"MEMORY_ONLY_SEARCH",
"READ_COMMITTED",
"REPEATABLE_READ");
Set<String> actualModifiers = new Constants(CountModifiers.class).getNames("");
Assert.assertEquals("Missing modifier should be added to openspaces-core.xsd!",
coveredModifiers, actualModifiers);
}
示例6: assertAllModifiersCovered
import org.springframework.core.Constants; //导入依赖的package包/类
private void assertAllModifiersCovered() {
Set<String> coveredModifiers = Sets.newHashSet("NONE",
"EVICT_ONLY",
"MEMORY_ONLY_SEARCH");
Set<String> actualModifiers = new Constants(ClearModifiers.class).getNames("");
Assert.assertEquals("Missing modifier should be added to openspaces-core.xsd!",
coveredModifiers, actualModifiers);
}
示例7: assertAllModifiersCovered
import org.springframework.core.Constants; //导入依赖的package包/类
private void assertAllModifiersCovered() {
Set<String> coveredModifiers = Sets.newHashSet("NONE",
"EVICT_ONLY",
"FIFO_GROUPING_POLL",
"FIFO",
"IF_EXISTS",
"IGNORE_PARTIAL_FAILURE",
"MEMORY_ONLY_SEARCH");
Set<String> actualModifiers = new Constants(TakeModifiers.class).getNames("");
Assert.assertEquals("Missing modifier should be added to openspaces-core.xsd!",
coveredModifiers, actualModifiers);
}
示例8: assertAllModifiersCovered
import org.springframework.core.Constants; //导入依赖的package包/类
private void assertAllModifiersCovered() {
Set<String> coveredModifiers = Sets.newHashSet("NONE",
"MEMORY_ONLY_SEARCH",
"ONE_WAY",
"RETURN_PREV_ON_UPDATE",
"UPDATE_ONLY",
"WRITE_ONLY",
"UPDATE_OR_WRITE",
"PARTIAL_UPDATE");
Set<String> actualModifiers = new Constants(WriteModifiers.class).getNames("");
Assert.assertEquals("Missing modifier should be added to openspaces-core.xsd!",
coveredModifiers, actualModifiers);
}
示例9: assertAllModifiersCovered
import org.springframework.core.Constants; //导入依赖的package包/类
private void assertAllModifiersCovered() {
Set<String> coveredModifiers = Sets.newHashSet("NONE",
"MEMORY_ONLY_SEARCH",
"ONE_WAY",
"RETURN_DETAILED_RESULTS");
Set<String> actualModifiers = new Constants(ChangeModifiers.class).getNames("");
Assert.assertEquals("Missing modifier should be added to openspaces-core.xsd!",
coveredModifiers, actualModifiers);
}
示例10: postProcess
import org.springframework.core.Constants; //导入依赖的package包/类
@Override
protected void postProcess(BeanDefinitionBuilder definitionBuilder, Element element) {
List<Element> eventTypes = DomUtils.getChildElementsByTagName(element, EVENT_TYPE);
if (eventTypes != null && eventTypes.size() > 0) {
// compute event type
int eventType = 0;
Constants types = new Constants(Event.class);
for (Iterator<Element> iter = eventTypes.iterator(); iter.hasNext();) {
Element evenTypeElement = iter.next();
eventType |= types.asNumber(DomUtils.getTextValue(evenTypeElement)).intValue();
}
definitionBuilder.addPropertyValue("eventTypes", Integer.valueOf(eventType));
}
List<Element> nodeTypeNames = DomUtils.getChildElementsByTagName(element, NODE_TYPE_NAME);
String[] nodeTypeValues = new String[nodeTypeNames.size()];
for (int i = 0; i < nodeTypeValues.length; i++) {
nodeTypeValues[i] = DomUtils.getTextValue(nodeTypeNames.get(i));
}
definitionBuilder.addPropertyValue(NODE_TYPE_NAME, nodeTypeValues);
List<Element> uuids = DomUtils.getChildElementsByTagName(element, UUID);
String[] uuidsValues = new String[uuids.size()];
for (int i = 0; i < uuidsValues.length; i++) {
uuidsValues[i] = DomUtils.getTextValue(uuids.get(i));
}
definitionBuilder.addPropertyValue(UUID, uuidsValues);
//TODO, reference a listenerBean, it is not a propertyReference
Element eventListner = DomUtils.getChildElementByTagName(element, "listener");
String listenerBeanRefName = DomUtils.getTextValue(eventListner);
definitionBuilder.addPropertyReference("listener", listenerBeanRefName);
}
示例11: setDefaultTransactionIsolationName
import org.springframework.core.Constants; //导入依赖的package包/类
public void setDefaultTransactionIsolationName(String constantName) {
if (constantName == null) {
throw new IllegalArgumentException("Isolation name must not be null");
}
Constants constants = new Constants(Connection.class);
setDefaultTransactionIsolation(constants.asNumber(PREFIX_ISOLATION + constantName).intValue());
}
示例12: nullSafeToString
import org.springframework.core.Constants; //导入依赖的package包/类
/**
* Returns a String representation of the given
* <code>ServiceReference</code>.
*
* @param reference OSGi service reference (can be <code>null</code>)
* @return String representation of the given service reference
*/
public static String nullSafeToString(ServiceReference reference) {
if (reference == null)
return NULL_STRING;
StringBuffer buf = new StringBuffer();
Bundle owningBundle = reference.getBundle();
buf.append("ServiceReference [").append(OsgiStringUtils.nullSafeSymbolicName(owningBundle)).append("] ");
String clazzes[] = (String[]) reference.getProperty(org.osgi.framework.Constants.OBJECTCLASS);
buf.append(ObjectUtils.nullSafeToString(clazzes));
buf.append("={");
String[] keys = reference.getPropertyKeys();
for (int i = 0; i < keys.length; i++) {
if (!org.osgi.framework.Constants.OBJECTCLASS.equals(keys[i])) {
buf.append(keys[i]).append('=').append(reference.getProperty(keys[i]));
if (i < keys.length - 1) {
buf.append(',');
}
}
}
buf.append('}');
return buf.toString();
}
示例13: nullSafeNameAndSymName
import org.springframework.core.Constants; //导入依赖的package包/类
/**
* Returns the bundle name and symbolic name - useful when logging bundle
* info.
*
* @param bundle OSGi bundle (can be null)
* @return the bundle name and symbolic name
*/
public static String nullSafeNameAndSymName(Bundle bundle) {
if (bundle == null)
return NULL_STRING;
Dictionary dict = bundle.getHeaders();
if (dict == null)
return NULL_STRING;
StringBuffer buf = new StringBuffer();
String name = (String) dict.get(org.osgi.framework.Constants.BUNDLE_NAME);
if (name == null)
buf.append(NULL_STRING);
else
buf.append(name);
buf.append(" (");
String sname = (String) dict.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME);
if (sname == null)
buf.append(NULL_STRING);
else
buf.append(sname);
buf.append(")");
return buf.toString();
}
示例14: setSystemPropertiesModeName
import org.springframework.core.Constants; //导入依赖的package包/类
@Override
public void setSystemPropertiesModeName(String constantName) throws IllegalArgumentException {
super.setSystemPropertiesModeName(constantName);
Constants constants = new Constants(PropertyPlaceholderConfigurer.class);
this.systemPropertiesMode = constants.asNumber(constantName).intValue();
}
示例15: getConstants
import org.springframework.core.Constants; //导入依赖的package包/类
@Override
protected Constants getConstants() {
return constants;
}