public Object getFieldValue(_Fields field) { switch (field) { case PATH: return getPath(); case TYPE: return getType(); case CONTENT: return getContent(); } throw new IllegalStateException(); }
public Change deepCopy() { return new Change(this); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case PATH: if (value == null) { unsetPath(); } else { setPath((String)value); } break; case TYPE: if (value == null) { unsetType(); } else { setType((ChangeType)value); } break; case CONTENT: if (value == null) { unsetContent(); } else { setContent((String)value); } break; } }
/** * Performs a deep copy on <i>other</i>. */ public Change(Change other) { if (other.isSetPath()) { this.path = other.path; } if (other.isSetType()) { this.type = other.type; } if (other.isSetContent()) { this.content = other.content; } }
@Override protected Change doForward(com.linecorp.centraldogma.common.Change<?> value) { final Change change = new Change(value.path(), convertChangeType(value.type())); switch (change.getType()) { case UPSERT_JSON: case APPLY_JSON_PATCH: try { change.setContent(Jackson.writeValueAsString(value.content())); } catch (JsonProcessingException e) { throw new ChangeFormatException("failed to read a JSON tree", e); } break; case UPSERT_TEXT: case APPLY_TEXT_PATCH: case RENAME: change.setContent((String) value.content()); break; case REMOVE: break; } return change; }
client.createRepository(projectName, repo1); client.push(projectName, repo1, head, author, "", new Comment("comment"), ImmutableList.of(new Change("/sample.txt", ChangeType.UPSERT_TEXT).setContent("test")));
public void write(org.apache.thrift.protocol.TProtocol oprot, Change struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.path != null) { oprot.writeFieldBegin(PATH_FIELD_DESC); oprot.writeString(struct.path); oprot.writeFieldEnd(); } if (struct.type != null) { oprot.writeFieldBegin(TYPE_FIELD_DESC); oprot.writeI32(struct.type.getValue()); oprot.writeFieldEnd(); } if (struct.content != null) { if (struct.isSetContent()) { oprot.writeFieldBegin(CONTENT_FIELD_DESC); oprot.writeString(struct.content); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
if (isSetContent()) { if (!first) sb.append(", "); sb.append("content:");
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Change) return this.equals((Change)that); return false; }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
/** * Performs a deep copy on <i>other</i>. */ public Change(Change other) { if (other.isSetPath()) { this.path = other.path; } if (other.isSetType()) { this.type = other.type; } if (other.isSetContent()) { this.content = other.content; } }
@Override protected Change doForward(com.linecorp.centraldogma.common.Change<?> value) { final Change change = new Change(value.path(), convertChangeType(value.type())); switch (change.getType()) { case UPSERT_JSON: case APPLY_JSON_PATCH: try { change.setContent(Jackson.writeValueAsString(value.content())); } catch (JsonProcessingException e) { throw new ChangeFormatException("failed to read a JSON tree", e); } break; case UPSERT_TEXT: case APPLY_TEXT_PATCH: case RENAME: change.setContent((String) value.content()); break; case REMOVE: break; } return change; }
public void write(org.apache.thrift.protocol.TProtocol oprot, Change struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.path != null) { oprot.writeFieldBegin(PATH_FIELD_DESC); oprot.writeString(struct.path); oprot.writeFieldEnd(); } if (struct.type != null) { oprot.writeFieldBegin(TYPE_FIELD_DESC); oprot.writeI32(struct.type.getValue()); oprot.writeFieldEnd(); } if (struct.content != null) { if (struct.isSetContent()) { oprot.writeFieldBegin(CONTENT_FIELD_DESC); oprot.writeString(struct.content); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
if (isSetContent()) { if (!first) sb.append(", "); sb.append("content:");
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Change) return this.equals((Change)that); return false; }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
public Object getFieldValue(_Fields field) { switch (field) { case PATH: return getPath(); case TYPE: return getType(); case CONTENT: return getContent(); } throw new IllegalStateException(); }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case PATH: return isSetPath(); case TYPE: return isSetType(); case CONTENT: return isSetContent(); } throw new IllegalStateException(); }