public Entry deepCopy() { return new Entry(this); }
public Object getFieldValue(_Fields field) { switch (field) { case PATH: return getPath(); case TYPE: return getType(); case CONTENT: return getContent(); } throw new IllegalStateException(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Entry) return this.equals((Entry)that); return false; }
/** * Performs a deep copy on <i>other</i>. */ public Entry(Entry other) { if (other.isSetPath()) { this.path = other.path; } if (other.isSetType()) { this.type = other.type; } if (other.isSetContent()) { this.content = other.content; } }
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((EntryType)value); } break; case CONTENT: if (value == null) { unsetContent(); } else { setContent((String)value); } break; } }
public static Entry convert(com.linecorp.centraldogma.common.Entry<?> entry) { final Entry file = new Entry(entry.path(), convertEntryType(entry.type())); switch (entry.type()) { case JSON: // FIXME(trustin): Inefficiency try { file.setContent(Jackson.writeValueAsString(entry.content())); } catch (JsonProcessingException e) { throw new UncheckedIOException(e); } break; case TEXT: file.setContent((String) entry.content()); break; case DIRECTORY: break; default: throw new IllegalArgumentException("unsupported entry type: " + entry.type()); } return file; }
@Override public CompletableFuture<Map<String, EntryType>> listFiles(String projectName, String repositoryName, Revision revision, String pathPattern) { final CompletableFuture<List<com.linecorp.centraldogma.internal.thrift.Entry>> future = run(callback -> client.listFiles(projectName, repositoryName, RevisionConverter.TO_DATA.convert(revision), pathPattern, callback)); return future.thenApply(list -> list.stream().collect(toImmutableMap( com.linecorp.centraldogma.internal.thrift.Entry::getPath, e -> EntryConverter.convertEntryType(e.getType())))); }
public void write(org.apache.thrift.protocol.TProtocol oprot, Entry 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:");
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 Entry(Entry other) { if (other.isSetPath()) { this.path = other.path; } if (other.isSetType()) { this.type = other.type; } if (other.isSetContent()) { this.content = other.content; } }
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((EntryType)value); } break; case CONTENT: if (value == null) { unsetContent(); } else { setContent((String)value); } break; } }
public static Entry convert(com.linecorp.centraldogma.common.Entry<?> entry) { final Entry file = new Entry(entry.path(), convertEntryType(entry.type())); switch (entry.type()) { case JSON: // FIXME(trustin): Inefficiency try { file.setContent(Jackson.writeValueAsString(entry.content())); } catch (JsonProcessingException e) { throw new UncheckedIOException(e); } break; case TEXT: file.setContent((String) entry.content()); break; case DIRECTORY: break; default: throw new IllegalArgumentException("unsupported entry type: " + entry.type()); } return file; }
@Override public CompletableFuture<Map<String, EntryType>> listFiles(String projectName, String repositoryName, Revision revision, String pathPattern) { final CompletableFuture<List<com.linecorp.centraldogma.internal.thrift.Entry>> future = run(callback -> client.listFiles(projectName, repositoryName, RevisionConverter.TO_DATA.convert(revision), pathPattern, callback)); return future.thenApply(list -> list.stream().collect(toImmutableMap( com.linecorp.centraldogma.internal.thrift.Entry::getPath, e -> EntryConverter.convertEntryType(e.getType())))); }
public void write(org.apache.thrift.protocol.TProtocol oprot, Entry 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:");
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); } }
/** 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(); }
public Object getFieldValue(_Fields field) { switch (field) { case PATH: return getPath(); case TYPE: return getType(); case CONTENT: return getContent(); } throw new IllegalStateException(); }
public Entry deepCopy() { return new Entry(this); }