Java 类javax.management.openmbean.TabularType 实例源码
项目:acs-aem-commons
文件:AbstractGuavaCacheMBean.java
@Override
public final TabularData getCacheContents() throws OpenDataException {
final CompositeType cacheEntryType = getCacheEntryType();
final TabularDataSupport tabularData = new TabularDataSupport(
new TabularType("Cache Entries", "Cache Entries", cacheEntryType, new String[] { "Cache Key" }));
ConcurrentMap<K, V> cacheAsMap = getCache().asMap();
for (final Map.Entry<K, V> entry : cacheAsMap.entrySet()) {
final Map<String, Object> data = new HashMap<String, Object>();
data.put("Cache Key", entry.getKey().toString());
V cacheObj = entry.getValue();
if (cacheObj != null) {
addCacheData(data, cacheObj);
}
tabularData.put(new CompositeDataSupport(cacheEntryType, data));
}
return tabularData;
}
项目:OpenJSharp
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:ChronoBike
文件:BaseOpenMBean.java
protected void addOpenAttribute(String csDescription, Class cls, String csMethodName, TabularType tabularType)
{
Method methodGet = MethodFinder.getMethod(cls, "get"+csMethodName);
boolean bCanGet = true;
if(methodGet == null)
bCanGet = false;
Method methodSet = MethodFinder.getMethod(cls, "set"+csMethodName, CompositeData.class);
boolean bCanSet = true;
if(methodSet == null)
bCanSet = false;
OpenMBeanAttributeInfoSupport attrOpen = new OpenMBeanAttributeInfoSupport(csMethodName, csDescription, tabularType, bCanGet, bCanSet, false);
OpenMBeanAttributeInfoWrapper attr = new OpenMBeanAttributeInfoWrapper(csMethodName, csDescription, attrOpen, methodGet, methodSet);
if(m_arrOpenMBeanAttributeInfosWrapper == null)
m_arrOpenMBeanAttributeInfosWrapper = new ArrayList<OpenMBeanAttributeInfoWrapper>();
m_arrOpenMBeanAttributeInfosWrapper.add(attr);
}
项目:jdk8u-jdk
文件:LazyCompositeData.java
private static boolean isTypeMatched(OpenType<?> ot1, OpenType<?> ot2) {
if (ot1 instanceof CompositeType) {
if (! (ot2 instanceof CompositeType))
return false;
if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
return false;
} else if (ot1 instanceof TabularType) {
if (! (ot2 instanceof TabularType))
return false;
if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
return false;
} else if (ot1 instanceof ArrayType) {
if (! (ot2 instanceof ArrayType))
return false;
if (!isTypeMatched((ArrayType<?>) ot1, (ArrayType<?>) ot2)) {
return false;
}
} else if (!ot1.equals(ot2)) {
return false;
}
return true;
}
项目:jdk8u-jdk
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:jdk8u-jdk
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:openjdk-jdk10
文件:LazyCompositeData.java
private static boolean isTypeMatched(OpenType<?> ot1, OpenType<?> ot2) {
if (ot1 instanceof CompositeType) {
if (! (ot2 instanceof CompositeType))
return false;
if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
return false;
} else if (ot1 instanceof TabularType) {
if (! (ot2 instanceof TabularType))
return false;
if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
return false;
} else if (ot1 instanceof ArrayType) {
if (! (ot2 instanceof ArrayType))
return false;
if (!isTypeMatched((ArrayType<?>) ot1, (ArrayType<?>) ot2)) {
return false;
}
} else if (!ot1.equals(ot2)) {
return false;
}
return true;
}
项目:openjdk-jdk10
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:openjdk-jdk10
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:openjdk9
文件:LazyCompositeData.java
private static boolean isTypeMatched(OpenType<?> ot1, OpenType<?> ot2) {
if (ot1 instanceof CompositeType) {
if (! (ot2 instanceof CompositeType))
return false;
if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
return false;
} else if (ot1 instanceof TabularType) {
if (! (ot2 instanceof TabularType))
return false;
if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
return false;
} else if (ot1 instanceof ArrayType) {
if (! (ot2 instanceof ArrayType))
return false;
if (!isTypeMatched((ArrayType<?>) ot1, (ArrayType<?>) ot2)) {
return false;
}
} else if (!ot1.equals(ot2)) {
return false;
}
return true;
}
项目:openjdk9
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:openjdk9
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:jdk8u_jdk
文件:LazyCompositeData.java
private static boolean isTypeMatched(OpenType<?> ot1, OpenType<?> ot2) {
if (ot1 instanceof CompositeType) {
if (! (ot2 instanceof CompositeType))
return false;
if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
return false;
} else if (ot1 instanceof TabularType) {
if (! (ot2 instanceof TabularType))
return false;
if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
return false;
} else if (ot1 instanceof ArrayType) {
if (! (ot2 instanceof ArrayType))
return false;
if (!isTypeMatched((ArrayType<?>) ot1, (ArrayType<?>) ot2)) {
return false;
}
} else if (!ot1.equals(ot2)) {
return false;
}
return true;
}
项目:jdk8u_jdk
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:jdk8u_jdk
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:lookaside_java-1.8.0-openjdk
文件:LazyCompositeData.java
private static boolean isTypeMatched(OpenType<?> ot1, OpenType<?> ot2) {
if (ot1 instanceof CompositeType) {
if (! (ot2 instanceof CompositeType))
return false;
if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
return false;
} else if (ot1 instanceof TabularType) {
if (! (ot2 instanceof TabularType))
return false;
if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
return false;
} else if (ot1 instanceof ArrayType) {
if (! (ot2 instanceof ArrayType))
return false;
if (!isTypeMatched((ArrayType<?>) ot1, (ArrayType<?>) ot2)) {
return false;
}
} else if (!ot1.equals(ot2)) {
return false;
}
return true;
}
项目:lookaside_java-1.8.0-openjdk
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:lookaside_java-1.8.0-openjdk
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:discoursedb-core
文件:APIStatisticsOpenMBean.java
public APIStatisticsOpenMBean(APIStatistics apiStatistics) {
API_STATISTICS = apiStatistics;
try {
METHOD_STATS_TYPE =
new CompositeType("method statistics", "method statistics",
ITEM_NAMES, ITEM_DESCRIPTIONS, ITEM_TYPES);
String[] index = {"methodName"};
API_STATISTICS_TYPE = new TabularType("API statistics",
"list of methods",
METHOD_STATS_TYPE,
index);
} catch (OpenDataException e) {
throw new RuntimeException(e);
}
}
项目:scylla-jmx
文件:FailureDetector.java
@Override
public TabularData getPhiValues() throws OpenDataException {
final CompositeType ct = new CompositeType("Node", "Node", new String[] { "Endpoint", "PHI" },
new String[] { "IP of the endpoint", "PHI value" },
new OpenType[] { SimpleType.STRING, SimpleType.DOUBLE });
final TabularDataSupport results = new TabularDataSupport(
new TabularType("PhiList", "PhiList", ct, new String[] { "Endpoint" }));
final JsonArray arr = client.getJsonArray("/failure_detector/endpoint_phi_values");
for (JsonValue v : arr) {
JsonObject o = (JsonObject) v;
String endpoint = o.getString("endpoint");
double phi = Double.parseDouble(o.getString("phi"));
if (phi != Double.MIN_VALUE) {
// returned values are scaled by PHI_FACTOR so that the are on
// the same scale as PhiConvictThreshold
final CompositeData data = new CompositeDataSupport(ct, new String[] { "Endpoint", "PHI" },
new Object[] { endpoint, phi * PHI_FACTOR });
results.put(data);
}
}
return results;
}
项目:parfait
文件:JmxInProgressMonitor.java
@Override
public TabularData apply(InProgressSnapshot from) {
List<OpenType<?>> types = Lists.transform(from.getColumnClasses(), CLASS_TO_OPENTYPE);
CompositeType rowType;
try {
int columnCount = from.getColumnCount();
rowType = new CompositeType("Snapshot row", "Snapshot row", from.getColumnNames()
.toArray(new String[columnCount]), from.getColumnDescriptions().toArray(
new String[columnCount]), types.toArray(new OpenType<?>[columnCount]));
TabularType type = new TabularType("Snapshot", "Snapshot", rowType,
new String[] { "Thread name" });
TabularData data = new TabularDataSupport(type);
for (Map<String, Object> dataRow : from.getValues()) {
CompositeData row = new CompositeDataSupport(rowType, dataRow);
data.put(row);
}
return data;
} catch (OpenDataException e) {
throw new RuntimeException(e);
}
}
项目:infobip-open-jdk-8
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:infobip-open-jdk-8
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:jdk8u-dev-jdk
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:jdk8u-dev-jdk
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:jdk7-jdk
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:jdk7-jdk
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:openjdk-source-code-learn
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:openjdk-source-code-learn
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:OLD-OpenJDK8
文件:DefaultMXBeanMappingFactory.java
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap,
Type keyType, Type valueType,
MXBeanMappingFactory factory)
throws OpenDataException {
final String objTypeName = typeName(objType);
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType =
new CompositeType(objTypeName,
objTypeName,
keyValueArray,
keyValueArray,
new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType,
keyMapping, valueMapping);
}
项目:OLD-OpenJDK8
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}
项目:wildfly-core
文件:ExpressionTypeConverterUnitTestCase.java
@Test
public void testSimpleTypeObject() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
TypeConverter converter = getConverter(description);
assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.STRING);
ModelNode node = new ModelNode();
node.get("one").set(1L);
node.get("two").set(2L);
TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
Assert.assertEquals(2, tabularData.size());
Assert.assertEquals("1", tabularData.get(new Object[] {"one"}).get("value"));
Assert.assertEquals("2", tabularData.get(new Object[] {"two"}).get("value"));
Assert.assertEquals(node, converter.toModelNode(tabularData));
//Allow plain map as well? Yeah why not!
Map<String, String> map = new HashMap<String, String>();
map.put("one", "1");
map.put("two", "2");
Assert.assertEquals(node, converter.toModelNode(map));
}
项目:wildfly-core
文件:ExpressionTypeConverterUnitTestCase.java
@Test
public void testByteArrayObject() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT, ModelType.BYTES);
TypeConverter converter = getConverter(description);
assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, ArrayType.getPrimitiveArrayType(byte[].class));
ModelNode node = new ModelNode();
node.get("one").set(new byte[] {1,2});
node.get("two").set(new byte[] {3,4});
TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
Assert.assertEquals(2, tabularData.size());
Assert.assertTrue(Arrays.equals(new byte[] {1,2}, (byte[])tabularData.get(new Object[] {"one"}).get("value")));
Assert.assertTrue(Arrays.equals(new byte[] {3,4}, (byte[])tabularData.get(new Object[] {"two"}).get("value")));
//Allow plain map as well? Yeah why not!
Map<String, byte[]> map = new HashMap<String, byte[]>();
map.put("one", new byte[] {1,2});
map.put("two", new byte[] {3,4});
Assert.assertEquals(node, converter.toModelNode(map));
}
项目:wildfly-core
文件:ExpressionTypeConverterUnitTestCase.java
@Test
public void testSimpleTypeObjectExpressions() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
description.get(EXPRESSIONS_ALLOWED).set(true);
TypeConverter converter = getConverter(description);
assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.STRING);
ModelNode node = new ModelNode();
node.get("one").set(new ValueExpression("${this.should.not.exist.!!!!!:1}"));
node.get("two").set(new ValueExpression("${this.should.not.exist.!!!!!:2}"));
TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
Assert.assertEquals(2, tabularData.size());
Assert.assertEquals("${this.should.not.exist.!!!!!:1}", tabularData.get(new Object[] {"one"}).get("value"));
Assert.assertEquals("${this.should.not.exist.!!!!!:2}", tabularData.get(new Object[] {"two"}).get("value"));
Assert.assertEquals(node, converter.toModelNode(tabularData));
}
项目:wildfly-core
文件:ExpressionTypeConverterUnitTestCase.java
@Test
public void testSimpleTypeObjectEmpty() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
TypeConverter converter = getConverter(description);
assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.STRING);
ModelNode node = new ModelNode();
node.get("one").set("");
node.get("two").set("");
TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
Assert.assertEquals(2, tabularData.size());
Assert.assertNull(tabularData.get(new Object[] {"one"}).get("value"));
Assert.assertNull(tabularData.get(new Object[] {"two"}).get("value"));
ModelNode expected = new ModelNode();
expected.get("one");
expected.get("two");
Assert.assertEquals(expected, converter.toModelNode(tabularData));
}
项目:wildfly-core
文件:LegacyTypeConverterUnitTestCase.java
@Test
public void testSimpleTypeObject() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
TypeConverter converter = getConverter(description);
assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);
ModelNode node = new ModelNode();
node.get("one").set(1L);
node.get("two").set(2L);
TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
Assert.assertEquals(2, tabularData.size());
Assert.assertEquals((long) 1, tabularData.get(new Object[] {"one"}).get("value"));
Assert.assertEquals((long) 2, tabularData.get(new Object[] {"two"}).get("value"));
Assert.assertEquals(node, converter.toModelNode(tabularData));
//Allow plain map as well? Yeah why not!
Map<String, Long> map = new HashMap<String, Long>();
map.put("one", 1L);
map.put("two", 2L);
Assert.assertEquals(node, converter.toModelNode(map));
}
项目:wildfly-core
文件:LegacyTypeConverterUnitTestCase.java
@Test
public void testByteArrayObject() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT, ModelType.BYTES);
TypeConverter converter = getConverter(description);
assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, ArrayType.getPrimitiveArrayType(byte[].class));
ModelNode node = new ModelNode();
node.get("one").set(new byte[] {1,2});
node.get("two").set(new byte[] {3,4});
TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
Assert.assertEquals(2, tabularData.size());
Assert.assertTrue(Arrays.equals(new byte[] {1,2}, (byte[])tabularData.get(new Object[] {"one"}).get("value")));
Assert.assertTrue(Arrays.equals(new byte[] {3,4}, (byte[])tabularData.get(new Object[] {"two"}).get("value")));
//Allow plain map as well? Yeah why not!
Map<String, byte[]> map = new HashMap<String, byte[]>();
map.put("one", new byte[] {1,2});
map.put("two", new byte[] {3,4});
Assert.assertEquals(node, converter.toModelNode(map));
}
项目:wildfly-core
文件:LegacyTypeConverterUnitTestCase.java
@Test
public void testSimpleTypeObjectExpressions() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
description.get(EXPRESSIONS_ALLOWED).set(true);
TypeConverter converter = getConverter(description);
assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);
ModelNode node = new ModelNode();
node.get("one").set(new ValueExpression("${this.should.not.exist.!!!!!:1}"));
node.get("two").set(new ValueExpression("${this.should.not.exist.!!!!!:2}"));
TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
Assert.assertEquals(2, tabularData.size());
Assert.assertEquals((long) 1, tabularData.get(new Object[] {"one"}).get("value"));
Assert.assertEquals((long) 2, tabularData.get(new Object[] {"two"}).get("value"));
}
项目:wildfly-core
文件:LegacyTypeConverterUnitTestCase.java
@Test
public void testSimpleTypeObjectEmpty() throws Exception {
ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
TypeConverter converter = getConverter(description);
assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);
ModelNode node = new ModelNode();
node.get("one").set("");
node.get("two").set("");
TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
Assert.assertEquals(2, tabularData.size());
Assert.assertNull(tabularData.get(new Object[] {"one"}).get("value"));
Assert.assertNull(tabularData.get(new Object[] {"two"}).get("value"));
ModelNode expected = new ModelNode();
expected.get("one");
expected.get("two");
Assert.assertEquals(expected, converter.toModelNode(tabularData));
}
项目:JAVA_UNIT
文件:MXBeanTest.java
private static void compareTabularType(TabularType t1, TabularType t2) {
if (t1.equals(t2)) {
System.out.println("same tabular type");
return;
}
if (t1.getClassName().equals(t2.getClassName()))
System.out.println("same class name");
if (t1.getDescription().equals(t2.getDescription()))
System.out.println("same description");
else {
System.out.println("t1 description: " + t1.getDescription());
System.out.println("t2 description: " + t2.getDescription());
}
if (t1.getIndexNames().equals(t2.getIndexNames()))
System.out.println("same index names");
if (t1.getRowType().equals(t2.getRowType()))
System.out.println("same row type");
}