java类javax.management.openmbean.CompositeType的实例源码

SlowQueryReport.java 文件源码 项目:tomcat7 阅读 30 收藏 0 点赞 0 评论 0
public CompositeDataSupport getCompositeData(final CompositeType type) throws OpenDataException{
    Object[] values = new Object[] {
            query,
            Integer.valueOf(nrOfInvocations),
            Long.valueOf(maxInvocationTime),
            Long.valueOf(maxInvocationDate),
            Long.valueOf(minInvocationTime),
            Long.valueOf(minInvocationDate),
            Long.valueOf(totalInvocationTime),
            Long.valueOf(failures),
            Integer.valueOf(prepareCount),
            Long.valueOf(prepareTime),
            Long.valueOf(lastInvocation)
    };
    return new CompositeDataSupport(type,FIELD_NAMES,values);
}
GarbageCollectionNotifInfoCompositeData.java 文件源码 项目:OpenJSharp 阅读 27 收藏 0 点赞 0 评论 0
protected CompositeData getCompositeData() {
    // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
    // gcNotifInfoItemNames!
    final Object[] gcNotifInfoItemValues;
    gcNotifInfoItemValues = new Object[] {
        gcNotifInfo.getGcName(),
        gcNotifInfo.getGcAction(),
        gcNotifInfo.getGcCause(),
        GcInfoCompositeData.toCompositeData(gcNotifInfo.getGcInfo())
    };

    CompositeType gict = getCompositeTypeByBuilder();

    try {
        return new CompositeDataSupport(gict,
                                        gcNotifInfoItemNames,
                                        gcNotifInfoItemValues);
    } catch (OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
DefaultMXBeanMappingFactory.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
CompositeMapping(Class<?> targetClass,
                 CompositeType compositeType,
                 String[] itemNames,
                 Method[] getters,
                 MXBeanMappingFactory factory) throws OpenDataException {
    super(targetClass, compositeType);

    assert(itemNames.length == getters.length);

    this.itemNames = itemNames;
    this.getters = getters;
    this.getterMappings = new MXBeanMapping[getters.length];
    for (int i = 0; i < getters.length; i++) {
        Type retType = getters[i].getGenericReturnType();
        getterMappings[i] = factory.mappingForType(retType, factory);
    }
}
DefaultMXBeanMappingFactory.java 文件源码 项目:OpenJSharp 阅读 23 收藏 0 点赞 0 评论 0
@Override
final Object toNonNullOpenValue(Object value)
        throws OpenDataException {
    CompositeType ct = (CompositeType) getOpenType();
    if (value instanceof CompositeDataView)
        return ((CompositeDataView) value).toCompositeData(ct);
    if (value == null)
        return null;

    Object[] values = new Object[getters.length];
    for (int i = 0; i < getters.length; i++) {
        try {
            Object got = MethodUtil.invoke(getters[i], value, (Object[]) null);
            values[i] = getterMappings[i].toOpenValue(got);
        } catch (Exception e) {
            throw openDataException("Error calling getter for " +
                                    itemNames[i] + ": " + e, e);
        }
    }
    return new CompositeDataSupport(ct, itemNames, values);
}
UnionCompositeAttributeResolvingStrategy.java 文件源码 项目:hashsdn-controller 阅读 21 收藏 0 点赞 0 评论 0
@Override
protected Map<String, Object> preprocessValueMap(final Map<?, ?> valueMap) {
    CompositeType openType = getOpenType();

    Preconditions.checkArgument(
            valueMap.size() == 1 && valueMap.containsKey(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION),
            "Unexpected structure of incoming map, expecting one element under %s, but was %s",
            JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION, valueMap);

    Map<String, Object> newMap = Maps.newHashMap();

    for (String key : openType.keySet()) {
        if (openType.getDescription(key).equals(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION)) {
            newMap.put(key, valueMap.get(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION));
        } else {
            newMap.put(key, null);
        }
    }
    return newMap;
}
CompositeConverter.java 文件源码 项目:monarch 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Converts to open value
 */
final Object toNonNullOpenValue(Object value) throws OpenDataException {
  CompositeType ct = (CompositeType) getOpenType();
  if (value instanceof CompositeDataView)
    return ((CompositeDataView) value).toCompositeData(ct);
  if (value == null)
    return null;

  Object[] values = new Object[getters.length];
  for (int i = 0; i < getters.length; i++) {
    try {
      Object got = getters[i].invoke(value, (Object[]) null);
      values[i] = getterConverters[i].toOpenValue(got);
    } catch (Exception e) {
      throw openDataException("Error calling getter for " + itemNames[i] + ": " + e, e);
    }
  }
  return new CompositeDataSupport(ct, itemNames, values);
}
BaseOpenMBean.java 文件源码 项目:ChronoBike 阅读 21 收藏 0 点赞 0 评论 0
protected void addOpenAttribute(String csDescription, Class cls, String csMethodName, CompositeType compositeType)
{
    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, compositeType, 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);
}
SlowQueryReport.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 22 收藏 0 点赞 0 评论 0
public CompositeDataSupport getCompositeData(final CompositeType type) throws OpenDataException{
    Object[] values = new Object[] {
            query,
            Integer.valueOf(nrOfInvocations),
            Long.valueOf(maxInvocationTime),
            Long.valueOf(maxInvocationDate),
            Long.valueOf(minInvocationTime),
            Long.valueOf(minInvocationDate),
            Long.valueOf(totalInvocationTime),
            Long.valueOf(failures),
            Integer.valueOf(prepareCount),
            Long.valueOf(prepareTime),
            Long.valueOf(lastInvocation)
    };
    return new CompositeDataSupport(type,FIELD_NAMES,values);
}
GarbageCollectionNotifInfoCompositeData.java 文件源码 项目:jdk8u-jdk 阅读 27 收藏 0 点赞 0 评论 0
protected CompositeData getCompositeData() {
    // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
    // gcNotifInfoItemNames!
    final Object[] gcNotifInfoItemValues;
    gcNotifInfoItemValues = new Object[] {
        gcNotifInfo.getGcName(),
        gcNotifInfo.getGcAction(),
        gcNotifInfo.getGcCause(),
        GcInfoCompositeData.toCompositeData(gcNotifInfo.getGcInfo())
    };

    CompositeType gict = getCompositeTypeByBuilder();

    try {
        return new CompositeDataSupport(gict,
                                        gcNotifInfoItemNames,
                                        gcNotifInfoItemValues);
    } catch (OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
LazyCompositeData.java 文件源码 项目:jdk8u-jdk 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Compares two CompositeTypes and returns true if
 * all items in type1 exist in type2 and their item types
 * are the same.
 * @param type1 the base composite type
 * @param type2 the checked composite type
 * @return {@code true} if all items in type1 exist in type2 and their item
 *         types are the same.
 */
protected static boolean isTypeMatched(CompositeType type1, CompositeType type2) {
    if (type1 == type2) return true;

    // We can't use CompositeType.isValue() since it returns false
    // if the type name doesn't match.
    Set<String> allItems = type1.keySet();

    // Check all items in the type1 exist in type2
    if (!type2.keySet().containsAll(allItems))
        return false;

    return allItems.stream().allMatch(
        item -> isTypeMatched(type1.getType(item), type2.getType(item))
    );
}
LazyCompositeData.java 文件源码 项目:jdk8u-jdk 阅读 29 收藏 0 点赞 0 评论 0
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;
}
DefaultMXBeanMappingFactory.java 文件源码 项目:jdk8u-jdk 阅读 30 收藏 0 点赞 0 评论 0
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);
}
DefaultMXBeanMappingFactory.java 文件源码 项目:jdk8u-jdk 阅读 21 收藏 0 点赞 0 评论 0
CompositeMapping(Class<?> targetClass,
                 CompositeType compositeType,
                 String[] itemNames,
                 Method[] getters,
                 MXBeanMappingFactory factory) throws OpenDataException {
    super(targetClass, compositeType);

    assert(itemNames.length == getters.length);

    this.itemNames = itemNames;
    this.getters = getters;
    this.getterMappings = new MXBeanMapping[getters.length];
    for (int i = 0; i < getters.length; i++) {
        Type retType = getters[i].getGenericReturnType();
        getterMappings[i] = factory.mappingForType(retType, factory);
    }
}
DefaultMXBeanMappingFactory.java 文件源码 项目:jdk8u-jdk 阅读 25 收藏 0 点赞 0 评论 0
@Override
final Object toNonNullOpenValue(Object value)
        throws OpenDataException {
    CompositeType ct = (CompositeType) getOpenType();
    if (value instanceof CompositeDataView)
        return ((CompositeDataView) value).toCompositeData(ct);
    if (value == null)
        return null;

    Object[] values = new Object[getters.length];
    for (int i = 0; i < getters.length; i++) {
        try {
            Object got = MethodUtil.invoke(getters[i], value, (Object[]) null);
            values[i] = getterMappings[i].toOpenValue(got);
        } catch (Exception e) {
            throw openDataException("Error calling getter for " +
                                    itemNames[i] + ": " + e, e);
        }
    }
    return new CompositeDataSupport(ct, itemNames, values);
}
GarbageCollectionNotifInfoCompositeData.java 文件源码 项目:openjdk-jdk10 阅读 21 收藏 0 点赞 0 评论 0
protected CompositeData getCompositeData() {
    // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
    // gcNotifInfoItemNames!
    final Object[] gcNotifInfoItemValues;
    gcNotifInfoItemValues = new Object[] {
        gcNotifInfo.getGcName(),
        gcNotifInfo.getGcAction(),
        gcNotifInfo.getGcCause(),
        GcInfoCompositeData.toCompositeData(gcNotifInfo.getGcInfo())
    };

    CompositeType gict = getCompositeTypeByBuilder();

    try {
        return new CompositeDataSupport(gict,
                                        gcNotifInfoItemNames,
                                        gcNotifInfoItemValues);
    } catch (OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
LazyCompositeData.java 文件源码 项目:openjdk-jdk10 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Compares two CompositeTypes and returns true if
 * all items in type1 exist in type2 and their item types
 * are the same.
 * @param type1 the base composite type
 * @param type2 the checked composite type
 * @return {@code true} if all items in type1 exist in type2 and their item
 *         types are the same.
 */
protected static boolean isTypeMatched(CompositeType type1, CompositeType type2) {
    if (type1 == type2) return true;

    // We can't use CompositeType.isValue() since it returns false
    // if the type name doesn't match.
    Set<String> allItems = type1.keySet();

    // Check all items in the type1 exist in type2
    if (!type2.keySet().containsAll(allItems))
        return false;

    return allItems.stream().allMatch(
        item -> isTypeMatched(type1.getType(item), type2.getType(item))
    );
}
LazyCompositeData.java 文件源码 项目:openjdk-jdk10 阅读 31 收藏 0 点赞 0 评论 0
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;
}
DefaultMXBeanMappingFactory.java 文件源码 项目:openjdk-jdk10 阅读 24 收藏 0 点赞 0 评论 0
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);
}
DefaultMXBeanMappingFactory.java 文件源码 项目:openjdk-jdk10 阅读 26 收藏 0 点赞 0 评论 0
CompositeMapping(Class<?> targetClass,
                 CompositeType compositeType,
                 String[] itemNames,
                 Method[] getters,
                 MXBeanMappingFactory factory) throws OpenDataException {
    super(targetClass, compositeType);

    assert(itemNames.length == getters.length);

    this.itemNames = itemNames;
    this.getters = getters;
    this.getterMappings = new MXBeanMapping[getters.length];
    for (int i = 0; i < getters.length; i++) {
        Type retType = getters[i].getGenericReturnType();
        getterMappings[i] = factory.mappingForType(retType, factory);
    }
}
DefaultMXBeanMappingFactory.java 文件源码 项目:openjdk-jdk10 阅读 27 收藏 0 点赞 0 评论 0
@Override
final Object toNonNullOpenValue(Object value)
        throws OpenDataException {
    CompositeType ct = (CompositeType) getOpenType();
    if (value instanceof CompositeDataView)
        return ((CompositeDataView) value).toCompositeData(ct);
    if (value == null)
        return null;

    Object[] values = new Object[getters.length];
    for (int i = 0; i < getters.length; i++) {
        try {
            Object got = MethodUtil.invoke(getters[i], value, (Object[]) null);
            values[i] = getterMappings[i].toOpenValue(got);
        } catch (Exception e) {
            throw openDataException("Error calling getter for " +
                                    itemNames[i] + ": " + e, e);
        }
    }
    return new CompositeDataSupport(ct, itemNames, values);
}
JavaAttribute.java 文件源码 项目:hashsdn-controller 阅读 28 收藏 0 点赞 0 评论 0
private OpenType<?> getCompositeType(final Type baseType, final TypeDefinition<?> baseTypeDefinition) {

        final SimpleType<?> innerItemType = SimpleTypeResolver.getSimpleType(baseType);
        final String innerItemName = this.typeProviderWrapper.getJMXParamForBaseType(baseTypeDefinition);

        final String[] itemNames = new String[]{innerItemName};
        final String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();

        final OpenType<?>[] itemTypes = new OpenType[]{innerItemType};
        try {
            return new CompositeType(getUpperCaseCammelCase(), description, itemNames, itemNames, itemTypes);
        } catch (final OpenDataException e) {
            throw new RuntimeException("Unable to create " + CompositeType.class + " with inner element of type "
                    + itemTypes, e);
        }
    }
