Package com.ancientprogramming.fixedformat4j.exception

Examples of com.ancientprogramming.fixedformat4j.exception.FixedFormatException


    return result;
  }

  public static void assertIsPatternRequired(FormatInstructions formatInstructions, FormatContext context, FixedFormatter formatter) {
    if (formatter.requiresPattern() && formatInstructions.getFixedFormatPatternData() == null) {
      throw new FixedFormatException(FixedFormatPattern.class.getName() + " annotation is required for datatype[" + context.getDataType().getName() + "].");
    }
  }
View Full Code Here


    }
  }

  public static void assertIsBooleanRequired(FormatInstructions formatInstructions, FormatContext context, FixedFormatter formatter) {
    if (formatter.requiresBoolean() && formatInstructions.getFixedFormatBooleanData() == null) {
      throw new FixedFormatException(FixedFormatBoolean.class.getName() + " annotation is required for datatype[" + context.getDataType().getName() + "].");
    }
  }
View Full Code Here

    }
  }

  public static void assertIsDecimalRequired(FormatInstructions formatInstructions, FormatContext context, FixedFormatter formatter) {
    if (formatter.requiresDecimal() && formatInstructions.getFixedFormatDecimalData() == null) {
      throw new FixedFormatException(FixedFormatDecimal.class.getName() + " annotation is required for datatype[" + context.getDataType().getName() + "].");
    }
  }
View Full Code Here

    if (formatterClass != null) {
      try {
        return formatterClass.getConstructor().newInstance();
      } catch (NoSuchMethodException e) {
        throw new FixedFormatException("Could not create instance of[" + formatterClass.getName() + "] because no default constructor exists");
      } catch (Exception e) {
        throw new FixedFormatException("Could not create instance of[" + formatterClass.getName() + "]", e);
      }
    } else {
      throw new FixedFormatException(ByTypeFormatter.class.getName() + " cannot handle datatype[" + dataType.getName() + "]. Provide your own custom FixedFormatter for this datatype.");
    }
  }
View Full Code Here

  public Object asObject(String string, FormatInstructions instructions) throws FixedFormatException {
    try {
      return getFormatter(instructions.getFixedFormatPatternData().getPattern()).parse(string);
    } catch (ParseException e) {
      throw new FixedFormatException("Could not parse value[" + string + "] by pattern[" + instructions.getFixedFormatPatternData().getPattern() + "] to " + Date.class.getName());
    }
  }
View Full Code Here

TOP

Related Classes of com.ancientprogramming.fixedformat4j.exception.FixedFormatException

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.