KivaKit Extrait #10
Jan 04 2023
En savoir plus sur KivaKit https://state-of-the-art.org/https://www.
package com.telenav.kivakit.snippets;
import com.telenav.kivakit.core.string.FormatProperty;
import com.telenav.kivakit.core.string.ObjectFormatter;
public class Snippet10 extends BaseSnippet
{
public static void main(String[] args)
{
new Snippet10().run();
}
public class Alien
{
@FormatProperty
private final String name;
@FormatProperty
private final Galaxy galaxy;
public Alien(String name, Galaxy galaxy)
{
this.name = name;
this.galaxy = galaxy;
}
@Override
public String toString()
{
return new ObjectFormatter(this).toString();
}
}
public class Galaxy
{
@FormatProperty
private final String name;
public Galaxy(String name)
{
this.name = name;
}
}
@Override
protected Object onSnippet()
{
return new Alien("Fred", new Galaxy("Andromeda")).toString();
}
}
Output
[Snippet10.Alien galaxy = [Snippet10.Galaxy name = Andromeda], name = Fred]
En savoir plus sur KivaKit
https://state-of-the-art.org/
https://www.kivakit.org/
Articles Liés
Extrait KivaKit #1
Extrait KivaKit #2
Extrait KivaKit #3
Six raisons pour lesquelles la plupart des Java que vous avez vus ne sont pas du vrai Java
Pourquoi un hôte n'est pas une chaîne et un port n'est pas un entier
Un entier n'est pas un compte
Tout est diviser pour régner
![Qu'est-ce qu'une liste liée, de toute façon? [Partie 1]](https://post.nghiatu.com/assets/images/m/max/724/1*Xokk6XOjWyIGCBujkJsCzQ.jpeg)



































