Package com.ancientprogramming.fixedformat4j.format

Examples of com.ancientprogramming.fixedformat4j.format.FixedFormatter


    this.context = context;
  }


  public Object parse(String value, FormatInstructions instructions) {
    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.parse(value, instructions);
  }
View Full Code Here


    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.parse(value, instructions);
  }

  public String format(Object value, FormatInstructions instructions) {
    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.format(value, instructions);
  }
View Full Code Here

  private Object readDataAccordingFieldAnnotation(String data, Method method, Field fieldAnno) {
    Class datatype = getDatatype(method, fieldAnno);

    FormatContext context = getFormatContext(datatype, fieldAnno);
    FixedFormatter formatter = getFixedFormatterInstance(context.getFormatter(), context);
    FormatInstructions formatdata = getFormatInstructions(method, fieldAnno);

    Object loadedData = formatter.parse(fetchData(data, formatdata, context), formatdata);
    if (LOG.isDebugEnabled()) {
      LOG.debug("the loaded data[" + loadedData + "]");
    }
    return loadedData;
  }
View Full Code Here

  private <T> String exportDataAccordingFieldAnnotation(T fixedFormatRecord, Method method, Field fieldAnno) {
    String result;
    Class datatype = getDatatype(method, fieldAnno);

    FormatContext context = getFormatContext(datatype, fieldAnno);
    FixedFormatter formatter = getFixedFormatterInstance(context.getFormatter(), context);
    FormatInstructions formatdata = getFormatInstructions(method, fieldAnno);
    Object valueObject;
    try {
      valueObject = method.invoke(fixedFormatRecord);
    } catch (Exception e) {
      throw new FixedFormatException(format("could not invoke method %s.%s(%s)", fixedFormatRecord.getClass().getName(), method.getName(), datatype), e);
    }
    result = formatter.format(valueObject, formatdata);
    if (LOG.isDebugEnabled()) {
      LOG.debug(format("exported %s ", result));
    }
    return result;
  }
View Full Code Here

    this.context = context;
  }


  public Object parse(String value, FormatInstructions instructions) {
    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.parse(value, instructions);
  }
View Full Code Here

    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.parse(value, instructions);
  }

  public String format(Object value, FormatInstructions instructions) {
    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.format(value, instructions);
  }
View Full Code Here

  private Object readDataAccordingFieldAnnotation(String data, Method method, Field fieldAnno) {
    Class datatype = getDatatype(method, fieldAnno);

    FormatContext context = getFormatContext(datatype, fieldAnno);
    FixedFormatter formatter = getFixedFormatterInstance(context.getFormatter(), context);
    FormatInstructions formatdata = getFormatInstructions(method, fieldAnno);

    Object loadedData = formatter.parse(fetchData(data, formatdata, context), formatdata);
    if (LOG.isDebugEnabled()) {
      LOG.debug("the loaded data[" + loadedData + "]");
    }
    return loadedData;
  }
View Full Code Here

  private <T> String exportDataAccordingFieldAnnotation(T fixedFormatRecord, Method method, Field fieldAnno) {
    String result;
    Class datatype = getDatatype(method, fieldAnno);

    FormatContext context = getFormatContext(datatype, fieldAnno);
    FixedFormatter formatter = getFixedFormatterInstance(context.getFormatter(), context);
    FormatInstructions formatdata = getFormatInstructions(method, fieldAnno);
    Object valueObject;
    try {
      valueObject = method.invoke(fixedFormatRecord);
    } catch (Exception e) {
      throw new FixedFormatException(format("could not invoke method %s.%s(%s)", fixedFormatRecord.getClass().getName(), method.getName(), datatype), e);
    }
    result = formatter.format(valueObject, formatdata);
    if (LOG.isDebugEnabled()) {
      LOG.debug(format("exported %s ", result));
    }
    return result;
  }
View Full Code Here

    this.context = context;
  }


  public Object parse(String value, FormatInstructions instructions) {
    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.parse(value, instructions);
  }
View Full Code Here

    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.parse(value, instructions);
  }

  public String format(Object value, FormatInstructions instructions) {
    FixedFormatter formatter = actualFormatter(context.getDataType());
    return formatter.format(value, instructions);
  }
View Full Code Here

TOP

Related Classes of com.ancientprogramming.fixedformat4j.format.FixedFormatter

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.