src/net/sourceforge/plantuml/klimt/geom/HorizontalAlignment.java
<reponame>plantuml/java-zero<filename>src/net/sourceforge/plantuml/klimt/geom/HorizontalAlignment.java// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.klimt.geom;

import java.util.Objects;

import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.shape.TextBlock;

public enum HorizontalAlignment {
	LEFT, CENTER, RIGHT;

	public static HorizontalAlignment fromString(String s) {
		if (LEFT.name().equalsIgnoreCase(s))
			return LEFT;

		if (CENTER.name().equalsIgnoreCase(s))
			return CENTER;

		if (RIGHT.name().equalsIgnoreCase(s))
			return RIGHT;

		return null;
	}

	public static HorizontalAlignment fromString(String s, HorizontalAlignment defaultValue) {
		Objects.requireNonNull(defaultValue);
		if (s == null)
			return defaultValue;

		s = StringUtils.goUpperCase(s);
		final HorizontalAlignment result = fromString(s);
		if (result == null)
			return defaultValue;

		return result;
	}


}
