org.apache.cayenne.gen.ClassGenerationAction.class Maven / Gradle / Ivy
The newest version!
???? 7?
java/lang/Object ()V
,org/apache/cayenne/gen/ClassGenerationAction cgenConfiguration *Lorg/apache/cayenne/gen/CgenConfiguration;
(org/apache/cayenne/gen/CgenConfiguration getExternalToolConfig ()Ljava/lang/String; org.apache.velocity.tools
java/lang/System getProperty &(Ljava/lang/String;)Ljava/lang/String; %org/apache/velocity/tools/ToolManager
(ZZ)V
! " # $ % 3org/apache/velocity/tools/config/ConfigurationUtils find K(Ljava/lang/String;)Lorg/apache/velocity/tools/config/FactoryConfiguration;
' ( ) getToolboxFactory ,()Lorg/apache/velocity/tools/ToolboxFactory;
+ , - . / (org/apache/velocity/tools/ToolboxFactory configure :(Lorg/apache/velocity/tools/config/FactoryConfiguration;)V
1 2 3
createContext )()Lorg/apache/velocity/tools/ToolContext; 5 6 7 context %Lorg/apache/velocity/context/Context; 9 #org/apache/velocity/VelocityContext
8 < java/util/HashMap
; > ? (I)V A B C
templateCache Ljava/util/Map;
E F G H I "org/apache/cayenne/gen/StringUtils getInstance &()Lorg/apache/cayenne/gen/StringUtils; K L M N org/apache/cayenne/gen/Artifact getQualifiedClassName
E P Q
stripClass
E S T stripPackageName K V W getQualifiedBaseClassName Y Z makeConcatWithConstants
\ ] getSuperPkg
_ ` a b c java/lang/String isEmpty ()Z Y f
baseClassName h i j k l #org/apache/velocity/context/Context put 8(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; n basePackageName p subClassName r subPackageName t superClassName v superPackageName x object K z { | getObject ()Ljava/lang/Object; ~ stringUtils ? createPropertyNames
? ? c isCreatePropertyNames
? ? ? ? ? java/lang/Boolean valueOf (Z)Ljava/lang/Boolean; ? createPKProperties
? ? c isCreatePKProperties ? ? ? utilsFactory *Lorg/apache/cayenne/gen/ToolsUtilsFactory; ? ? ? ? ? (org/apache/cayenne/gen/ToolsUtilsFactory createImportUtils &()Lorg/apache/cayenne/gen/ImportUtils; ? importUtils ?
propertyUtils ? ? ? logger Lorg/slf4j/Logger; ? ? ? ? createPropertyUtils ^(Lorg/slf4j/Logger;Lorg/apache/cayenne/gen/ImportUtils;)Lorg/apache/cayenne/gen/PropertyUtils; ?
metadataUtils ? ? ? &Lorg/apache/cayenne/gen/MetadataUtils; K ? ? ? postInitContext ((Lorg/apache/velocity/context/Context;)V ? ? ? ? ? java/util/Collection iterator ()Ljava/util/Iterator; ? ? ? ? c java/util/Iterator hasNext ? ? ? | next ? org/apache/cayenne/map/ObjEntity ? %org/apache/cayenne/gen/EntityArtifact
? ? ? %(Lorg/apache/cayenne/map/ObjEntity;)V
? ? ? addArtifact $(Lorg/apache/cayenne/gen/Artifact;)V ? !org/apache/cayenne/map/Embeddable ? )org/apache/cayenne/gen/EmbeddableArtifact
? ? ? &(Lorg/apache/cayenne/map/Embeddable;)V
? ? getArtifactsGenerationMode ? ? ? ? ? .org/apache/cayenne/gen/ArtifactsGenerationMode ALL 0Lorg/apache/cayenne/gen/ArtifactsGenerationMode;
? ? ? getLabel
_ ? ? ? equals (Ljava/lang/Object;)Z ? &org/apache/cayenne/gen/DataMapArtifact
? ? ?
getDataMap "()Lorg/apache/cayenne/map/DataMap;
? ? ? ? ? org/apache/cayenne/map/DataMap getQueryDescriptors ()Ljava/util/Collection;
? ? ? 9(Lorg/apache/cayenne/map/DataMap;Ljava/util/Collection;)V
? ? ? getArtifacts ? ? ? ? contains ? ? ? clear
? ? ? getEntities ()Ljava/util/Set; ? ? ? ? ?
java/util/Set stream ()Ljava/util/stream/Stream; apply M(Lorg/apache/cayenne/gen/ClassGenerationAction;)Ljava/util/function/Function; java/util/stream/Stream map 8(Ljava/util/function/Function;)Ljava/util/stream/Stream;
java/util/stream/Collectors toList ()Ljava/util/stream/Collector; collect 0(Ljava/util/stream/Collector;)Ljava/lang/Object;
addEntities (Ljava/util/Collection;)V
? getEmbeddables
addEmbeddables
!"
addDataMap #(Lorg/apache/cayenne/map/DataMap;)V
$% validateAttributes
'( ? execute* ?+
java/util/Map
-. ? resetContextForArtifact
01 c isMakePairs 34567 -org/apache/cayenne/gen/ArtifactGenerationMode GENERATION_GAP /Lorg/apache/cayenne/gen/ArtifactGenerationMode; 39:7 SINGLE_CLASS K<=> getTemplateTypes W(Lorg/apache/cayenne/gen/ArtifactGenerationMode;)[Lorg/apache/cayenne/gen/TemplateType;
@AB
openWriter 7(Lorg/apache/cayenne/gen/TemplateType;)Ljava/io/Writer;
DE ? resetContextForArtifactTemplate
GHI getTemplate E(Lorg/apache/cayenne/gen/TemplateType;)Lorg/apache/velocity/Template;
KLMNO org/apache/velocity/Template merge 8(Lorg/apache/velocity/context/Context;Ljava/io/Writer;)V
QRST java/io/Writer closeV java/lang/Throwable
UXYZ
addSuppressed (Ljava/lang/Throwable;)V\ java/util/Properties
[
_`a initVelocityProperties >(Ljava/util/Properties;Lorg/apache/cayenne/gen/TemplateType;)Vc &org/apache/velocity/app/VelocityEngine
b
bfgh init (Ljava/util/Properties;)V
jkl getTemplateByType L(Lorg/apache/cayenne/gen/TemplateType;)Lorg/apache/cayenne/gen/CgenTemplate;
nopq #org/apache/cayenne/gen/CgenTemplate getName
bsHt 2(Ljava/lang/String;)Lorg/apache/velocity/Template;
nvw c isFiley ,org/apache/velocity/runtime/RuntimeConstants{ resource.loaders} cayenne
[ k? 8(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;? resource.loader.cayenne.class? 3org/apache/cayenne/gen/ClassGeneratorResourceLoader
?o? java/lang/Class? resource.loader.cayenne.cache? false
??? getRootPath ()Ljava/nio/file/Path;? resource.loader.cayenne.root? string? resource.loader.string.class? @org/apache/velocity/runtime/resource/loader/StringResourceLoader? &resource.loader.string.repository.name? customTemplateRepo
??? putTemplateTextInRepository ((Lorg/apache/cayenne/gen/CgenTemplate;)V? Forg/apache/velocity/runtime/resource/util/StringResourceRepositoryImpl
?
n?? getData????? Borg/apache/velocity/runtime/resource/util/StringResourceRepository putStringResource '(Ljava/lang/String;Ljava/lang/String;)V
????
setRepository Y(Ljava/lang/String;Lorg/apache/velocity/runtime/resource/util/StringResourceRepository;)V
??? buildOutputPath? *org/apache/cayenne/CayenneRuntimeException? Output directory is not set.
?? ? ((Ljava/lang/String;[Ljava/lang/Object;)V? java/nio/file/LinkOption
????? java/nio/file/Files notExists 2(Ljava/nio/file/Path;[Ljava/nio/file/LinkOption;)Z? %java/nio/file/attribute/FileAttribute
???? createDirectories R(Ljava/nio/file/Path;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path;? java/io/IOException? "Can't create output directory '%s'
???? isDirectory? '%s' is not a directory.
????
isWritable (Ljava/nio/file/Path;)Z? 1No write permission for the output directory '%s'
???? c #org/apache/cayenne/gen/TemplateType isSuperclass
??? fileForSuperclass ()Ljava/io/File;
??? fileForClass?
superclass? class
???? java/io/File getCanonicalPath ? Z? 8(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;????? org/slf4j/Logger info (Ljava/lang/String;)V? java/io/FileOutputStream
?? ? (Ljava/io/File;)V
?? getEncoding? java/io/OutputStreamWriter
? +(Ljava/io/OutputStream;Ljava/lang/String;)V
? (Ljava/io/OutputStream;)V h get &(Ljava/lang/String;)Ljava/lang/Object;
*
getOutputPattern
E !replaceWildcardInStringWithString J(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;? java/nio/file/Path toFile
mkpath 0(Ljava/io/File;Ljava/lang/String;)Ljava/io/File;
? #(Ljava/io/File;Ljava/lang/String;)V
? c exists
"#$ getSuperTemplate '()Lorg/apache/cayenne/gen/CgenTemplate;
&'( fileNeedUpdate #(Ljava/io/File;Ljava/lang/String;)Z
*+ c isOverwrite
-H$
/0 c isForce
234 isOld (Ljava/io/File;)Z
?6 ?
?89: lastModified ()J
<=: getTimestamp
?@ c isUsePkgPath ?BCD
separatorChar C
_FGH replace (CC)Ljava/lang/String;
?J? c
?LM c mkdirsO java/lang/Exception
_Q ?R &(Ljava/lang/Object;)Ljava/lang/String; Y
N6
?VWX
getEmbeddable 7(Ljava/lang/String;)Lorg/apache/cayenne/map/Embeddable;
?Z[\ getObjEntity 6(Ljava/lang/String;)Lorg/apache/cayenne/map/ObjEntity; SUPERCLASS_PREFIX Ljava/lang/String;
ConstantValuea _ WILDCARD CUSTOM_TEMPLATE_REPO Signature ALjava/util/Map; -(Lorg/apache/cayenne/gen/CgenConfiguration;)V Code LineNumberTable LocalVariableTable config 7Lorg/apache/velocity/tools/config/FactoryConfiguration; manager 'Lorg/apache/velocity/tools/ToolManager; this .Lorg/apache/cayenne/gen/ClassGenerationAction;
cgenConfig toolConfigFile
StackMapTable artifact !Lorg/apache/cayenne/gen/Artifact; $Lorg/apache/cayenne/gen/StringUtils; qualifiedClassName packageName className qualifiedBaseClassName $Lorg/apache/cayenne/gen/ImportUtils; entity "Lorg/apache/cayenne/map/ObjEntity; entities Ljava/util/Collection; LocalVariableTypeTable :Ljava/util/Collection; =(Ljava/util/Collection;)V
embeddable #Lorg/apache/cayenne/map/Embeddable; embeddables ;Ljava/util/Collection; >(Ljava/util/Collection;)V dataMap Lorg/apache/cayenne/map/DataMap; prepareArtifacts
Exceptions out Ljava/io/Writer; type %Lorg/apache/cayenne/gen/TemplateType; artifactMode
templateTypes &[Lorg/apache/cayenne/gen/TemplateType;? props Ljava/util/Properties; velocityEngine (Lorg/apache/velocity/app/VelocityEngine; template %Lorg/apache/cayenne/gen/CgenTemplate; repo DLorg/apache/velocity/runtime/resource/util/StringResourceRepository; e Ljava/io/IOException; dir Ljava/nio/file/Path; label templateType outFile Ljava/io/File; Ljava/io/FileOutputStream; filename dest templateFile templateFileName file pkgName path fullPath setLogger (Lorg/slf4j/Logger;)V getCgenConfiguration ,()Lorg/apache/cayenne/gen/CgenConfiguration;
setContext setCgenConfiguration getUtilsFactory ,()Lorg/apache/cayenne/gen/ToolsUtilsFactory; setUtilsFactory -(Lorg/apache/cayenne/gen/ToolsUtilsFactory;)V setMetadataUtils )(Lorg/apache/cayenne/gen/MetadataUtils;)V getMetadataUtils (()Lorg/apache/cayenne/gen/MetadataUtils; lambda$prepareArtifacts$1 lambda$prepareArtifacts$0
SourceFile ClassGenerationAction.java BootstrapMethods? _? .auto? &(Ljava/lang/Object;)Ljava/lang/Object;?
??\\?
??XX? Generating file: ? Error making path: ?
??? Z? $java/lang/invoke/StringConcatFactory ?(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;?
????? "java/lang/invoke/LambdaMetafactory metafactory ?(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; InnerClasses? %java/lang/invoke/MethodHandles$Lookup? java/lang/invoke/MethodHandles Lookup ! ]^ _ ` b^ _ c^ _ ? ? ? 6 7 B C d e ? ? ? ? f g ? Z*? *+? +?
M? ? ,? +? Y? N,? ,? :-? &? **-? 0? 4? *? 8Y? :? 4*? ;Y? =? @? h 6
R S T V W $ X ( Y . Z 7 \ ? ] B ^ M ` Y ai 4 . jk $ lm Zno Zp Lq^ r ? _ ? ?
. ? g ?? DM+? J N,-? O:,-? R:+? U :,? O:,? R:,-? R? X : *? ? [:
?
? ^? ? d :
*? 4e? g W*? 4m? g W*? 4o? g W*? 4q? g W*? 4s ? g W*? 4u
? g W*? 4w+? y ? g W*? 4},? g W*? 4*? ? ?? ?? g W*? 4?*? ? ?? ?? g W? h Z g i j k m ! n ) o 1 q = s F t S u \ x j y x { ? | ? ~ ? ? ? ? ? ? ? ? ? ? ?i p ?no ?st ? ~u ?v^ ?w^ ?x^ ! ?y^ ) ? n^ 1 ? f^ = ? t^ F ? v^
r + ? S K E _ _ _ _ _ _ _ _ E ? g ? L*? ?? ? M*? 4?,? g W*? 4?*? ?*? ?,? ? ? g W*? 4?*? ?? g W+*? 4? ? ? h ?
? ? 1 ? A ? K ?i Lno Lst
B ?z g ? 1+? /+? ? M,? ? ? ,? ? ? ?N*? ? ?Y-? ?? ç?ޱ h ? ? ? - ? 0 ?i {| 1no 1}~ 1}? r ? ?? $d ? g ? 1+? /+? ? M,? ? ? ,? ? ? ?N*? ? ?Y-? ˶ ç?ޱ h ? ? ? - ? 0 ?i ?? 1no 1?~ 1?? r ? ?? $d ? !" g ? @*? ? β Ѷ ښ ?? ?Y*? ? ?+? ? ?M*? ? ?,? ? ? *? ,? ñ h ? ? ? ' ? 7 ? ? ?i @no @?? ' st r ? * K ? g ? d*? ? ?? ? **? ? ?? ? *? ? ?
? ? ??**? ?? ? *? ? ?
? ? ??**? ? ?? h . ? ? ? $ ? / ? 2 ? E ? J ? U ? X ? c ?i dno ( g ? E*?#*? ? ?? ? L+? ? ? +? ? ? KM*,?&???*? @?) ? N*? @?) -?? , 8 h &