public Object copyTo(Object target, CopyBuilder copyBuilder) { final Keybase copy = ((target == null) ? ((Keybase) createCopy()) : ((Keybase) target)); super.copyTo(copy, copyBuilder); { Selector sourceSelector; sourceSelector = this.getSelector(); Selector copySelector = ((Selector) copyBuilder.copy(sourceSelector)); copy.setSelector(copySelector); } { List<Field> sourceField; sourceField = this.getField(); List<Field> copyField = ((List<Field>) copyBuilder.copy(sourceField)); copy.field = null; List<Field> uniqueFieldl = copy.getField(); uniqueFieldl.addAll(copyField); } { String sourceName; sourceName = this.getName(); String copyName = ((String) copyBuilder.copy(sourceName)); copy.setName(copyName); } return copy; }
public void equals(Object object, EqualsBuilder equalsBuilder) { if (!(object instanceof Keybase)) { equalsBuilder.appendSuper(false); return; } if (this == object) { return; } super.equals(object, equalsBuilder); final Keybase that = ((Keybase) object); equalsBuilder.append(this.getSelector(), that.getSelector()); equalsBuilder.append(this.getField(), that.getField()); equalsBuilder.append(this.getName(), that.getName()); }
public StringBuilder appendFields( ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { super.appendFields(locator, buffer, strategy); { LocalSimpleType theSimpleType; theSimpleType = this.getSimpleType(); strategy.appendField(locator, this, "simpleType", buffer, theSimpleType); } { QName theItemType; theItemType = this.getItemType(); strategy.appendField(locator, this, "itemType", buffer, theItemType); } return buffer; }
public void toString(ToStringBuilder toStringBuilder) { super.toString(toStringBuilder); { Selector theSelector; theSelector = this.getSelector(); toStringBuilder.append("selector", theSelector); } { List<Field> theField; theField = this.getField(); toStringBuilder.append("field", theField); } { String theName; theName = this.getName(); toStringBuilder.append("name", theName); } }
private Annotated annotate(Annotated node, RuleNode ruleNode) { Node children = visitChildren(ruleNode); List<Annotation> list = new LinkedList<>(); if (children instanceof Annotation) { list = new LinkedList<>(); list.add((Annotation) children); } if (children instanceof NodeList) { list = ((NodeList) children) .stream() .filter(child -> child instanceof Annotation) .map((Node child) -> (Annotation) child) .collect(Collectors.toList()); } node.setAnnotations(list); return node; }
@SuppressWarnings("rawtypes") private String getHashes(Annotated output, List<Annotated> inputs, Object instance) throws NoSuchFieldException, IllegalAccessException, NoSuchAlgorithmException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException { LinkedList<String> hashes = new LinkedList<String>(); hashes.addAll(HashUtils.hashAll(getProject().file(output.getValue(instance)))); for (Annotated input : inputs) { AnnotatedElement m = input.getElement(); Object val = input.getValue(instance); if (val == null && m.isAnnotationPresent(Optional.class)) { hashes.add("null"); } else if (m.isAnnotationPresent(InputFile.class)) { hashes.add(HashUtils.hash(getProject().file(input.getValue(instance)))); getLogger() .info( HashUtils.hash(getProject().file(input.getValue(instance))) + " " + input.getValue(instance)); } else if (m.isAnnotationPresent(InputDirectory.class)) { File dir = (File) input.getValue(instance); hashes.addAll(HashUtils.hashAll(dir)); } else if (m.isAnnotationPresent(InputFiles.class)) { FileCollection files = getProject().files(input.getValue(instance)); for (File file : files.getFiles()) { String hash = HashUtils.hash(file); hashes.add(hash); getLogger().info(hash + " " + input.getValue(instance)); } } else // just @Input { Object obj = input.getValue(instance); while (obj instanceof Closure) { obj = ((Closure) obj).call(); } if (obj instanceof String) { hashes.add(HashUtils.hash((String) obj)); getLogger().info(HashUtils.hash((String) obj) + " " + (String) obj); } else if (obj instanceof File) { File file = (File) obj; if (file.isDirectory()) { List<File> files = Arrays.asList(file.listFiles()); Collections.sort(files); for (File i : files) { hashes.add(HashUtils.hash(i)); getLogger().info(HashUtils.hash(i) + " " + i); } } else { hashes.add(HashUtils.hash(file)); getLogger().info(HashUtils.hash(file) + " " + file); } } else { hashes.add(obj.toString()); } } } return Joiner.on(Constants.NEWLINE()).join(hashes); }
public void hashCode(HashCodeBuilder hashCodeBuilder) { super.hashCode(hashCodeBuilder); hashCodeBuilder.append(this.getSelector()); hashCodeBuilder.append(this.getField()); hashCodeBuilder.append(this.getName()); }