TOAttribute.java 文件源码 项目:hashsdn-controller 阅读 31 收藏 0 点赞 0 评论 0
@Override
public CompositeType getOpenType() {
    final String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();

    final FunctionImpl functionImpl = new FunctionImpl();
    final Map<String, AttributeIfc> jmxPropertiesToTypesMap = getJmxPropertiesToTypesMap();
    final OpenType<?>[] itemTypes = Collections2.transform(
            jmxPropertiesToTypesMap.entrySet(), functionImpl).toArray(
            new OpenType<?>[] {});
    final String[] itemNames = functionImpl.getItemNames();
    try {
        // TODO add package name to create fully qualified name for this
        // type
        final CompositeType compositeType = new CompositeType(
                getUpperCaseCammelCase(), description, itemNames,
                itemNames, itemTypes);
        return compositeType;
    } catch (final OpenDataException e) {
        throw new RuntimeException("Unable to create CompositeType for "
                + this, e);
    }
}
JMXJsonServlet.java 文件源码 项目:hadoop-oss 阅读 26 收藏 0 点赞 0 评论 0
private void writeObject(JsonGenerator jg, Object value) throws IOException {
  if(value == null) {
    jg.writeNull();
  } else {
    Class<?> c = value.getClass();
    if (c.isArray()) {
      jg.writeStartArray();
      int len = Array.getLength(value);
      for (int j = 0; j < len; j++) {
        Object item = Array.get(value, j);
        writeObject(jg, item);
      }
      jg.writeEndArray();
    } else if(value instanceof Number) {
      Number n = (Number)value;
      jg.writeNumber(n.toString());
    } else if(value instanceof Boolean) {
      Boolean b = (Boolean)value;
      jg.writeBoolean(b);
    } else if(value instanceof CompositeData) {
      CompositeData cds = (CompositeData)value;
      CompositeType comp = cds.getCompositeType();
      Set<String> keys = comp.keySet();
      jg.writeStartObject();
      for(String key: keys) {
        writeAttribute(jg, key, cds.get(key));
      }
      jg.writeEndObject();
    } else if(value instanceof TabularData) {
      TabularData tds = (TabularData)value;
      jg.writeStartArray();
      for(Object entry : tds.values()) {
        writeObject(jg, entry);
      }
      jg.writeEndArray();
    } else {
      jg.writeString(value.toString());
    }
  }
}
JSON1.java 文件源码 项目:APacheSynapseSimplePOC 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Will call all getter methods on payload that are defined in the given interfaces
 */
