public ControlField createField ( final String value ) { return createField ( value, null ); }
protected static void validateName ( final String name ) throws InvalidValueException { validateNonEmpty ( "Name", name ); for ( int i = 0; i < name.length (); i++ ) { validateFieldChar ( name.charAt ( i ), name ); } }
public ControlFieldDefinition ( final String name, final FieldType type, final Pattern pattern ) { validateName ( name ); this.name = name; this.type = type; this.pattern = pattern; this.id = name.toUpperCase (); }
public void write ( final Writer writer ) throws IOException { final String name = this.definition.getName (); final FieldType type = this.definition.getType (); writer.write ( name ); writer.write ( ": " ); switch ( type ) { case SIMPLE: writeSimpleValue ( writer ); break; case FOLDED: writeFoldedValue ( writer ); break; case MULTILINE: writeMultiLineValue ( writer ); break; } }
private static void hasField ( final GenericControlFile controlFile, final ControlFieldDefinition definition ) { final ControlField result = controlFile.get ( definition ); if ( result == null ) { throw new IllegalStateException ( String.format ( "Control file must have field '%s'", definition.getName () ) ); } }
public ControlField createField ( final String value, final String firstLine ) { validateValue ( value ); return new ControlField ( this, value, firstLine ); }
public void write ( final Writer writer ) throws IOException { final String name = this.definition.getName (); final FieldType type = this.definition.getType (); writer.write ( name ); writer.write ( ": " ); switch ( type ) { case SIMPLE: writeSimpleValue ( writer ); break; case FOLDED: writeFoldedValue ( writer ); break; case MULTILINE: writeMultiLineValue ( writer ); break; } }
private static void hasField ( final GenericControlFile controlFile, final ControlFieldDefinition definition ) { final ControlField result = controlFile.get ( definition ); if ( result == null ) { throw new IllegalStateException ( String.format ( "Control file must have field '%s'", definition.getName () ) ); } }
public ControlField createField ( final String value, final String firstLine ) { validateValue ( value ); return new ControlField ( this, value, firstLine ); }
public ControlField createField ( final String value ) { return createField ( value, null ); }
protected static void validateName ( final String name ) throws InvalidValueException { validateNonEmpty ( "Name", name ); for ( int i = 0; i < name.length (); i++ ) { validateFieldChar ( name.charAt ( i ), name ); } }
public ControlFieldDefinition ( final String name, final FieldType type, final Pattern pattern ) { validateName ( name ); this.name = name; this.type = type; this.pattern = pattern; this.id = name.toUpperCase (); }
public void set ( final ControlFieldDefinition definition, final String value ) { this.fields.put ( definition, definition.createField ( value ) ); }
public void set ( final ControlFieldDefinition definition, final String value ) { this.fields.put ( definition, definition.createField ( value ) ); }
public void setVersion ( final String value ) { set ( Fields.VERSION.createField ( value ) ); }
public void setPackage ( final String value ) { set ( Fields.PACKAGE.createField ( value ) ); }
public void setPriority ( final String value ) { set ( Fields.PRIORITY.createField ( value ) ); }
public void setArchitecture ( final String value ) { set ( Fields.ARCHITECTURE.createField ( value ) ); }
public void setVersion ( final String value ) { set ( Fields.VERSION.createField ( value ) ); }
public void setPriority ( final String value ) { set ( Fields.PRIORITY.createField ( value ) ); }