
Programming for beginners
1000 FOLLOWERS
Programming Languages ABAP C# Groovy Haskell Java JavaScript Julia Kotlin Prolog Python R Tutorial Esoteric Program...
Programming for beginners
1w ago
Using ‘note left’, ‘note right’ keywords we can add notes the messages in a sequence diagram.
notes.txt
@startumlClient -> LoginServer: Enter user nameClient -> LoginServer: Enter passwordnote left: Input from the user \n should be taken by clientClient -> LoginServer: Submit the form note right: User details are validated \n against login serverLoginServer -> ADServer: Check the credentialsADServer -> LoginServer: Login SuccessfulLoginServer -> Client: Login Successful@enduml
Above snippet generates below diagram.
Previous &n ..read more
Programming for beginners
1w ago
In this post, I am going to explain how to publish and listen on custom events in Micronaut.
Define an event class.
public class ConnectionCreateEvent {private String message;public ConnectionCreateEvent(String message) {this.message = message; }public String getMessage() {return message; }public void setMessage(String message) {this.message = message; }}
Define a publisher bean that emit the ConnectionCreateEvent messages.
@Singletonpublic class ConnectionCreateEventPublisher {@Inject ApplicationEventPublisher<ConnectionCreateEvent> eventPublisher;pu ..read more
Programming for beginners
1w ago
@DefaultImplementation annotation is applied on an interface to indicate which implementation is the default implementation.
But there are cases, where you might need to replace the default implementation of the interface due to visibility restrictions of the class.
@DefaultImplementation(FileDataSource.class)public interface DataSource {}@Singletonclass FileDataSource implements DataSource {public String toString() {return "MySQLDataSource"; }}@Singleton@Replaces(DataSource.class)public class MySQLDataSource implements DataSource {@Overridepublic String toString() {return "MySQLDat ..read more
Programming for beginners
1w ago
You can specify a secondary label to the group by placing the text between [].
Syntax
group label [secondaryLabel]
secondaryGroupLabel.txt
@startumltitle "User login flow"header "User login"footer %page% of %lastpage%Client -> LoginServer: Enter user nameClient -> LoginServer: Enter passwordClient -> LoginServer: Submit the form LoginServer -> ADServer: Check the credentialsalt#green #lightblue login successful ADServer -> LoginServer: Login Successful LoginServer -> Client: Login Successfulelse Server not accessible group#silver "Retry to connec ..read more
Programming for beginners
1w ago
‘group’ keyword is used to group the statements.
group.txt
@startumltitle "User login flow"header "User login"footer %page% of %lastpage%Client -> LoginServer: Enter user nameClient -> LoginServer: Enter passwordClient -> LoginServer: Submit the form LoginServer -> ADServer: Check the credentialsalt#green #lightblue login successful ADServer -> LoginServer: Login Successful LoginServer -> Client: Login Successfulelse Server not accessible group#silver "Retry to connect the server" loop #00FFF8 "three times" LoginServer -> ADSe ..read more
Programming for beginners
1w ago
‘loop’ keyword specify the recurring instructions.
loop.txt
@startumltitle "User login flow"header "User login"footer %page% of %lastpage%Client -> LoginServer: Enter user nameClient -> LoginServer: Enter passwordClient -> LoginServer: Submit the form LoginServer -> ADServer: Check the credentialsalt#green #lightblue login successful ADServer -> LoginServer: Login Successful LoginServer -> Client: Login Successfulelse Server not accessible group "Retry to connect the server" loop "three times" LoginServer -> ADServer: Check the ..read more
Programming for beginners
1w ago
In this post, I am going to explain how to format various code snippets in Javadoc.
a. Using <pre> tag
b. Using <code> tag
c. Using {@code}
d. Using <pre> + {@code}
Using <pre> tag
<pre> tag defines the preformatted text, the content in <pre> tag preserves both spaces and line break.
Example
/** * Resource module provides a method to get a Resource instance. * * <pre> * Resource resource = Resource.create(); * resource.text(); * resource.close(); * </pre> * * @a ..read more
Programming for beginners
1w ago
By applying the @Replaces annotation on the method(s) and denote the factory to apply to, we can replace one or more factory methods and retain the rest.
@Factorypublic class BooksBeanFactoryV2 {@Singleton@Named("java_tutorial_1")@Replaces(value = Book.class, factory = BooksBeanFactoryV1.class, named = "java_tutorial_1")public Book javaBook() { Book book1 = new Book("Programming for beginners (https://self-learning-java-tutorial.blogspot.com)");return book1; }}
Find the below working application.
Step 1: Create new maven project ‘micronaut-replace-factory-methods ..read more
Programming for beginners
1w ago
‘alt/else’ keyword can be used to address multiple cases in a sequence diagram. This is one of the grouping construct, a grouping construct is closed by end keyword.
altElse.txt
@startumltitle "Login successful flow"header "User login"footer %page% of %lastpage%Client -> LoginServer: Enter user nameClient -> LoginServer: Enter passwordClient -> LoginServer: Submit the form LoginServer -> ADServer: Check the credentialsalt#green #lightblue login successful ADServer -> LoginServer: Login Successful LoginServer -> Client: Login Successfulelse #gold username i ..read more
Programming for beginners
1w ago
Following keywords are used to group the messages
a. alt/else
b. opt
c. loop
d. par
e. break
f. critical
g. group, foll
Previous Next &nb ..read more