Package org.molgenis.fieldtypes

Examples of org.molgenis.fieldtypes.FieldType


  public static FieldType getType(String name)
  {
    init();

    FieldType fieldType = types.get(name + "field");
    if (fieldType != null)
    {
      try
      {
        return fieldType.getClass().newInstance();
      }
      catch (InstantiationException e)
      {
        throw new RuntimeException(e);
      }
View Full Code Here


  public static FieldType get(Field f) throws MolgenisModelException
  {
    init();
    try
    {
      final FieldType ft = f.getType().getClass().newInstance();
      ft.setField(f);
      return ft;
    }
    catch (InstantiationException e)
    {
      logger.error(e);
View Full Code Here

public class FieldTest
{
  @Test
  public void testGetFormatString()
  {
    FieldType fieldType = when(mock(FieldType.class).getFormatString()).thenReturn("%d%s").getMock();
    Field field = new Field(mock(Entity.class), "field", fieldType);
    assertEquals(field.getFormatString(), "%d%s");
  }
View Full Code Here

    List<Field> categoricalFields = new ArrayList<Field>();

    // write variable definitions
    for (Field field : columns)
    {
      FieldType fieldType = field.getType();
      if (fieldType.getEnumType() == FieldTypeEnum.CATEGORICAL)
      {
        categoricalFields.add(field);
      }
      colNames.write(String.format("%s %s ", field.getName(), colTypeToSPSSType(fieldType.getEnumType())));
    }

    // add category labels to variables if appropriate
    for (Field field : categoricalFields)
    {
View Full Code Here

    return e.getXrefEntity().getField(e.getXrefFieldName());
  }

  public FieldType getFieldType(Model model, Field field) throws Exception
  {
    FieldType type = field.getType();
    if (type instanceof XrefField || type instanceof MrefField)
    {
      // Entity e_ref = field.getXrefEntity();
      Field f_ref = field.getXrefField();
      return getFieldType(model, f_ref);
View Full Code Here

TOP

Related Classes of org.molgenis.fieldtypes.FieldType

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.