Package com.opengamma.engine.target

Examples of com.opengamma.engine.target.ComputationTargetType


   * @param type the declared type to reduce the target to, not null
   * @param target the target to reduce, not null
   * @return the reduced target, or null if the reduction is not possible
   */
  public static ComputationTarget adjustTarget(final ComputationTargetType type, final ComputationTarget target) {
    final ComputationTargetType adjusted = type.accept(s_getAdjustedTargetType, target);
    if (adjusted == null) {
      // Not compatible
      return null;
    } else if (adjusted == ComputationTargetType.NULL) {
      // Exact match
View Full Code Here


   * @param adjustmentCache a cache of targets already adjusted to certain types, not null
   * @param target the target to reduce, not null
   * @return the reduced target, or null if the target is not compatible with the rule
   */
  public ComputationTarget adjustTarget(final Map<ComputationTargetType, ComputationTarget> adjustmentCache, final ComputationTarget target) {
    final ComputationTargetType type = getParameterizedFunction().getFunction().getTargetType();
    if (ComputationTargetType.NULL.equals(type)) {
      // We use NULL to mark failure in the cache, and NULL will never need adjusting
      return target;
    }
    ComputationTarget adjusted = adjustmentCache.get(type);
View Full Code Here

   */
  private static final String TYPE_FIELD_NAME = "computationTargetType";

  @SuppressWarnings("unchecked")
  public static ComputationTargetType fromString(final String str) {
    final ComputationTargetType common = CommonByName.get(str);
    if (common != null) {
      return common;
    } else {
      try {
        return ComputationTargetType.of((Class) ClassUtils.loadClass(str));
View Full Code Here

  @SuppressWarnings({"rawtypes", "unchecked" })
  private static ComputationTargetType decodeAlternativeType(final ComputationTargetType current, final FudgeField field) throws Exception {
    if (field.getValue() instanceof String) {
      final String name = (String) field.getValue();
      final ComputationTargetType common = CommonByName.get(name);
      if (common != null) {
        if (current == null) {
          return common;
        } else {
          return current.or(common);
        }
      } else {
        final Class clazz = ClassUtils.loadClass(name);
        if (current == null) {
          return ComputationTargetType.of(clazz);
        } else {
          return current.or(clazz);
        }
      }
    } else if (field.getValue() instanceof FudgeMsg) {
      ComputationTargetType type = null;
      for (final FudgeField field2 : (FudgeMsg) field.getValue()) {
        type = decodeNestedType(type, field2);
      }
      if (type != null) {
        if (current == null) {
View Full Code Here

  @SuppressWarnings({"rawtypes", "unchecked" })
  private static ComputationTargetType decodeNestedType(final ComputationTargetType outer, final FudgeField field) throws Exception {
    if (field.getValue() instanceof String) {
      final String name = (String) field.getValue();
      final ComputationTargetType common = CommonByName.get(name);
      if (common != null) {
        if (outer == null) {
          return common;
        } else {
          return outer.containing(common);
        }
      } else {
        final Class clazz = ClassUtils.loadClass(name);
        if (outer == null) {
          return ComputationTargetType.of(clazz);
        } else {
          return outer.containing(clazz);
        }
      }
    } else if (field.getValue() instanceof FudgeMsg) {
      ComputationTargetType type = null;
      for (final FudgeField field2 : (FudgeMsg) field.getValue()) {
        type = decodeAlternativeType(type, field2);
      }
      if (type != null) {
        if (outer == null) {
View Full Code Here

    }
  }

  public static ComputationTargetType buildObjectImpl(final FudgeMsg msg) {
    try {
      ComputationTargetType result = null;
      for (final FudgeField field : msg) {
        if (TYPE_FIELD_NAME.equals(field.getName())) {
          result = decodeNestedType(result, field);
        }
      }
View Full Code Here

   * @param versionCorrection the version/correction timestamp to use for the resolution, not null
   * @return the resolved target, null if not found
   */
  @Override
  public ComputationTarget resolve(final ComputationTargetSpecification specification, final VersionCorrection versionCorrection) {
    final ComputationTargetType type = specification.getType();
    if (ComputationTargetType.NULL == type) {
      return ComputationTarget.NULL;
    } else {
      final ObjectResolver<?> resolver = _resolvers.get(type);
      if (resolver != null) {
View Full Code Here

    }
  }

  @Override
  public ObjectResolver<?> getResolver(final ComputationTargetSpecification specification) {
    final ComputationTargetType type = specification.getType();
    if (ComputationTargetType.NULL == type) {
      return (ObjectResolver<?>) ComputationTargetType.NULL;
    } else {
      return _resolvers.get(type);
    }
View Full Code Here

      };

  @Override
  public ComputationTargetType simplifyType(final ComputationTargetType type) {
    final ComputationTargetType newType = type.accept(s_simplifyType, _baseTypes);
    if (newType != null) {
      return newType;
    } else {
      return type;
    }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.target.ComputationTargetType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.