/** * Adds a field to the list of field members of this JDefinedClass. * * @param mods * Modifiers for this field. * @param type * JType of this field. * @param name * Name of this field. * @param init * Initial value of this field. * * @return Newly generated field */ public JFieldVar field( int mods, JType type, String name, JExpression init) { JFieldVar f = new JFieldVar(this,JMods.forField(mods), type, name, init); if(fields.put(name, f)!=null) throw new IllegalArgumentException("trying to create the same field twice: "+name); return f; }
/** * Adds a field to the list of field members of this JDefinedClass. * * @param mods * Modifiers for this field. * @param type * JType of this field. * @param name * Name of this field. * @param init * Initial value of this field. * * @return Newly generated field */ public JFieldVar field( int mods, JType type, String name, JExpression init) { JFieldVar f = new JFieldVar(this,JMods.forField(mods), type, name, init); if (fields.containsKey(name)) { throw new IllegalArgumentException("trying to create the same field twice: "+name); } fields.put(name, f); return f; }
/** * Adds a field to the list of field members of this JDefinedClass. * * @param mods * Modifiers for this field. * @param type * JType of this field. * @param name * Name of this field. * @param init * Initial value of this field. * * @return Newly generated field */ public JFieldVar field( int mods, JType type, String name, JExpression init) { JFieldVar f = new JFieldVar(this,JMods.forField(mods), type, name, init); if (fields.containsKey(name)) { throw new IllegalArgumentException("trying to create the same field twice: "+name); } fields.put(name, f); return f; }
/** * Adds a field to the list of field members of this JDefinedClass. * * @param mods * Modifiers for this field. * @param type * JType of this field. * @param name * Name of this field. * @param init * Initial value of this field. * * @return Newly generated field */ public JFieldVar field( int mods, JType type, String name, JExpression init) { JFieldVar f = new JFieldVar(this,JMods.forField(mods), type, name, init); if (fields.containsKey(name)) { throw new IllegalArgumentException("trying to create the same field twice: "+name); } fields.put(name, f); return f; }
/** * Adds a field to the list of field members of this JDefinedClass. * * @param mods * Modifiers for this field. * @param type * JType of this field. * @param name * Name of this field. * @param init * Initial value of this field. * * @return Newly generated field */ public JFieldVar field( int mods, JType type, String name, JExpression init) { JFieldVar f = new JFieldVar(this,JMods.forField(mods), type, name, init); if (fields.containsKey(name)) { throw new IllegalArgumentException("trying to create the same field twice: "+name); } fields.put(name, f); return f; }