congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DataModelReflection.getValue
Code IndexAdd Tabnine to your IDE (free)

How to use
getValue
method
in
com.asakusafw.testdriver.core.DataModelReflection

Best Java code snippets using com.asakusafw.testdriver.core.DataModelReflection.getValue (Showing top 9 results out of 315)

origin: asakusafw/asakusafw

  public Object getValue(PropertyName name) {
    assert name != null;
    return model.getValue(name);
  }
}
origin: asakusafw/asakusafw

@Override
public Map<PropertyName, Object> getKey(DataModelReflection target) {
  Map<PropertyName, Object> results = new LinkedHashMap<>();
  for (PropertyName name : keys) {
    results.put(name, target.getValue(name));
  }
  return results;
}
origin: asakusafw/asakusafw

  @Override
  public T toObject(DataModelReflection reflection) {
    try {
      T instance = modelClass.newInstance();
      for (Map.Entry<PropertyName, Field> entry : fields.entrySet()) {
        PropertyName name = entry.getKey();
        Field field = entry.getValue();
        Object value = reflection.getValue(name);
        try {
          field.set(instance, value);
        } catch (IllegalAccessException e) {
          throw new AssertionError(e);
        }
      }
      return instance;
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
}
origin: asakusafw/asakusafw

@Override
public T toObject(DataModelReflection reflection) {
  try {
    T instance = modelClass.newInstance();
    for (Map.Entry<PropertyName, Method> entry : accessors.entrySet()) {
      PropertyName property = entry.getKey();
      Method accessor = entry.getValue();
      Object value = reflection.getValue(property);
      set(instance, accessor, value);
    }
    return instance;
  } catch (Exception e) {
    throw new AssertionError(e);
  }
}
origin: asakusafw/asakusafw

@SuppressWarnings("unchecked")
private static <T> Comparator<DataModelReflection> toComparator(DataModelDefinition<T> definition, String term) {
  if (term.isEmpty()) {
    throw new IllegalArgumentException("order term must not be empty"); //$NON-NLS-1$
  }
  Ordering order = parseOrder(term);
  checkProperty(definition, order.propertyName);
  Comparator<DataModelReflection> comparator = (a, b) -> {
    Comparable<Object> aValue = (Comparable<Object>) a.getValue(order.propertyName);
    Comparable<Object> bValue = (Comparable<Object>) b.getValue(order.propertyName);
    if (aValue == null) {
      if (bValue == null) {
        return 0;
      } else {
        return -1;
      }
    } else if (bValue == null) {
      return +1;
    }
    return aValue.compareTo(bValue);
  };
  if (order.direction == Direction.ASCENDANT) {
    return comparator;
  } else {
    return comparator.reversed();
  }
}
origin: asakusafw/asakusafw

private Map<List<Object>, List<DataModelReflection>> asRefMap() {
  Map<List<Object>, List<DataModelReflection>> results = new LinkedHashMap<>();
  try (DataModelSource source = factory.createSource(definition, context)) {
    while (true) {
      DataModelReflection ref = source.next();
      if (ref == null) {
        break;
      }
      List<Object> key = new ArrayList<>(grouping.size());
      for (PropertyName name : grouping) {
        Object value = ref.getValue(name);
        key.add(value);
      }
      results.computeIfAbsent(key, k -> new ArrayList<>()).add(ref);
    }
  } catch (IOException e) {
    throw new IllegalStateException(e);
  }
  if (refComparator != null) {
    for (List<DataModelReflection> refs : results.values()) {
      refs.sort(refComparator);
    }
  }
  return results;
}
origin: asakusafw/asakusafw

private Object describeProperty(DataModelReflection object, PropertyName property) {
  assert property != null;
  if (object == null) {
    return null;
  }
  Object value = object.getValue(property);
  if (value == null) {
    return null;
  }
  PropertyType type = definition.getType(property);
  switch (type) {
  case DATE:
    return dateFormat.format(((Calendar) value).getTime());
  case TIME:
    return timeFormat.format(((Calendar) value).getTime());
  case DATETIME:
    return datetimeFormat.format(((Calendar) value).getTime());
  case DECIMAL:
    return String.format(
        "%s(scale=%d)", //$NON-NLS-1$
        ((BigDecimal) value).toPlainString(),
        ((BigDecimal) value).scale());
  case STRING:
    return toStringLiteral((String) value);
  default:
    return value;
  }
}
origin: asakusafw/asakusafw

  private Object checkProperties(DataModelReflection expected, DataModelReflection actual) {
    List<String> differences = new ArrayList<>(1);
    for (PropertyCondition<?> condition : propertyConditions) {
      Object e = expected.getValue(condition.getPropertyName());
      Object a = actual.getValue(condition.getPropertyName());
      if (condition.accepts(e, a) == false) {
        differences.add(MessageFormat.format(
            Messages.getString("VerifyRuleInterpretor.messageWrongProperty"), //$NON-NLS-1$
            condition.getPropertyName(),
            Util.format(a),
            condition.describeExpected(e, a)));
      }
    }
    return differences.isEmpty() ? null : differences;
  }
}
origin: asakusafw/asakusafw

Object p1 = r1.getValue(name);
Object p2 = r2.getValue(name);
if (p1 == null && p2 != null) {
  return -1;
com.asakusafw.testdriver.coreDataModelReflectiongetValue

Javadoc

Returns the property value. This can returns one of the following type:
  • wrapper types of any primitive types,
  • java.lang.String,
  • java.math.BigInteger,
  • java.math.BigDecimal,
  • java.util.Calendar,
  • DataModelReflection,
  • or java.lang.Object (means "variant").
Each value must be an instance of the corresponded DataModelDefinition#getType(PropertyName) property type.

Popular methods of DataModelReflection

  • <init>
    Creates a new instance.
  • normalize
  • toStringLiteral
  • toStringRepresentation
    Returns formatted string representation of values.

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • findViewById (Activity)
  • getSharedPreferences (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JFrame (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now