public static Map makeCallerChain ( Object payload, Class... ifaces ) throws OpenDataException, NoSuchMethodException, InstantiationException,
        IllegalAccessException, InvocationTargetException, Exception, ClassNotFoundException {
    CompositeType rt = new CompositeType("a", "b", new String[] {
        "a"
    }, new String[] {
        "a"
    }, new OpenType[] {
        javax.management.openmbean.SimpleType.INTEGER
    });
    TabularType tt = new TabularType("a", "b", rt, new String[] {
        "a"
    });
    TabularDataSupport t1 = new TabularDataSupport(tt);
    TabularDataSupport t2 = new TabularDataSupport(tt);

    // we need to make payload implement composite data
    // it's very likely that there are other proxy impls that could be used
    AdvisedSupport as = new AdvisedSupport();
    as.setTarget(payload);
    InvocationHandler delegateInvocationHandler = (InvocationHandler) Reflections
            .getFirstCtor("org.springframework.aop.framework.JdkDynamicAopProxy").newInstance(as);
    InvocationHandler cdsInvocationHandler = Gadgets.createMemoizedInvocationHandler(Gadgets.createMap("getCompositeType", rt));
    CompositeInvocationHandlerImpl invocationHandler = new CompositeInvocationHandlerImpl();
    invocationHandler.addInvocationHandler(CompositeData.class, cdsInvocationHandler);
    invocationHandler.setDefaultHandler(delegateInvocationHandler);
    final CompositeData cdsProxy = Gadgets.createProxy(invocationHandler, CompositeData.class, ifaces);

    JSONObject jo = new JSONObject();
    Map m = new HashMap();
    m.put("t", cdsProxy);
    Reflections.setFieldValue(jo, "properties", m);
    Reflections.setFieldValue(jo, "properties", m);
    Reflections.setFieldValue(t1, "dataMap", jo);
    Reflections.setFieldValue(t2, "dataMap", jo);
    return Gadgets.makeMap(t1, t2);
}
ObjectResolver.java 文件源码 项目:hashsdn-controller 阅读 30 收藏 0 点赞 0 评论 0
@Override
protected AttributeResolvingStrategy<?, ? extends OpenType<?>> caseJavaUnionAttribute(final OpenType<?> openType) {

    Preconditions.checkState(openType instanceof CompositeType, "Unexpected open type, expected %s but was %s");
    CompositeType compositeType = (CompositeType) openType;

    Map<String, AttributeResolvingStrategy<?, ? extends OpenType<?>>> innerMap = Maps.newHashMap();
    Map<String, String> yangToJmxMapping = Maps.newHashMap();
    fillMappingForComposite(compositeType, innerMap, yangToJmxMapping);

    return new UnionCompositeAttributeResolvingStrategy(innerMap, compositeType, yangToJmxMapping);
}
CompositeAttributeResolvingStrategy.java 文件源码 项目:hashsdn-controller 阅读 26 收藏 0 点赞 0 评论 0
CompositeAttributeResolvingStrategy(
        final Map<String, AttributeResolvingStrategy<?, ? extends OpenType<?>>> innerTypes,
        final CompositeType openType, final Map<String, String> yangToJavaAttrMapping) {
    super(openType);
    this.innerTypes = innerTypes;
    this.yangToJavaAttrMapping = yangToJavaAttrMapping;
}
OpenTypeConverter.java 文件源码 项目:monarch 阅读 23 收藏 0 点赞 0 评论 0
private static OpenTypeConverter makeTabularConverter(Type objType, boolean sortedMap,
    Type keyType, Type valueType) throws OpenDataException {

  final String objTypeName = objType.toString();
  final OpenTypeConverter keyConverter = toConverter(keyType);
  final OpenTypeConverter valueConverter = toConverter(valueType);
  final OpenType keyOpenType = keyConverter.getOpenType();
  final OpenType valueOpenType = valueConverter.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 TableConverter(objType, sortedMap, tabularType, keyConverter, valueConverter);
}
CompositeConverter.java 文件源码 项目:monarch 阅读 32 收藏 0 点赞 0 评论 0
CompositeConverter(Class targetClass, CompositeType compositeType, String[] itemNames,
    Method[] getters) throws OpenDataException {
  super(targetClass, compositeType, CompositeData.class);

  assert (itemNames.length == getters.length);

  this.itemNames = itemNames;
  this.getters = getters;
  this.getterConverters = new OpenTypeConverter[getters.length];
  for (int i = 0; i < getters.length; i++) {
    Type retType = getters[i].getGenericReturnType();
    getterConverters[i] = OpenTypeConverter.toConverter(retType);
  }
}
LogCenter.java 文件源码 项目:ChronoBike 阅读 19 收藏 0 点赞 0 评论 0
public CompositeType getStateType()
{
    CompositeTypeDesc compositeTypeDesc = new CompositeTypeDesc("LogCenterCompositeType", "LogCenterCompositeType Desc");
    compositeTypeDesc.addItem("Enable", "EnableDesc", SimpleType.BOOLEAN);
    compositeTypeDesc.addItem("Level", "LevelDesc", SimpleType.STRING);
    return compositeTypeDesc.generateCompositeType();
}
LogCenter.java 文件源码 项目:ChronoBike 阅读 18 收藏 0 点赞 0 评论 0
public CompositeData getState()
{
    CompositeType compositeType = getStateType();
    CompositeDataDesc compositeDataDesc = new CompositeDataDesc(compositeType);
    compositeDataDesc.setItemValue("Enable", getEnable());
    compositeDataDesc.setItemValue("Level", getLevel());
    return compositeDataDesc.generateCompositeData();
}


问题


面经


文章

微信
公众号

扫码关注公众号