Package com.mcawful.social
Record Class SocialPostResult
java.lang.Object
java.lang.Record
com.mcawful.social.SocialPostResult
- Record Components:
success-trueif it workedurl- the web address of the new post, or of the profile after linking;nullon failureerror- on failure, the reason:NOT_LINKED,EMPTY,TOO_LONGorFAILEDdetail- on failure, more information, such as the length of a post that is too long (320/300) or the message from the platform
public record SocialPostResult(boolean success, String url, String error, String detail)
extends Record
The result of creating a post or linking an account on a
SocialPlatform- Author:
- mcawful
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe text is emptystatic final StringThe platform refused the request or could not be reachedstatic final StringNo account is linked, or signing in failedstatic final StringThe text is too long; the detail islength/maximum, followed bybyteswhen a byte limit was exceeded -
Constructor Summary
ConstructorsConstructorDescriptionSocialPostResult(boolean success, String url, String error, String detail) Creates an instance of aSocialPostResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondetail()Returns the value of thedetailrecord component.final booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.static SocialPostResultCreates a failed resultfinal inthashCode()Returns a hash code value for this object.static SocialPostResultCreates a successful resultbooleansuccess()Returns the value of thesuccessrecord component.final StringtoString()Returns a string representation of this record class.url()Returns the value of theurlrecord component.
-
Field Details
-
NOT_LINKED
No account is linked, or signing in failed- See Also:
-
EMPTY
The text is empty- See Also:
-
TOO_LONG
The text is too long; the detail islength/maximum, followed bybyteswhen a byte limit was exceeded- See Also:
-
FAILED
The platform refused the request or could not be reached- See Also:
-
-
Constructor Details
-
Method Details
-
ok
Creates a successful result- Parameters:
url- the web address of the post or profile- Returns:
- the result
-
failed
Creates a failed result- Parameters:
error- the reasondetail- more information; may benull- Returns:
- the result
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
url
Returns the value of theurlrecord component.- Returns:
- the value of the
urlrecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-
detail
Returns the value of thedetailrecord component.- Returns:
- the value of the
detailrecord component
-