return name.simpleName();
}
+ private String annotateReference(final String ref, final Type type, final String annotation) {
+ return type instanceof ParameterizedType ? getReferenceString(annotate(ref, annotation), type,
+ ((ParameterizedType) type).getActualTypeArguments())
+ : annotate(ref, annotation).toString();
+ }
+
+ final String getFullyQualifiedReference(final Type type, final String annotation) {
+ return annotateReference(type.getFullyQualifiedName(), type ,annotation);
+ }
+
final String getReferenceString(final Type type) {
final String ref = getReferenceString(type.getIdentifier());
return type instanceof ParameterizedType ? getReferenceString(new StringBuilder(ref), type,
// Package-private method, all callers who would be passing an empty array are bound to the more special
// case above, hence we know annotations.length >= 1
final String ref = getReferenceString(type.getIdentifier());
- return type instanceof ParameterizedType ? getReferenceString(annotate(ref, annotation), type,
- ((ParameterizedType) type).getActualTypeArguments())
- : annotate(ref, annotation).toString();
+ return annotateReference(ref, type, annotation);
}
private String getReferenceString(final StringBuilder sb, final Type type, final @NonNull Type[] arguments) {
«IF augmentable»
static <T$$ extends «type.fullyQualifiedName» & «AUGMENTATION_HOLDER.importedName»<?>> int «BINDING_HASHCODE_NAME»(final @«NONNULL.importedName» T$$ obj) {
«ELSE»
- static int «BINDING_HASHCODE_NAME»(final «type.fullyQualifiedName» obj) {
+ static int «BINDING_HASHCODE_NAME»(final «type.fullyQualifiedNonNull» obj) {
«ENDIF»
final int prime = 31;
int result = 1;
«IF augmentable»
static <T$$ extends «type.fullyQualifiedName» & «AUGMENTATION_HOLDER.importedName»<«type.fullyQualifiedName»>> boolean «BINDING_EQUALS_NAME»(final @«NONNULL.importedName» T$$ thisObj, final «Types.objectType().importedName» obj) {
«ELSE»
- static boolean «BINDING_EQUALS_NAME»(final «type.fullyQualifiedName» thisObj, final «Types.objectType().importedName» obj) {
+ static boolean «BINDING_EQUALS_NAME»(final «type.fullyQualifiedNonNull» thisObj, final «Types.objectType().importedName» obj) {
«ENDIF»
if (thisObj == obj) {
return true;
«IF augmentable»
static <T$$ extends «type.fullyQualifiedName» & «AUGMENTATION_HOLDER.importedName»<«type.fullyQualifiedName»>> «STRING.importedName» «BINDING_TO_STRING_NAME»(final @«NONNULL.importedName» T$$ obj) {
«ELSE»
- static «STRING.importedName» «BINDING_TO_STRING_NAME»(final «type.fullyQualifiedName» obj) {
+ static «STRING.importedName» «BINDING_TO_STRING_NAME»(final «type.fullyQualifiedNonNull» obj) {
«ENDIF»
final «MoreObjects.importedName».ToStringHelper helper = «MoreObjects.importedName».toStringHelper("«type.name»");
«FOR property : typeAnalysis.value»
return importedName(intype, importedName(NULLABLE));
}
+ final @NonNull String fullyQualifiedNonNull(final @NonNull Type intype) {
+ return fullyQualifiedName(intype, importedName(NONNULL));
+ }
+
+ final @NonNull String fullyQualifiedName(final @NonNull Type intype, final @NonNull String annotation) {
+ return javaType.getFullyQualifiedReference(intype, annotation);
+ }
+
// Exposed for BuilderTemplate
boolean isLocalInnerClass(final JavaTypeName name) {
final Optional<JavaTypeName> optEnc = name.immediatelyEnclosingClass();
+ " * @return Hash code value of data modeled by this interface.\n"
+ " * @throws NullPointerException if {@code obj} is null\n"
+ " */\n"
- + "static int bindingHashCode(final test.test obj) {\n"
+ + "static int bindingHashCode(final test.@NonNull test obj) {\n"
+ " final int prime = 31;\n"
+ " int result = 1;\n"
+ " result = prime * result + Objects.hashCode(obj.getTest());\n"
+ " * @return Hash code value of data modeled by this interface.\n"
+ " * @throws NullPointerException if {@code obj} is null\n"
+ " */\n"
- + "static int bindingHashCode(final test.test obj) {\n"
+ + "static int bindingHashCode(final test.@NonNull test obj) {\n"
+ " final int prime = 31;\n"
+ " int result = 1;\n"
+ " result = prime * result + Objects.hashCode(obj.getTest1());\n"
+ " * @return {@link String} value of data modeled by this interface.\n"
+ " * @throws NullPointerException if {@code obj} is null\n"
+ " */\n"
- + "static String bindingToString(final test.test obj) {\n"
+ + "static String bindingToString(final test.@NonNull test obj) {\n"
+ " final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(\"test\");\n"
+ " CodeHelpers.appendValue(helper, \"test\", obj.gettest());\n"
+ " return helper.toString();\n"
+ " * @return {@link String} value of data modeled by this interface.\n"
+ " * @throws NullPointerException if {@code obj} is null\n"
+ " */\n"
- + "static String bindingToString(final test.test obj) {\n"
+ + "static String bindingToString(final test.@NonNull test obj) {\n"
+ " final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(\"test\");\n"
+ " return helper.toString();\n"
+ "}\n", genToString(mockGenType(TEST)).toString());
+ " * @return {@link String} value of data modeled by this interface.\n"
+ " * @throws NullPointerException if {@code obj} is null\n"
+ " */\n"
- + "static String bindingToString(final test.test obj) {\n"
+ + "static String bindingToString(final test.@NonNull test obj) {\n"
+ " final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(\"test\");\n"
+ " CodeHelpers.appendValue(helper, \"test1\", obj.gettest1());\n"
+ " CodeHelpers.appendValue(helper, \"test2\", obj.gettest2());\n"